Hello guys,
I just started learning opengl from past few days, so i dunno much about it. So probably some one out there would help me out in this simple problem which i am facing on co-ordinated, i mean setting the co-ordinates of the screen. Have a look at code below
Code:
#include<GL/gl.h>
#include<GL/glu.h>
#include<GL/glut.h>
#include<windows.h>
void Init(void);
void Display(void);
int main(int argc, char **argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(500,500);
glutInitWindowPosition(100,100);
glutCreateWindow("Polygon");
Init();
glutDisplayFunc(Display);
glutMainLoop();
return 0;
}
void Init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
gluOrtho2D (0.0, 0.0, 0.0, 0.0);
}
void Display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0, 1.0);
glBegin(GL_POLYGON);
glVertex2f(0.0, 0.0);
glVertex2f(0.0, 1.0);
glVertex2f(1.0, 2.0);
glVertex2f(6.0, 1.0);
glVertex2f(2.0, 0.0);
glEnd();
glFlush();
}
i wanted the co-ordinated 0.0 start from the top left of the screen. But by default it starts from the center of the screen which mean what ever i draw its all in the center but i wanted to be on top left of the screen. How do i do that, can any one please guide me in this.
thank you
ssharish2005