Washiro
05-22-2012, 03:20 PM
I'm having some problems with the glViewport, because the point xy 0.0 window is wrong.
if I try to draw a line in the coordinates 1.1 and 32.32, the line does not appear in the window, it seems that the drawing area begins at the edge of the window.
I do not know if I was clear.
but I will post the picture of the problem here
im using this code, to create the viewport
glViewport(0,0,640,480);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0f,640,480,0.0f,0.0f,1.0f);
and this code to draw the triangle
glBegin(GL_TRIANGLES);
glVertex2f(mouse_x,mouse_y);
glVertex2f(1.0f,1.0f);
glVertex2f(320.0f,470.0f);
glEnd();
and this is the result
http://dl.dropbox.com/u/61491349/imeji%20o/OPENGL.png
see? the point glVertex2f(1.0f,1.0f); its much behind the window
I wanted to happen was this.
http://dl.dropbox.com/u/61491349/imeji%20o/DirectX.png
could understand?
if I try to draw a line in the coordinates 1.1 and 32.32, the line does not appear in the window, it seems that the drawing area begins at the edge of the window.
I do not know if I was clear.
but I will post the picture of the problem here
im using this code, to create the viewport
glViewport(0,0,640,480);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0f,640,480,0.0f,0.0f,1.0f);
and this code to draw the triangle
glBegin(GL_TRIANGLES);
glVertex2f(mouse_x,mouse_y);
glVertex2f(1.0f,1.0f);
glVertex2f(320.0f,470.0f);
glEnd();
and this is the result
http://dl.dropbox.com/u/61491349/imeji%20o/OPENGL.png
see? the point glVertex2f(1.0f,1.0f); its much behind the window
I wanted to happen was this.
http://dl.dropbox.com/u/61491349/imeji%20o/DirectX.png
could understand?