Hello!

Looking at the OpenGL specification, and then looking at Mesa sources. One
thing is not clear. When using non-compiled vertex arrays the OpenGL 1.1
specification warns you no to change the elements of memory previously
specified glVertexPointer between the glBegin/glEnd  pair! But it doesn't
warn you doing it between them.

What the output of the following program should be? In my interpretation of
OGL 1.1 specs it should be a Green rect inside of a black. Or is the output
of the program is undefined?

(Mesa draws to Green).

So I think in glEnd we should check whatever there are array elements used
between the pair and in that case we should translate/or flush them from
glEnd.

Btw. I don't see any reason behind such programs. It could call
glColorPointer again after changing the datas.

#include <GL/glut.h>

/*
** OpenGL Drawing
*/
static void bugg(void)
{
 int i;
 /* BlackColor*/
 float colors[] = {0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0};


 /* Clear color buffer to yellow */
 glClearColor(1.0f, 1.0f, 0.0f, 1.0f);
 glClear(GL_COLOR_BUFFER_BIT);
 glEnable(GL_SMOOTH);
 
 glColorPointer(4,GL_FLOAT,0,colors);
 glEnableClientState(GL_COLOR_ARRAY);
 glBegin(GL_POLYGON);
  glArrayElement(1);
  glVertex3d( 0.8,  0.8, 0.0);
  glArrayElement(1);
  glVertex3d( 0.8, -0.8, 0.0);
  glArrayElement(1);
  glVertex3d(-0.8, -0.8, 0.0);
  glArrayElement(1);
  glVertex3d(-0.8,  0.8, 0.0);
 glEnd();
 /* change to green */
 colors[0] = 1.0;
 colors[5] = 1.0;
 glBegin(GL_POLYGON);
  glArrayElement(1);
  glVertex3d( 0.6,  0.6, 0.0);
  glArrayElement(1);
  glVertex3d( 0.6, -0.6, 0.0);
  glArrayElement(1);
  glVertex3d(-0.6, -0.6, 0.0);
  glArrayElement(1);
  glVertex3d(-0.6,  0.6, 0.0);  
 glEnd();
 
 /* Ensure completion */
 glFinish();
}

/*
** Macintosh main routine
*/
int main(int argc,char **argv)
{
 glutInit(&argc,argv);
 
 glutCreateWindow("Hello!");
 
 glutDisplayFunc(bugg);
 
 
 
 glutMainLoop();
 
 return 0;
}



_______________________________________________
Mesa-dev maillist  -  [EMAIL PROTECTED]
http://lists.mesa3d.org/mailman/listinfo/mesa-dev

Reply via email to