# OpenGL Coordinate System

This topic is 5388 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Do you know how many units the screen is in total? For example, in lesson2, they have: glTranslatef(-1.5f,0.0f,-6.0f); to move to the left of the screen to draw the triangle.. how far left can you move? how far right? etc. we can't translate it 10000000 units left can we? I've searched for this question on google but couldn't find it

##### Share on other sites
Yes you can. How far you can see left or right is dependent on the viewpoint which is set useing gluPerspective(45,640/640,1,100);

##### Share on other sites

Quote:
 Original post by justifiedhow far left can you move? how far right? etc. we can't translate it 10000000 units left can we?

The only limit is how far you can move something is the limit of a floating point number. I have no idea what it is but it'd be in the billions, basically so large that you can think of it as infinite!

The command bjwbell listed will setup the openGL camera, and you can use gluLookAt() (i think its that) to position it pretty easily. Go look up the camera tutorials on gametutorials.com (they have a nice progression thats easy to understand) and you'll get the idea!

##### Share on other sites
minimum: (-2^32)-1 units
maximum: (2^32)-1 units

That is the case if you're using glVertex3d (signed doubles) to specify the coordinates.

The min/max is (-2^16)-1/(2^16)-1 if you're using signed integers by glVertex3i.

I currently have forgotting how many bits of a float that is not decimals, but it should be high enough for must users by using glVertex3f.

And also think of that the (2^64)-1 is the maximum length of EACH axis (x, y and z). The 3 together will provide (2^64)*(2^64)*(2^64) - 3 units, so I hope that's enough room for you :D

##### Share on other sites
Quote:
 Original post by nifeminimum: (-2^32)-1 unitsmaximum: (2^32)-1 unitsThat is the case if you're using glVertex3d (signed doubles) to specify the coordinates.

A double in OpenGL is required to have at least 64 bits of precision. The range of a common double precision float is about +-10308, or +-21024 if you want base-2.

Quote:
 Original post by nifeThe min/max is (-2^16)-1/(2^16)-1 if you're using signed integers by glVertex3i.

That would be true for a 17-bit singed integer, however, 32 bits is the smallest required size for a singed integer in OpenGL, so at least [-231, 231-1] is the range for GLint.

Quote:
 Original post by nifeAnd also think of that the (2^64)-1 is the maximum length of EACH axis (x, y and z). The 3 together will provide (2^64)*(2^64)*(2^64) - 3 units, so I hope that's enough room for you :D

There are no maximum lengths for any axes. If anything, they are, in practice, limited by the precision of the datatype used, what precision they give at what magnitudes, and if that precision is enough for your particular application, and so you can't really say that this or that is a limit.

But I agree that a float is generally enough, when used wisely, for most common situations though.

• 21
• 16
• 9
• 17
• 13