how do i draw a line? say from a(2,3) to b(5,6)
This belongs in the advanced forum.
alright, j/k.
setup an ortho view.
glBegin(GL_LINES);
glVertex2i(2,3);
glVertex2i(5,6);
glEnd();
thanks, i put in the beginners section because there wasnt a super highly advanced section hehe
im using the following code:
int DrawGLScene(GLvoid)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(0.0f,0.0f,-10.0f);
glOrtho(0,640,0,480,-1,1);
glColor3f(0.0f,1.0f,0.0f);
glBegin(GL_LINES);
glVertex2i(2,3);
glVertex2i(5,6);
glEnd();
return TRUE;
}
and it doesnt display anything, where could the mistake be?
try it like this
int DrawGLScene(GLvoid) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0,640,0,480,-1,1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glColor3f(0.0f,1.0f,0.0f);
glBegin(GL_LINES);
glVertex2i(20,30);
glVertex2i(500,600);
glEnd();
return TRUE;
}