ralphjason's picture

Draw line in 3d

Hello I have the following code to create a line in 3d.

            GL.glClear(GL.GL_DEPTH_BUFFER_BIT | GL.GL_COLOR_BUFFER_BIT);
 
            GL.glMatrixMode(GL.GL_MODELVIEW);
            GL.glLoadIdentity();
 
            GL.glBegin(GL.GL_LINES);
            GL.glColor(Color.Brown);
            GL.glVertex3f(0,0,0);
            GL.glVertex3f(100,0,0);
            GL.glEnd();
 
            GL.glBegin(GL.GL_LINES);
            GL.glColor(Color.Brown);
            GL.glVertex3f(0, 0, 0);
            GL.glVertex3f(0, 100, 0);
            GL.glEnd();
 
            GL.glBegin(GL.GL_LINES);
            GL.glColor(Color.Yellow);
            GL.glVertex3f(0, 0, 0);
            GL.glVertex3f(0, 0, 10);
            GL.glEnd();
 
            SwapBuffers();

But when i run the program I only see the lines for the 1st 2... for the x and y axis whose value is 100.

What is missing?

Thanks


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

You need to set up a projection matrix.