Jump to content
  • Advertisement

Archived

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

Grambo

OpenGL Strange OpenGL Problem

This topic is 5901 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

I''m writing a GUI for a game and I came across a very strange problem : When I am not drawing the cursor the background is white as it should be. But when I am drawing the cursor the cursor will appear correctly but the rest of the screen will go darker (to gray). The rest of the screen always goes darker no matter what color it is originally. Does anyone know what could be causing this? Here is the drawing code:
  
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0,WndWidth,0,WndHeight,-1,1);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

glDisable(GL_DEPTH_TEST);		
glDisable(GL_BLEND);

//Draw the background (vertices were generated earlier)

glBegin(GL_QUADS);
glColor3ub(r,g,b);
for(int i =0;i < NumVertices;i++)
{
	glVertex2i(Vertices[i].x,Vertices[i].y);
}
glEnd();

//Now Draw The Cursor

glColor4ub(255,255,255,255);
glBindTexture(GL_TEXTURE_2D,CursorTexNum);
glBegin(GL_QUADS);
glTexCoord2f(0.0f,0.0f);		//Cursor Bottom left

glVertex2i(CursorX,CursorY);
glTexCoord2f(1.0f,0.0f);		//Cursor Bottom Right

glVertex2i(CursorX+CursorWidth,CursorY);
glTexCoord2f(1.0f,1.0f);		//Cursor Top Right

glVertex2i(CursorX+CursorWidth,CursorY+CursorHeight);
glTexCoord2f(0.0f,1.0f);		//Cursor Top Left

glVertex2i(CursorX,CursorY+CursorHeight);
glBindTexture(GL_TEXTURE_2D,0);
glEnd();
  
thanks

Share this post


Link to post
Share on other sites
Advertisement
Thanks, It works now. I never noticed that

[edited by - Grambo on July 26, 2002 8:19:19 AM]

Share this post


Link to post
Share on other sites
You have some older video card like TNT2, right?


glMatrixMode(GL_PROJECTION); //we must say what will we push
glPushMatrix();
glMatrixMode(GL_MODELVIEW);
glPushMatrix();



glLoadIdentity();
glOrtho(0,WndWidth,0,WndHeight,-1,1);
//bla bla bla



glMatrixMode(GL_MODELVIEW); //we must say what will we pop
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();

Share this post


Link to post
Share on other sites
Yeah, my card is pretty old, its a Kyro (which is PowerVR 3 i think). Thanks for the suggestion though, i was planning on setting up the projection matrices every frame (i''d forgotten about pushin/popping matrices) but this will be much easier.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!