GL_INVALID_OPERATION in glEnd

Posted by Killrazor on Game Development See other posts from Game Development or by Killrazor
Published on 2011-01-14T22:51:46Z Indexed on 2011/01/14 22:58 UTC
Read the original article Hit count: 188

Filed under:
|
|

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

void CSprite2D::render()
    {
        CHECKGL(glLoadIdentity());
        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

© Game Development or respective owner

Related posts about c++

Related posts about opengl