PDA

View Full Version : How to draw a line using OpenGL programme



Ramesh
11-08-2000, 04:07 AM
Hi,
I am new to OpenGL. Can you tell me a simple program that can draw a line between two points. I am using vc++.
Thanks

jc
11-08-2000, 04:13 AM
Did you try the beginner tutorials of opengl ?
Because in those tutorials, there are many many programs to show you how to create a opengl context (linux or window) and some application (with source code) from very easy ones to more complicated others.
http://www.opengl.org/developers/code/tutorials.html

Ramesh
11-08-2000, 04:18 AM
Thank you very much for your information.

Gavin
11-08-2000, 07:12 AM
after you set up your basic window etc use this to draw the actual line

glLineWidth(2.5);
glColor3f(1.0, 0.0, 0.0);
glBegin(GL_LINES);
glVertex3f(0.0, 0.0, 0.0);
glVertex3f(15, 0, 0);
glEnd();

gav

Ramesh
11-09-2000, 03:06 AM
Thanks Gavin. Above code works.

11-09-2000, 03:27 AM
Have a look at NeHe's marvellous Site with a lot of OpenGl-Tutorials:
nehe.gamedev.net

Ramesh
11-09-2000, 04:05 AM
Thanks. This site is very much useful.