I have this source code :
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glColor3f(0.2,0.2,1);
glLoadIdentity();
glTranslatef(0,0,-1);
//----2D MODE----//
glPushAttrib(GL_LIGHTING_BIT|GL_DEPTH_BUFFER_BIT);
glDisable(GL_LIGHTING);
glViewport(0, 0, this->Width, this->Height);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluOrtho2D(0,(double)this->Width,0, (double)this->Height);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glBegin(GL_QUADS);
glVertex2f(0,100);
glVertex2f(1024,100);
glVertex2f(1024,0);
glVertex2f(0,0);
glEnd();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopAttrib();
//----2D MODE----//
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,TextureBin[0]);
glInitNames();
glPushName(-1);
glLoadName(1);
glBegin(GL_QUADS);
glColor3f(1,1,1);
glTexCoord2f(0,1); glVertex3f(-0.1,0.1,0);
glTexCoord2f(1,1); glVertex3f(0.1,0.1,0);
glTexCoord2f(1,0); glVertex3f(0.1,-0.1,0);
glTexCoord2f(0,0); glVertex3f(-0.1,-0.1,0);
glEnd();
I have two problems.
1)
First is not so important, but i need to solve that.
The panel i draw in 2D mode, has no blue color as glColor3f(0.2,0.2,1); says.
It has the right(blue) color just in the very first frame.
2)
Second is important.
When i click whereever in he scene, selection function returns me number 0. But when i dont draw the 2d panel, its ok. I mean when i erase all the source code about it. From glPushAtribb to glPopAtribb.