glVertex3f throws GL_INVALID_OPERATION error?

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.

It is an invalid operation to call glGetError() between glBegin() and glEnd(). So I guess the error comes from the call to EC() itself rather than the call to glVertex.

Hmmm ok. Then I still wonder why it is not showing any texture at all.
Well, occasionally.
Occasionally for this one graphic.

Other “objects” always have their texture applied.

never mind, fixed it: some other bug was biting me.

It would help others if you posted the solution to your problem.

Well, the problem was not opengl-related: I gave the aspect_ratio instead of the expected height to the draw-routine. So that would give a very tiny image.