How to draw a mouse cursor in OpenGL!?

Started by
3 comments, last by Ancient Spirit 18 years, 7 months ago
I'm sorry for the noobish question, but I'm a noob lol So down to business, I have a app that load a terrain in ortho view (isometric), and I want to make a mouse cursor.... I searched nehe's and found a tutorial but for some reason it didn't worked, and I needed a better explanation on how to achieve this. Ty!
Advertisement
Use your windowing system api (or SDL) to get the mouse coordinates.

use that as the top left corner of a quad with a pointer texture on it.

update the position every frame (or every time you do your logic update)
[size="1"]
I think i expressed myself bad... sorry.

What I don't know is how to draw a textured quad in my screen independently of my actual camera. I dont know how to DRAW the mouse cursor in a 2d manner while keeping my ortho view the same.

About getting mouse coords, it's okay ;)

Quote:Original post by LordAsm
What I don't know is how to draw a textured quad in my screen independently of my actual camera. I dont know how to DRAW the mouse cursor in a 2d manner while keeping my ortho view the same.
Don't keep it the same. Before you render your cursor (and other 2d stuff such as a HUD) switch to an orthographic projection with the same dimensions as the screen. Then you can just render in screen coordinates.

EDIT: If you need more info, look here.
sorry if i didnt understood you correctly...

glPushMatrux();//Do Mouse moving here, also orth.glPopMatrix();glPushMatrux();//Do The Terrain moving hereglPopMatrix();
This world is ruled by big furry CATS!! :)Meow! :)

This topic is closed to new replies.

Advertisement