Hi,
I have some trivial code which displays a line-graph against a quad with a background-texture. The line is drawn using glDrawElements() and the background-quad-with-texture like this:
// this is the end of the line-drawer so that you can see
// that it is terminated as it should.
// EC() is a #define which calls function ec() with __FILE__ and __LINE__ as parameters. this then checks if glGetError returns an error code
// double h_width=320, h_height=200;
glDisableClientState(GL_COLOR_ARRAY); EC();
glDisableClientState(GL_VERTEX_ARRAY); EC();
glBindBuffer(GL_ARRAY_BUFFER, 0); EC();
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); EC();
// start of quad with texture
glEnable(GL_TEXTURE_2D); EC();
glBindTexture(GL_TEXTURE_2D, texture); EC();
glBegin(GL_QUADS); EC();
glTexCoord2f(0.0, 0.0); EC();
glVertex3f(-h_width, h_height, 0.0); EC();
glTexCoord2f(1.0, 0.0); EC();
glVertex3f(h_width, h_height, 0.0); EC();
glTexCoord2f(1.0, 1.0); EC();
glVertex3f(h_width, -h_height, 0.0); EC();
glTexCoord2f(0.0, 1.0); EC();
// ***** THE FOLLOWING glVertex3f CALL FAILS
// ***** WITH ERROR 0x502:
// ***** GL_INVALID_OPERATION
glVertex3f(-h_width, -h_height, 0.0); EC();
glEnd(); EC();
glDisable(GL_TEXTURE_2D); EC();
Anyone an idea what might be going wrong here?
The strange part is that occasionally works.