Results 1 to 4 of 4

Thread: mixing glBindTexture and glColor3f

  1. #1
    Member Contributor
    Join Date
    Apr 2000
    Location
    Staten Island New York
    Posts
    53

    mixing glBindTexture and glColor3f

    I need some clarification here.
    Example:
    init()
    {
    glEnable(GL_TEXTURE_2D);

    other stuff...
    }

    display()
    {
    glPushMatrix();

    glTranslatef(...);

    glBindTexture2D(....);
    draw_box();

    glBindTexture2D(....);
    draw_box2();

    glColor3f(1.0,0.0,0.0);
    draw_box3();

    glPopMatrix();

    glutSwapBuffers();
    }
    How come draw_box3() isn't drawn red?
    How come texturing is turned off and everything in scene is red?
    Should I use glDeleteTexture(s) or glDisable(GL_TEXTURE_2D)?

  2. #2
    Senior Member Regular Contributor
    Join Date
    Dec 1969
    Location
    Munich,Germany
    Posts
    227

    Re: mixing glBindTexture and glColor3f

    yep to draw colored you need to call glDisable(GL_TEXTURE_2D)
    yes

  3. #3
    Senior Member Regular Contributor
    Join Date
    Nov 2000
    Location
    Dunblane, Scotland
    Posts
    333

    Re: mixing glBindTexture and glColor3f

    It is important to note that once you have called glColor then everything you render after that will be that colour. Just because you set the color to red at the end of your rendering function doesn't mean that only box3 will be red. The first time you run it the other boxes will be coloured with the defualt white, butafter that since red is the color still in the `state machine` all boxes will be red.
    Reality is for idiots only the best over come it!

  4. #4
    Senior Member Regular Contributor
    Join Date
    Dec 1969
    Location
    Munich,Germany
    Posts
    227

    Re: mixing glBindTexture and glColor3f

    oops didn't notice the sentence about everything being drawn red. Yep Tim is right once a color is set to a specific color it will stay that way untill it is changed.
    yes

Similar Threads

  1. glColor3f not working
    By TimOgunmakin in forum OpenGL: Basic Coding
    Replies: 7
    Last Post: 04-11-2013, 08:59 PM
  2. troubles with glColor3f()
    By stephanmorf in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 05-16-2009, 04:56 AM
  3. glColor3f(,,) wash out?
    By darkrappey in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 09-27-2006, 03:30 AM
  4. GlColor3f and Gl_Decal
    By VasRoG in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 11-10-2005, 11:13 AM
  5. Parameter in glColor3f 1, 0, 0 by Example...
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 10-01-2001, 05:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean