Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

daerom

GL settings effecting multiple objects

This topic is 5739 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok, lets say I do a glColor3f(1, 1, 0); to make some text print out Yellow, but I don''t want it to effect anything else. How would I do that? I tried doing this, but it doesn''t even work on the text in the first place, it actually works on the next thing I render, which happends to be my skybox, wich is now tinted yellow. -Daerom

Share this post


Link to post
Share on other sites
Advertisement
You have to set the color to what you want before you draw every object

i.e

void DrawObject1() {
glColor3f(0.0f, 1.0f, 0.0f);//sets color to green
//drawing code here
}

void DrawObject2() {
glColor3f(1.0f, 0.0f, 0.0f);//sets color to red
//drawing code here
}

Share this post


Link to post
Share on other sites
I looked at that glPushAttrib and PopAttrib, but I am a little confused as to what mask to use... could you help me out a little

Thanks

-Daerom

Share this post


Link to post
Share on other sites
You probably need GL_CURRENT_BIT, which will save/restore (Blue Book p415)

- current RGBA color
- current color index
- current normal vector
- current texture coordinates
- current raster position
- GL_CURRENT_RASTER_POSITION_VALID flag
- RGBA color associated with current raster position
- color index associated with current raster position
- texture coordinates associated with current raster position
- GL_EDGE_FLAG flag

The attribute stack is guaranteed at least 16 levels.
Of course the save/restore operation MAY be expensive if a pipeline flush is needed. Think whether you really need it or if a call to glColor() is enough

Documents [ GDNet | MSDN | STL | OpenGL | Formats | RTFM | Asking Smart Questions ]
C++ Stuff [ MinGW | Loki | SDL | Boost. | STLport | FLTK | ACCU Recommended Books ]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!