Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

winpos.c 903B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* winpos.c */
  2. /*
  3. * Set the current raster position to a specific window
  4. * coordinate. Also see the GL_MESA_window_pos extension.
  5. *
  6. * Written by Brian Paul and in the public domain.
  7. */
  8. void WindowPos( GLfloat x, GLfloat y, GLfloat z )
  9. {
  10. GLfloat fx, fy;
  11. /* Push current matrix mode and viewport attributes */
  12. glPushAttrib( GL_TRANSFORM_BIT | GL_VIEWPORT_BIT );
  13. /* Setup projection parameters */
  14. glMatrixMode( GL_PROJECTION );
  15. glPushMatrix();
  16. glLoadIdentity();
  17. glMatrixMode( GL_MODELVIEW );
  18. glPushMatrix();
  19. glLoadIdentity();
  20. glDepthRange( z, z );
  21. glViewport( (int) x - 1, (int) y - 1, 2, 2 );
  22. /* set the raster (window) position */
  23. fx = x - (int) x;
  24. fy = y - (int) y;
  25. glRasterPos3f( fx, fy, 0.0 );
  26. /* restore matrices, viewport and matrix mode */
  27. glPopMatrix();
  28. glMatrixMode( GL_PROJECTION );
  29. glPopMatrix();
  30. glPopAttrib();
  31. }