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

- 02-19-2005ay_okayfloat to pixel(OpenGL)
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:)

- 02-20-2005VirtualAce
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. - 02-20-2005ay_okay
what matrix scaling operation and when I specify the box with a length of 50.0f, it goes of the screen.

- 02-20-2005Shakti
This is my first thought, look into glProject and glUnProject

- 02-20-2005ay_okay
have any sites for that?

- 02-20-2005Shakti
google

I told you the wrong functions, this is what it should be gluProject and gluUnProject - 02-20-2005Jeremy G
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