home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / openglso.zip / gr.h < prev    next >
C/C++ Source or Header  |  2000-02-16  |  2KB  |  81 lines

  1. /*========================================================================= 
  2.  *                                 CS 488/688                                
  3.  *                          Introduction to Graphics                        
  4.  *                                                                         
  5.  *                           Assignment 1: OpenGL                         
  6.  *                                                                       
  7.  *=========================================================================*/
  8. #ifndef _GR_
  9. #define _GR_
  10.  
  11. /* Also includes Tcl/Tk, GL/gl.h, X11/Xlib stuff */
  12. #define X11
  13. #include "togl.h"
  14.  
  15. /* Gr Types */
  16. typedef struct {
  17.    double    r,g,b;    /* RGB */
  18. } GrColour;
  19.  
  20. typedef struct {
  21.    double    x,y;      /* XY */
  22. } GrPoint2D;
  23.  
  24. typedef struct { 
  25.    double    x,y,z;    /* XYZ */
  26. } GrPoint3D;
  27.  
  28. typedef struct { 
  29.    double    x,y,z;    /* XYZ-vector */
  30. } GrVector3D;
  31.  
  32. typedef double GrMatrix4x4[4][4];     /* [row][column] */
  33.  
  34. typedef enum {
  35.     GR_FALSE = 0,
  36.     GR_NO = 0,
  37.     GR_OFF = 0,
  38.     GR_TRUE = 1,
  39.     GR_YES = 1,
  40.     GR_ON = 1
  41. } GrBoolean;
  42.  
  43. typedef struct _GrPolygon {
  44.     int nr_vertices;
  45.     GrPoint3D *vertices;
  46. } GrPolygon;
  47.  
  48. typedef enum { 
  49.     GR_NONE, 
  50.     GR_LINEAR, 
  51.     GR_QUADRATIC
  52. } GrAttenuation;
  53.  
  54. /* Gr commands 
  55.  *
  56.  * A pointer to a (statically allocated) error message should be
  57.  * returned explaining any errors; a NULL return indicates success.
  58.  *
  59.  * These functions don't have access to OpenGL or Togl functions, 
  60.  * since they are not guaranteed to be called in an OpenGL context.   
  61.  * They should just change some state stored in the Gr module
  62.  * for later interpretation during the display callback.
  63.  */
  64. extern char* gr_mode(char mode);
  65. extern char* gr_buffer(char mode);
  66. extern char* gr_lighting(char* lighting);
  67. extern char* gr_save(char* filename);
  68. extern char* gr_rotate(char axis, double angle);
  69. extern char* gr_scale(double factor);
  70. extern char* gr_reset();
  71.  
  72. /* ToGL callbacks 
  73.  */
  74. extern void gr_initialize(struct Togl* togl);
  75. extern void gr_reshape(struct Togl* togl);
  76. extern void gr_render(struct Togl* togl);
  77.  
  78. #endif /* _GR_ */
  79.  
  80.  
  81.