View Full Version : very very newbie
zukko
06-11-2004, 10:03 AM
how do i draw a line? say from a(2,3) to b(5,6)
Aeluned
06-11-2004, 11:42 AM
This belongs in the advanced forum.
:) alright, j/k.
setup an ortho view.
glBegin(GL_LINES);
glVertex2i(2,3);
glVertex2i(5,6);
glEnd();
zukko
06-11-2004, 01:21 PM
thanks, i put in the beginners section because there wasnt a super highly advanced section hehe :D
zukko
06-11-2004, 01:35 PM
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? :confused:
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;
}
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.