Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Eelco

Pages: [1]
1
Graphics / Re: Order of push/popGLstate in Rendertarget
« on: March 06, 2015, 05:01:45 pm »
Ok, tnx binary1248 for your speedy reply :),
this helps getting things clear.
And I'm indeed already using modern opengl, opens a universe of opportunities for a graphics programmer ::)

2
Graphics / Order of push/popGLstate in Rendertarget
« on: March 05, 2015, 07:43:21 pm »
Hi there,
In my persuit of solving problems combining sfml2d and own opengl 3d I started working through the sources of sfml.
I checked the Graphics Rendertarget and stumbled over the folowing that I do not understand: The order of push/pop in pushGLStates and PopGLStates. I pasted the code below.

I would expect the order of the pop to be the reverse of the push, but that is not happening. Could anybody explain why this is not so? (I'm probable overlooking something here  :o )

push: ( clientattrib, attrib,) modelview, projection, texture
pop: projection, modelview, texture,  ( clientattrib, attrib,)

I would expect: pop: texture, projection, modelview,  ( attrib, clientattrib)

Thanks in advance :)

////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
void RenderTarget::pushGLStates()
{
    if (activate(true))
    {
        #ifdef SFML_DEBUG
            // make sure that the user didn't leave an unchecked OpenGL error
            GLenum error = glGetError();
            if (error != GL_NO_ERROR)
            {
                err() << "OpenGL error (" << error << ") detected in user code, "
                      << "you should check for errors with glGetError()"
                      << std::endl;
            }
        #endif

        #ifndef SFML_OPENGL_ES
            glCheck(glPushClientAttrib(GL_CLIENT_ALL_ATTRIB_BITS));
            glCheck(glPushAttrib(GL_ALL_ATTRIB_BITS));
        #endif
        glCheck(glMatrixMode(GL_MODELVIEW));
        glCheck(glPushMatrix());
        glCheck(glMatrixMode(GL_PROJECTION));
        glCheck(glPushMatrix());
        glCheck(glMatrixMode(GL_TEXTURE));
        glCheck(glPushMatrix());
    }

    resetGLStates();
}


////////////////////////////////////////////////////////////
void RenderTarget::popGLStates()
{
    if (activate(true))
    {
        glCheck(glMatrixMode(GL_PROJECTION));
        glCheck(glPopMatrix());
        glCheck(glMatrixMode(GL_MODELVIEW));
        glCheck(glPopMatrix());
        glCheck(glMatrixMode(GL_TEXTURE));
        glCheck(glPopMatrix());
        #ifndef SFML_OPENGL_ES
            glCheck(glPopClientAttrib());
            glCheck(glPopAttrib());
        #endif
    }
}

Pages: [1]