Total noob in OpenGL...

This is a discussion on Total noob in OpenGL... within the Game Programming forums, part of the General Programming Boards category; Hi, I got a little problem with OpenGL... I want to display a image with text, but, the image is ...

  1. #1
    Registered User
    Join Date
    Apr 2005
    Location
    New Brunswick, Canada
    Posts
    8

    Total noob in OpenGL...

    Hi,
    I got a little problem with OpenGL... I want to display a image with text, but, the image is blue and when I try to add the image, the text, that was white, become blue...

    Here is the essential code:
    Code:
    bool InitializeGL()
    {
       glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    
       glShadeModel(GL_SMOOTH);
    	glEnable(GL_TEXTURE_2D);
    
       if(!Image.LoadPcx("image.pcx")) return false;
       
    	glGenTextures(1, &Image.ID);
       
       glBindTexture(GL_TEXTURE_2D, Image.ID);
    	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    
       gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, Image.imageWidth,
                         Image.imageHeight, GL_RGBA, GL_UNSIGNED_BYTE,
                         Image.image);
    
       listBase = CreateFont("the Gingerbread House", 128);
    
       listBase2 = CreateFont("the Gingerbread House", 48);
    
       listBase3 = CreateFont("Arial", 12);
       return true;
    }
    
    
    void RenderScene()
    {
       glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
       glLoadIdentity();               
    
       glTranslatef(0.0f, 0.0f, -3.0f);
    
       glColor3f(1.0f, 1.0f, 1.0f);
       glBindTexture(GL_TEXTURE_2D, Image.ID);
    
       glBegin(GL_QUADS);
          glTexCoord2f(0.0, 1.0); glVertex3f(-1.5f, -1.5f, -2.0f);
          glTexCoord2f(1.0, 1.0); glVertex3f(1.5f, -1.5f, -2.0f);
          glTexCoord2f(1.0, 0.0); glVertex3f(1.5f, 1.5f, -2.0f);
          glTexCoord2f(0.0, 0.0); glVertex3f(-1.5f, 1.5f, -2.0f);
       glEnd();
    
       glColor3f(1.0f, 1.0f, 1.0f);
       glRasterPos2f(-0.41f, -0.05f);
       PrintText(listBase, "Legend Breath");
       
       glColor3f(1.0f, 1.0f, 1.0f);
       glRasterPos2f(-0.40f, -0.04f);
       PrintText(listBase, "Legend Breath");
       glRasterPos2f(-0.42f, -0.04f);
       PrintText(listBase, "Legend Breath");
       glRasterPos2f(-0.40f, -0.06f);
       PrintText(listBase, "Legend Breath");
       glRasterPos2f(-0.42f, -0.06f);
       PrintText(listBase, "Legend Breath");
    
       glColor3f(0.7f, 0.7f, 0.7f);
       glRasterPos2f(-0.07f, -0.2f);
       PrintText(listBase2, "loading");
    
       glColor3f(1.0f, 1.0f, 1.0f);
       glRasterPos2f(-0.11f, -0.4f);
       PrintText(listBase3, "www.legendbreath.cjb.net");
    
       SwapBuffers(g_HDC);
    }
    I attached a JPG...

    Please help me...
    Attached Images Attached Images  

  2. #2
    Registered User
    Join Date
    Aug 2003
    Posts
    1,209
    The first thing I would do would be to disable GL_TEXTURE_2D. I remember having this problem but I am not sure if that fixed it. Try it and let me know.

  3. #3
    Registered User
    Join Date
    Apr 2005
    Location
    New Brunswick, Canada
    Posts
    8
    How am I supposed to do that?

  4. #4
    Registered User
    Join Date
    Aug 2003
    Posts
    1,209
    When you are done drawing the textured quad add this:
    Code:
    glDisable(GL_TEXTURE_2D);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with basic calculation program.
    By StateofMind in forum C Programming
    Replies: 18
    Last Post: 03-06-2009, 01:44 AM
  2. Help with day of the week program
    By Punkakitty in forum C++ Programming
    Replies: 10
    Last Post: 01-14-2009, 06:55 PM
  3. Replies: 8
    Last Post: 11-03-2008, 09:48 PM
  4. The Timing is incorret
    By Drew in forum C++ Programming
    Replies: 5
    Last Post: 08-28-2003, 05:57 PM
  5. Replies: 4
    Last Post: 04-22-2003, 01:52 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21