# GL_INVALID_OPERATION in glEnd

I'm having problems drawing a simple sprite. When I draw:

void CSprite2D::render()
{
CHECKGL(glEnable(GL_TEXTURE_2D));
CHECKGL(glEnable(GL_BLEND));

CHECKGL(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));

m_texture->bind();

//CHECKGL(glPushMatrix());

CHECKGL(glBegin(GL_TRIANGLE_STRIP));
CHECKGL(glNormal3i(0,0,1));
CHECKGL(glTexCoord2f(m_textureAreaStart.s,m_textureAreaStart.t)); // 0,0 by default
CHECKGL(glVertex3i(m_position.x,m_position.y,0));

CHECKGL(glNormal3i(0,0,1));
CHECKGL(glTexCoord2f(m_textureAreaEnd.s,m_textureAreaStart.t)); // 1,0 by default
CHECKGL(glVertex3i( m_position.x + m_dimensions.x, m_position.y, 0));

CHECKGL(glNormal3i(0,0,1));
CHECKGL(glTexCoord2f(m_textureAreaEnd.s, m_textureAreaEnd.t)); // 1,1 by default
CHECKGL(glVertex3i( m_position.x + m_dimensions.x, m_position.y + m_dimensions.y, 0));

CHECKGL(glNormal3i(0,0,1));
CHECKGL(glTexCoord2f(m_textureAreaStart.s, m_textureAreaEnd.t));  // 0,1 by default
CHECKGL(glVertex3i( m_position.x, m_position.y + m_dimensions.y,0));
CHECKGL(glEnd());

//CHECKGL(glPopMatrix());

CHECKGL(glDisable(GL_BLEND));
}


I'm always get an GL_INVALID_OPERATION in glEnd(). I suspect that error is not here, but I can't detect where may be. Actually, the output render seems ok. But I want to solve this situation before to catch a subtle bug tomorrow.

Any idea of what could be

• What is CHECKGL #defined as? – user744 Jan 14 '11 at 23:02
• It is a macro in the assert style. If debug, make a glGetError and type error into a log – Killrazor Jan 16 '11 at 0:05