0

Hi there,

I feel really stupid since I'm a beginner at OpenGL with drawing. Is there something that I'm missing in the code? The line doesn't show up on the screen. Thanks!

    glClearColor(1.0f, 1.0f, 1.0f, 1.0f); 
    glBegin( GL_LINES );  
    glColor3f( 1.0f, 0.0f, 0.0f );  
    glVertex3f( 100.0f, 150.0f, 0.0f );  
    glVertex3f( 250.0f, 200.0f, 10.0f );
    glEnd();

Edited by dark_sider_1: missed a line

3
Contributors
2
Replies
4
Views
5 Years
Discussion Span
Last Post by mike_2000_17
0

Where is your gluPerspective() call? Since I don't see where you are positioning the "camera" or "viewer" you might not have the correct far value.

0

I would try with negative Z values. Without rotations applied, the Z-axis points towards you (from the screen and out), with the zero being at the screen. This means that anything you draw in the positive-Z area is not going to appear on the screen (it is "behind" the camera). So, first thing, try making the Z coordinates in the negative.

Also, as sfuo said, very often when you try to draw stuff and nothing appears, it is usually because you set the perspective or model-view transformations wrong. Make sure that part is correct.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.