GL_LINES() draws a triangle but no line

Hi. Some days ago a started getting familiar with openGL. My problem so far: I just want to draw a simple line on the Y-axis with this code:

    
glBegin(GL_LINES);
    glVertex3f(0, 10, 0);
    glVertex3f(0, -10, 0);
glEnd
;

but unfortunately when rendering, i got no line, but instead a triangle on its position (the big sphere in the middle is placed on 0,0,0 / center):

the main() and rendering() code so far:

void renderScene(void) {

    if (deltaMove) {
        computePos(deltaMove);
    }
    // Clear Color and Depth Buffers
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

    // Reset transformations
    glLoadIdentity();

    // Set the camera
    gluLookAt(x, y, z,
            x + lx, y + ly, z + lz,
            0.0f, 1.0f, 0.0f);

    // Draw a Line
    glBegin(GL_LINES);
    glVertex3f(0, 10, 0);
    glVertex3f(0, -10, 0);
    glEnd;
    //    glPopMatrix();

    // Draw "Stars"
    for (int i = 0; i < lstVectors.size(); i++) {
        glPushMatrix();
        glTranslatef(lstVectors.at(i)->GetX(), lstVectors.at(i)->GetY(), lstVectors.at(i)->GetZ());
        drawSphere();
        glPopMatrix();
    }
    glutSwapBuffers();
}

int main(int argc, char **argv) {

    //    initVektors();
    LoadStars();

    // init GLUT and create window
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
    glutInitWindowPosition(100, 100);
    glutInitWindowSize(640, 480);
    glutCreateWindow("Star GL");

    // register callbacks
    glutDisplayFunc(renderScene);
    glutReshapeFunc(changeSize);
    glutIdleFunc(renderScene);
    glutIgnoreKeyRepeat(1);
    glutKeyboardFunc(keyboard);
    glutSpecialFunc(pressKey);
    glutSpecialUpFunc(releaseKey);

    // here are the two new functions
    glutMouseFunc(mouseButton);
    glutMotionFunc(mouseMove);

    // OpenGL init
    glEnable(GL_DEPTH_TEST);

    // enter GLUT event processing cycle
    glutMainLoop();

    return 1;
}

…anyone can tell me how i get real lines? :slight_smile:

[QUOTE=grillstern;1240026]My problem so far: I just want to draw a simple line on the Y-axis with this code:

    
glBegin(GL_LINES);
    glVertex3f(0, 10, 0);
    glVertex3f(0, -10, 0);
glEnd;

[/QUOTE]

Ditch your compiler. It’s garbage. Even an ancient GCC from 5 years ago will catch this error. And even that’s with just the default warnings, not every warning possible enabled.

You want “glEnd()”, not “glEnd”.

Oh… Thx for this!
Didn’t noticed this error in my code! :whistle: