PDA

View Full Version : opengl co-ordinate system and axis range



dinesh17
06-19-2012, 08:24 PM
I'm just a beginner . I saw a code in a text book to draw a rectangle using opengl. I altered the vertices but the ouput window was empty and realized i was'nt aware of the third axis Z. And i want to know what is the axis range like x axis ranges from -1 to +1 like that.

thokra
06-20-2012, 01:47 AM
The range of values you can express on either axis is merely restricted by the data type representing those values. If your coordinates were represented by a signed byte(or char or whatever 8-bit type), values on your axes could be integers in the range of [-128, -127, .. , +126, +127]. With a signed integer you'd have [-2^31, -2^31 + 1, .. , 2^31 - 2, 2^31 - 1].

What is shown on the screen, after vertices have gone through the pipeline, is determined by the model-, view- and projection-matrices used in the pipeline. So, if any vertex that has been transform by the model- and view-matrix into eye-space and is then projected to normalized device coordinates and lies outside the range [-1, 1] on either the x-, y- or z-axis, the fragment will not show on the screen.