Thread: got Process terminated with status 3 (0 minutes, 0 seconds) with opengl and sdl_ttf

  1. #1
    Registered User
    Join Date
    Mar 2013
    Posts
    2

    got Process terminated with status 3 (0 minutes, 0 seconds) with opengl and sdl_ttf

    So, I wanted to try out text rendering in opengl and I followed SDL ttf:Tutorials:Fonts in OpenGL - GPWiki

    I tweaked the function a bit so finally it looked like this:

    Code:
    void RenderText(const TTF_Font *Font, SDL_Color color, const double &X, const double &Y, const std::string& Text)
    {
    	/*Create some variables.*/
    	SDL_Surface *Message = TTF_RenderText_Blended(const_cast<TTF_Font*>(Font), Text.c_str(), color);
    	unsigned Texture = 0;
    
    
    	/*Generate an OpenGL 2D texture from the SDL_Surface*.*/
    	glGenTextures(1, &Texture);
    	glBindTexture(GL_TEXTURE_2D, Texture);
    
    
    	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    
    
    	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, Message->w, Message->h, 0, GL_BGRA,GL_UNSIGNED_BYTE, Message->pixels);
    
    
    	glBegin(GL_QUADS);
    		glTexCoord2d(0, 0); glVertex2d(X, Y);
    		glTexCoord2d(1, 0); glVertex2d(X+Message->w, Y);
    		glTexCoord2d(1, 1); glVertex2d(X+Message->w, Y+Message->h);
    		glTexCoord2d(0, 1); glVertex2d(X, Y+Message->h);
    	glEnd();
    
    
    	glDeleteTextures(1, &Texture);
    	SDL_FreeSurface(Message);
    }
    I call this code like that:

    Code:
            glEnable(GL_TEXTURE_2D);
            RenderText(font,must,235.0,190.0,start);
            glDisable(GL_TEXTURE_2D);
    The variables are declared outside the main cycle

    Code:
        std::string start = "Alusta mängu";
        TTF_Font *font;
        font = TTF_OpenFont("data/georgia.ttf",20);
        SDL_Color must = {0,0,0};
    If I comment RenderText(font,must... out then everything works (have some other rectangles it's drawing etc.).

    Now problem is that I get the "Process terminated with status 3" when running it, can someone please help? And for future reference, what exactlt does status 3 mean?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Have you tried to compile with debug enabled, and then run the code in the debugger.

    This will typically catch the exception, and allow you to look around the code to find a cause.

    Or you could put a breakpoint on RenderText(), then single-step the code until it fails.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Mar 2013
    Posts
    2
    It fails once it hits glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, Message->w, Message->h, 0, GL_BGRA,GL_UNSIGNED_BYTE, Message->pixels);

    edit: NM, I'm stupid, forgot to Init TTF. Now everything works.
    Last edited by Indrek Klanberg; 03-13-2013 at 01:14 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Convert seconds to hours and minutes
    By LearnOnTheFly in forum C Programming
    Replies: 16
    Last Post: 03-28-2012, 08:27 AM
  2. Process Terminated with status -1073741510
    By Varethien in forum C Programming
    Replies: 5
    Last Post: 08-09-2011, 04:16 AM
  3. Convert seconds to hours, minutes and seconds
    By kkk in forum C Programming
    Replies: 2
    Last Post: 07-26-2011, 10:47 AM
  4. hour,minutes & seconds
    By anaer0bic in forum C Programming
    Replies: 14
    Last Post: 06-28-2011, 11:19 AM
  5. Process terminated with status -1073741819
    By smithx in forum C Programming
    Replies: 5
    Last Post: 11-01-2010, 11:13 PM