PDA

View Full Version : glReadPIxels?? ..how to keep track of 2d mouse coordinates each frame.



cutting_crew
02-23-2004, 07:30 AM
i am using glReadpixels in my program that takes the 2D coords on my mouse to give me the associated 3D coords in world space. however this only happens so far when i pick on something. i have 2 problems i am facing. i have a nice little color slider bar drawn in 2D that also gets effected when i click on any of those pixels. how would i make sure a "pick" is false when i click on the slider bar with the mouse??

finally the crux of this thread. i have a handle button on my slider bar that i want to do 2 things. when the mouse cursor moves over the handle(its a gl_quad) i want it to change color. in order for this to work i have to keep up with what the current mouse 2D coordinate is, since i obviously know what the 2D position (width and height) of the Quad is. i know how to make these checks just trying to figure out what the OGL command is. also when the mouse is over the QUAD and that function brings back a TRUE AND when the left mouse button is down i want the handle of the slider bar to move with the mouse , in either left or right direction. again i think i can handle this part but this goes back to the picking issue. i dont want a "pick" to be called when i press down on the QUAD i just want the slider to move with it. the main reason for this is is when a pick occurs in my program a sphere in drawn. obviously i dont want this to happen when i pick the handle or else i will have a big white sphere in view and thats not what i want. i hope i explained my problem pretty well. thanks all in advance!

cutting_crew
02-23-2004, 08:04 AM
so lets say my Quad is drawn at the points:

0, 0
2, 0
2, -1
0, -1

i want to know when the mouse pointer crosses these two points or is in front of these 2 points.