problem with modifying lesson 32
hi, im just havin some weird problems with the lesson 32 code, i have a method to make a 3d ship called drawShip(), which i call in the main draw method below, i what i want is my ship will appear in the foreground and the sky and ground will be rolling to give the illusion of movement, so i have not included the code for the sky and ground in the following code:
glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
glPushMatrix(); // Store The Projection Matrix
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
drawShip();
glPopMatrix();
// Crosshair (In Ortho View)
RECT window; // Storage For Window Dimensions
GetClientRect (g_window->hWnd,&window); // Get Window Dimensions
glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
glPushMatrix(); // Store The Projection Matrix
glLoadIdentity(); // Reset The Projection Matrix
glOrtho(0,window.right,0,window.bottom,-1,1); // Set Up An Ortho Screen
glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
glTranslated(mouse_x,window.bottom-mouse_y,0.0f); // Move To The Current Mouse Position
Object(16,16,8); // Draw The Crosshair
// Game Stats / Title
//glPrint(240,450,"NeHe Productions"); // Print Title
glPrint(10,10,"Level: %i",level); // Print Level
glPrint(250,10,"Score: %i",score); // Print Score
if (miss>9) // Have We Missed 10 Objects?
{
miss=9; // Limit Misses To 10
game=TRUE; // Game Over TRUE
}
if (game) // Is Game Over?
glPrint(490,10,"GAME OVER"); // Game Over Message
else
glPrint(490,10,"Morale: %i/10",10-miss); // Print Morale #/10
glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
glPopMatrix(); // Restore The Old Projection Matrix
glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
glFlush(); // Flush The GL Rendering Pipeline
}
as you can see the code is the exact same pretty much, as the existing code from lesson 32, but i have added the drawShip() command, the program compiles but you cant see the level scrolling by, the ship appears as desired but the colours are weird and it seems to be glowing or something :/ can anybody help me with this? as i really dont know whats going on, maybe something to do with the matrices??
go hard or go home :)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement