what float number is equal to 1 pixel. I'm working in OpenGL, 800 x 600 window, and I want to make a box a certain amount of pixels long and wide. Help would be appreciated:)
Printable View
what float number is equal to 1 pixel. I'm working in OpenGL, 800 x 600 window, and I want to make a box a certain amount of pixels long and wide. Help would be appreciated:)
1.0f?
Converting a float to a pixel is not possible. But since pixels are normally represented as integers and offsets as unsigned longs then you must convert from float to one of these.
But OpenGL will do that for you. If you want a box that is 50 units wide by 50 units tall you can do two things.
Either create a unit box or a box that has length and height of 1.0f and then scale it to 50.0f via a matrix scaling operation, or you can specify a box with a length and height of 50.0f.
what matrix scaling operation and when I specify the box with a length of 50.0f, it goes of the screen.
This is my first thought, look into glProject and glUnProject
have any sites for that?
I told you the wrong functions, this is what it should be gluProject and gluUnProject
If you are looking to make specific pixel size objects in opengl, use an ortho projection.
http://nehe.gamedev.net/data/lessons....asp?lesson=21