Hey, this is a weird problem and I am wondering if it is XP-related. This is the first game I started coding on XP from scratch, and although my OpenGL sources are nearly identical to my other GL sources, I seem to have a problem. When I start the app and it goes fullscreen, it won’t truly go fullscreen. It creates the window and viewport, but you can see the titlebar and window sides. It’s like you stretched a window to the max extents of your monitor and right over the task-bar.
It also will not display my triangles or anything! I have the clear color set to gray (all four values at 0.5) yet the background of the window is green. I’m going to post my drawing routine which is being called every loop of the program, but is not rendering jack.
//Here’s my initialization function
bool InitGL()
{
if(!LoadTextures())
return false;glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glFrontFace(GL_CCW);
glEnable(GL_TEXTURE_2D);
glShadeModel(GL_SMOOTH);
glClearColor(0.5f, 0.5f, 0.5f, 0.0f);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);MainLog(“OpenGL initialized!”);
return true;
}//And here’s the rendering function
void DrawScreen()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
gluLookAt(Player.Position.X, Player.Position.Y, -8.0, Player.Position.X, Player.Position.Y, 0.0, 0.0, 1.0, 0.0);
glNormal3f(0.0, 1.0, 0.0);for(short int BlockLoop = 0; BlockLoop < Map->numBlocks; BlockLoop++)
{
glBindTexture(GL_TEXTURE_2D, Map->Texture[Map->Block[BlockLoop].TexID]);
glBegin(GL_TRIANGLES);glTexCoord2i(0, 1); glVertex3i(Map->Block[BlockLoop].X, Map->Block[BlockLoop].Y, 0.250); glTexCoord2i(1, 1); glVertex3i((Map->Block[BlockLoop].X + 64), Map->Block[BlockLoop].Y, 0.250); glTexCoord2i(0, 0); glVertex3i(Map->Block[BlockLoop].X, (Map->Block[BlockLoop].Y + 64), 0.250); glTexCoord2i(0, 0); glVertex3i(Map->Block[BlockLoop].X, (Map->Block[BlockLoop].Y + 64), 0.250); glTexCoord2i(1, 1); glVertex3i((Map->Block[BlockLoop].X + 64), Map->Block[BlockLoop].Y, 0.250); glTexCoord2i(1, 0); glVertex3i((Map->Block[BlockLoop].X + 64), (Map->Block[BlockLoop].Y + 64), 0.250); glEnd(); }
glBindTexture(GL_TEXTURE_2D, 1);
glBegin(GL_TRIANGLES);
glTexCoord2i(0, 1);
glVertex3f(Player.Position.X - 16, Player.Position.Y - 16, 0.0);
glTexCoord2i(1, 1);
glVertex3f(Player.Position.X + 16, Player.Position.Y - 16, 0.0);
glTexCoord2i(0, 0);
glVertex3f(Player.Position.X - 16, Player.Position.Y + 16, 0.0);
glEnd();SwapBuffers(WinData.DeviceContext);
glFlush();
return;
}
Any ideas why this thing won’t work? I am ready to blame XP 100%, but before I go flame MS, I thought I’d let some others look at the code and see if I was screwing up somewhere along the line.
EDIT
Forgot to mention, this is going to wind up being a side-scrolling game, which is why I am using gluLookAt() the way I am. And that last section of code is for testing purposes. It should render a triangle on the middle of the screen at all times, but not even it shows up.
[This message has been edited by Sephiroth (edited 06-05-2003).]