dfanuk
04-09-2002, 02:55 AM
Hi!
I am programming a project in C++ with OpenGL and have been using the nehe.gamedev.net tutorials as a basis for my code. I have been having a couple of difficulties and would appreciate help with them please!
Firsty, I have 4 buttons on my screen at the moment (these are basically 4 quads and I am detecting where the mouse is clicked). On clicking on the topmost 3 buttons the user should be taken to a new screen (a different screen for each one). However, I do not have a different screen I am going to totally change my current screen instead. At the moment I am trying to get the top button working. The main screen has a black background and the screen which the top button leads to has a white background. My problem is that when I click on this button when the program is running, nothing happens. I have a variable, called screen, which refers to which screen the user is on.
This is my DrawGLScene function:
int DrawGLScene(GLvoid) //Here's Where We Do All The Drawing
{
switch (screen)
{
case 0:
{
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
........ then some text and quad code
return 0;
}
case 1:
{
glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
return 0;
}
}
return TRUE; //Everything Went OK
}
The idea being that at the moment I just want to check that it is clearing the screen when the mouse is clicked. I know that the mouse code is correct as I am able to exit the program by clicking on the bottom button.
My second problem is that I am unsure how to use more than one different font in my program. I used the NeHe font tutorial and can now easily put text on the screen with one font but am not sure how to change the fonts as it seems to link the font to the hDC.
If anyone can help with either or both of these problems I would be very grateful!
Thanks
Gareth
I am programming a project in C++ with OpenGL and have been using the nehe.gamedev.net tutorials as a basis for my code. I have been having a couple of difficulties and would appreciate help with them please!
Firsty, I have 4 buttons on my screen at the moment (these are basically 4 quads and I am detecting where the mouse is clicked). On clicking on the topmost 3 buttons the user should be taken to a new screen (a different screen for each one). However, I do not have a different screen I am going to totally change my current screen instead. At the moment I am trying to get the top button working. The main screen has a black background and the screen which the top button leads to has a white background. My problem is that when I click on this button when the program is running, nothing happens. I have a variable, called screen, which refers to which screen the user is on.
This is my DrawGLScene function:
int DrawGLScene(GLvoid) //Here's Where We Do All The Drawing
{
switch (screen)
{
case 0:
{
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
........ then some text and quad code
return 0;
}
case 1:
{
glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
return 0;
}
}
return TRUE; //Everything Went OK
}
The idea being that at the moment I just want to check that it is clearing the screen when the mouse is clicked. I know that the mouse code is correct as I am able to exit the program by clicking on the bottom button.
My second problem is that I am unsure how to use more than one different font in my program. I used the NeHe font tutorial and can now easily put text on the screen with one font but am not sure how to change the fonts as it seems to link the font to the hDC.
If anyone can help with either or both of these problems I would be very grateful!
Thanks
Gareth