PDA

View Full Version : 2D draw logic



nk
05-15-2004, 01:27 AM
I have a window and I want to draw a line for each side of the window in OGL.
I do this by setting the projection and modelview matrix to the identity matrix
(glMatrixMode(GL_PROJECTION);glLoadIdentity();..)
then I call
glVertex3d(-1,-1,0);
glVertex3d(-1, 1,0);
for left side of the window for example.
The code works fine, the line appears on the left side of the window(line width is 3).
My problem is: on what principle OGL convert this 3D vertices in 2D points on my window. How came that the vertices are not clipped(any value greater the 1 for the coords of the line is clipped).
I know that by setting to the identity matrix, the vertices remain the same, but what happens next -> 3D to 2D, clipping?
Thanks.

ZbuffeR
05-15-2004, 02:05 AM
For the anwser about not clipped vertices at the edge, search for guard band clipping here :
http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_to pic;f=3;t=011928 (http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=011928)

Simple diagram of the OpenGL pipeline :
http://www.cgl.uwaterloo.ca/~vtluu/Talks/OpenGL/pipeline.html

More detailed diagrams (sorry the text is in german) :
http://www-lehre.informatik.uni-osnabrue...%20Pipeline.htm (http://www-lehre.informatik.uni-osnabrueck.de/cg2/material/20030122/Application%20Programming%20Interfaces/OpenGL%20-%20Pipeline.htm)

And of course, read the OpenGL spec at :
http://www.opengl.org/documentation/specs/version1.5/glspec15.pdf