PDA

View Full Version : Strange change of color



zweifel
06-09-2010, 09:18 PM
Hi guys,

In my application there is a framework, which renders models in the screen. Everything worked alright, but when I changed the rendering part to draw the Bounding boxes of the skeleton I got something pretty strange. Even setting the boxes to be red, some of them remained black:

http://img820.imageshack.us/img820/6834/screenshot.jpg

I do not have any clues, since I modified a lot of the rendering parts and make sure that every model was being called with the exact same opengl settings.

The following code is called in the rendering part, after disabling any shaders.


void drawReducedSkeleton()
{

glPushAttrib(GL_ALL_ATTRIB_BITS);

glDisable(GL_LIGHTING);

--drawing bounding boxes
for all bones
{
glColor3f(1.0f,0.0f,0.0f);

//glColor4f (1.0f, 0.0f, 0.0f,0.2f);
glBegin(GL_QUADS);

glVertex3f(max[0],max[1],min[2]);
glVertex3f(min[0],max[1],min[2]);
glVertex3f(min[0],max[1],max[2]);
glVertex3f(max[0],max[1],max[2]);

glVertex3f(max[0],min[1],max[2]);
glVertex3f(min[0],min[1],max[2]);
glVertex3f(min[0],min[1],min[2]);
glVertex3f(max[0],min[1],min[2]);

glVertex3f(max[0],max[1],max[2]);
glVertex3f(min[0],max[1],max[2]);
glVertex3f(min[0],min[1],max[2]);
glVertex3f(max[0],min[1],max[2]);

glVertex3f(max[0],min[1],min[2]);
glVertex3f(min[0],min[1],min[2]);
glVertex3f(min[0],max[1],min[2]);
glVertex3f(max[0],max[1],min[2]);

glVertex3f(min[0],max[1],max[2]);
glVertex3f(min[0],max[1],min[2]);
glVertex3f(min[0],min[1],min[2]);
glVertex3f(min[0],min[1],max[2]);

glVertex3f(max[0],max[1],min[2]);
glVertex3f(max[0],max[1],max[2]);
glVertex3f(max[0],min[1],max[2]);
glVertex3f(max[0],min[1],min[2]);

glEnd();

}

glPopAttrib();





I think it is not related to it, though this code renders to a FBO, but changing it to render to the screen did not solve the issue either way.

I am on this for more than a week, so I appreciate any feedback.

Do you happen to have faced something similar?

Any tips?

zweifel
06-13-2010, 06:37 PM
The problem was the lack of a glBindTexture(GL_TEXTURE_2D,0); or a glDisable(GL_TEXTURE_2D);

I first make it working with glPushAttrib(GL_TEXTURE_BIT), which lead me to the answer.

Still I do not get it how it can be, since all my drawings do not use any texture for the reduced skeleton, only outside of this for() process.

Strange, isnt it?

Or do I need to disable GL_TEXTURE_2D when not using any texture coordinates?