[vox-tech] opengl: lines and points

Peter Jay Salzman p at dirac.org
Sat Jan 29 21:49:56 PST 2005


Hola,

These are some really embarrassing questions, but I've been stumped for a
while on this.

I've already written the requisite spinning cube.  I've even texture mapped
it.  I've written a "flight simulator" that lets you fly around a teapot.

But there are 3 really basic questions I'm at a complete loss at.


1. The only point size that appears to be available is the default pointsize
   of 1, whether I'm dealing with AA or not AA points.  I've verified this
   with glGetFloatv() and GL_POINT_SIZE_RANGE.

   If there are any GL programmers out there, I'm curious what point size
   ranges you have available on your system.


2. Same problems with lines.  It appears that the only available width is
   1.  I can make them thicker by drawing lines next to each other, but
   the only width available on my system, both AA and non-AA, is 1.  Again,
   I'm curious what other people have available to them.


3. Lastly, this code is completely mysterious:


   #include <GL/glut.h>

   void display(void)
   {
      glClear (GL_COLOR_BUFFER_BIT);

      glBegin( GL_LINES );
         glColor3f( 1.0, 0.0, 0.0 );     // *1*
         glVertex2f( 400.0f, 50.0f );    // *1*
         glVertex2f( 400.0f, 550.0f );   // *1*

         glColor3f( 1.0, 1.0, 1.0 );     // *2*
         glVertex2f( 50.0f, 300.0f );    // *2*
         glVertex2f( 750.0f, 300.0f );   // *2*
      glEnd();

      glFlush();
   }

   int main(int argc, char *argv[])
   {
      glutInit(&argc, argv);
      glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
      glutInitWindowSize (800, 600); 
      glutInitWindowPosition (100, 100);
      glutCreateWindow (argv[0]);

      glClearColor (0.0, 0.0, 0.0, 0.0);
      glShadeModel (GL_FLAT);

      glutDisplayFunc(display); 

      glutMainLoop();
      return 0;
   }


This code should draw two perpendicular lines - one red, one blue.  I've
tried using both glut and SDL, and this code doesn't draw ANYTHING.

If I comment out the 2nd line (all source lines with "*2*"), then the first
line is displayed.

If I comment out the 1st line (all source lines with "*1*"), then the second
lines is displayed.

But the lines don't display at the same time.  There must be something very
fundamental about GL_LINES that I must not know.  Why don't these lines
display together?

Thanks!
Peter


More information about the vox-tech mailing list