I’m using the pop-up menus in OpenGL to allow users to input what item or picture they wish to create. When I activate the menu and click to, for example, “Create Agent”, it flashes the picture on the screen but then nothing is actually drawn. So when I activate the menu again for a 2nd time repeating the same thing it draws it. I am not sure what I am doing wrong. Here’s my sample code below:
void mainMenu(int value){
if(value == 1){ createAgent(); }
if(value == 0){ exit(0); }
}
void createDiamond()
{
glPushMatrix();
GLUquadricObj* mySphere2;
mySphere2 = gluNewQuadric();
gluQuadricDrawStyle(mySphere2, GLU_LINE);
glColor3f(0.0, 1.0, 1.0);
glLineWidth(2.0);
Originally posted by zsabrina: I use a reshape function whenever the screen is resized and/or moved…??? Could you explain what you mean further???
What I think he means is that you must call createAgent() every time you need to have it drawn. With X every time you get an expose event you must redraw your scene and call createAgent(). Windows has something similar I’m sure. An alternative would be to have createAgent() create a display list, then your expose event could simply call the display list.
SigSegV :
So basically I used your example of “expose” function as my display and embedded the if within my display function. This worked! Thanks!! Now let’s see if I can create other objects in this manner as well… without getting anymore bugs.
Thanks a bunch to everyone for helping!!!