PDA

View Full Version : Simple polygon problem. . .



Schlogenburg
11-27-2000, 12:12 PM
I got a game where the mouse controls a pointer. The pointer is 3d, and it is displayed in 3d but very close to what a 2d one would be. As if a sphere was around the user and the mouse was displayed on the surface of this sphere and slid around as if the inside surface of the sphere was the screen. The user of course is surrounded by this sphere. ok.

Now I have transformed/rotated lots and lots and displayed my scene, and I want to transform and rotate to be able to show this mouse cursor without wrecking the rest of my scene.

Been a while since I've done serious coding, probably a simple solution for this.

The Wolf
11-27-2000, 12:49 PM
you can reset the view then display your mouse pointer. i,e:
void DrawScene();
{
all your rotation, transformation and drawing is here..
...
glLoadIdentity(); // this resets the view
glTranslatef(mousex,mousey,mousez);
DrawMouse();
} // end of DrawScene( )

It wont affect your previously drawn objects, and the mouse is displayed at the coordinates without being affected by the rotation and translations done before.
PS since it resets the view, better draw the mouse at the end of your drawing function. hope this helps


[This message has been edited by The Wolf (edited 11-27-2000).]

Deiussum
11-27-2000, 01:26 PM
If you didn't want to lose all your translations, rotations, etc, you could also do the glLoadIdentity between a glPushMatrix glPopMatrix pair.

void Display()
{
// all your original drawing stuff
glPushMatrix(); // puts current matrix on the stack
glLoadIdentity();
// do your cursor thing
glPopMatrix(); // replaces current matrix with the matrix you put on the stack
}