PDA

View Full Version : spin or slider control in vcpp for opengl



ms
02-08-2005, 03:08 PM
how to code
spin / slider control rotate of an opengl object (expl cube) from SetRange (-90, 90), this using Visual C ++ on dialog box aplication

i have problem if from negative value (expl -90) :confused:

dvm
02-08-2005, 10:47 PM
Just map the values from pixels, to [-90,90].

dvm
02-12-2005, 12:15 AM
What I'm saying is, you want to have a slider that has a size on some 3D world coordinates or if you use an orthographic projection it's size could be pixels (which is rather convenient). So let's say that our slider has a size of 100 pixels, starting from say -50 to 50. What you need to do is create a function that will take as input the position of the slider, take into account the given (-50, 50) and the wanted (-90, 90) range and map the position from one place to the other. I'm sorry but I can't remember the equation to do that. It has something to do with multiplication and division. If someone else knows it, please post as it's an equation I've searched for in the past.
On the other hand you could always try glui, which is a ready made glut based user interface. It's not very flexible but you should take a look at it. Installs the same way as glut.