The following code works when I’m not in fullscreen mode. But nothing shows up in fullscreen. The color buffer isn’t even cleared properly.
void Questionnaire: :DrawQuestionConsole() const
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glViewport(0,0,640,480);
glOrtho(0,640,0,480,-20,20);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glColor3f(1.0f,1.0f,1.0f);
glClearColor(0.0f, 1.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
graphics->printText(15,400,"A:",GLUT_BITMAP_HELVETICA_18);
graphics->printText(15,350,"B:",GLUT_BITMAP_HELVETICA_18);
graphics->printText(15,300,"C:",GLUT_BITMAP_HELVETICA_18);
graphics->printText(15,250,"D:",GLUT_BITMAP_HELVETICA_18);
graphics->printText(15,50,"Press A, B, C, or D",GLUT_BITMAP_HELVETICA_18);
}
void Graphics: :printText (int X_text_pos, int Y_text_pos, char *message, void *font)
{
int len;
int i;
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0,640,0,480,-20,20);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glRasterPos2f(X_text_pos, Y_text_pos);
len = (int) strlen (message);
for (i=0; i<len; i++)
glutBitmapCharacter(font, message[i]);
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
}
The code I use for going fullscreen is:
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
hInst = hInstance; // Store instance handle in our global variable
DEVMODE dmScreenSettings; // Device Mode
memset(&dmScreenSettings,0,sizeof(dmScreenSettings)); // Makes Sure Memory’s Cleared
dmScreenSettings.dmSize = sizeof(dmScreenSettings); // Size Of The Devmode Structure
dmScreenSettings.dmPelsWidth = width; // Selected Screen Width
dmScreenSettings.dmPelsHeight = height; // Selected Screen Height
dmScreenSettings.dmBitsPerPel = 16; // Selected Bits Per Pixel
dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
if(ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
{
MessageBox(NULL,“YOUR VIDEO CARD SUCKS.”,“ERROR”,MB_OK|MB_ICONQUESTION);
return FALSE;
}
hWnd = CreateWindow("WIN_CLASS",NULL,
WS_POPUP |
WS_VISIBLE |
WS_MAXIMIZE |
WS_CLIPCHILDREN |
WS_CLIPSIBLINGS,
0,0, 640,480
NULL,NULL,
hInstance,
NULL);
if (!hWnd)
return FALSE;
ShowWindow(hWnd,nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}
What is going wrong? I know that my buffering swapping, message handling code is correct because these functions are part of a driving simulator that works perfectly. I suspect that there are some issues with orthographics projections and fullscreen windows that I am not aware of.
Mr. Stick
[This message has been edited by poop on a stick (edited 08-23-2000).]