Beispiel #1
0
static void DrawMesh( int rows, int cols )
{
   static const GLfloat colorA[3] = { 0, 1, 0 };
   static const GLfloat colorB[3] = { 0, 0, 1 };
   const float dx = 2.0 / (cols - 1);
   const float dy = 2.0 / (rows - 1);
   float x, y;
   int i, j;

#if 1
#define COLOR3FV(c)     glVertexAttrib3fvARB(3, c)
#define VERTEX2F(x, y)  glVertexAttrib2fARB(0, x, y)
#else
#define COLOR3FV(c)     glColor3fv(c)
#define VERTEX2F(x, y)  glVertex2f(x, y)
#endif

   y = -1.0;
   for (i = 0; i < rows - 1; i++) {
      glBegin(GL_QUAD_STRIP);
      x = -1.0;
      for (j = 0; j < cols; j++) {
         if ((i + j) & 1)
            COLOR3FV(colorA);
         else
            COLOR3FV(colorB);
         VERTEX2F(x, y);
         VERTEX2F(x, y + dy);
         x += dx;
      }
      glEnd();
      y += dy;
   }
}
Beispiel #2
0
static void
_tnl_Vertex2fv( const GLfloat *v )
{
   GET_IMMEDIATE;
   VERTEX2F( IM, v[0], v[1] );
}
Beispiel #3
0
static void
_tnl_Vertex2f( GLfloat x, GLfloat y )
{
   GET_IMMEDIATE;
   VERTEX2F( IM, x, y );
}