l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2005 Jan 30 09:51

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] opengl: lines and points
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] opengl: lines and points

On Sat 29 Jan 05, 10:38 PM, Ken Bloom <kabloom@ucdavis.edu> said:
> On Sun, 30 Jan 2005 00:49:56 -0500
> p@dirac.org (Peter Jay Salzman) wrote:
[original code snipped - reposted below]

> I'm not sure why it shows up for you when you deleted one of the lines,
> but when I ran your code as written, the lines were outside the
> (-1.0,-1.0) to (1.0,1.0) clipping box, so they weren't getting drawn.
> Changing the coordinates helped, and they were both drawn.

Wait -- what clipping box?  I request an 800x600 window.  The camera should
be positioned at the origin, facing down the -z axis, and have coordinates
800 by 600.

In fact, this function displays a big "X" on the screen, which extends
nearly, but not quite, the length of the window's diagonals.  It works as

   void xDisplay(void)
      glClear (GL_COLOR_BUFFER_BIT);
      glColor3f( 1.0, 1.0, 1.0 );

      glBegin( GL_LINES );
         glVertex2f( 10.0f, 10.0f );    // lower left
         glVertex2f( 790.0f, 590.0f );  // upper right
         glVertex2f( 10.0f, 590.0f );   // upper left
         glVertex2f( 790.0f, 10.0f );   // lower right


This function displays nothing but blankness for me:

   void tDisplay(void)
      glClear (GL_COLOR_BUFFER_BIT);
      glColor3f( 1.0, 1.0, 1.0 );

      glBegin( GL_LINES );
         glVertex2f( 10.0f, 300.0f );   // hoizontal line
         glVertex2f( 790.0f, 300.0f );  // hoizontal line
         glVertex2f( 400.0f, 10.0f );   // vertical line
         glVertex2f( 400.0f, 590.0f );  // vertical line


And this is the rest of the program:

   void reshape (int w, int h)
      glViewport (0, 0, (GLsizei) w, (GLsizei) h);
      glMatrixMode (GL_PROJECTION);
      glLoadIdentity ();
      gluOrtho2D (0.0, (GLdouble) w, 0.0, (GLdouble) h);

   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(tDisplay);  // xDisplay works.  tDisplay doesn't.


      return 0;

Do you not get the same results as I am?


The mathematics of physics has become ever more abstract, rather than more
complicated.  The mind of God appears to be abstract but not complicated.
He also appears to like group theory.  --  Tony Zee's "Fearful Symmetry"

GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E  70A9 A3B9 1945 67EA 951D
vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Appahost Applications
For a significant contribution towards our projector, and a generous donation to allow us to continue meeting at the Davis Library.