OpenGLRenderTarget and PROJECTION_MATRIX
Posted: Tue Jan 04, 2011 18:18
First, some code from CEGuiOpenGLBaseApplication.cpp which is in samples/common/src
Why this code is needed? The only line that plays role here is the last line there are notifyDisplaySizeChanged() called. Because in OpenGLRenderTarget's code glViewport() and glMatrixMode() is overwritten.
Second, using Rotation property of any window makes window drag moving impossible. I tried to play with it using my own GL_PROJECTION matrix setup, but since its overwritten by CEGUI I had to stop. I don't want to make custom changes to CEGUI, because they will be lost after upgrading/porting to next version And I dunno how to change it, because I'm not matrixes and linear algebra specialist But it would be useful to declare a flag d_isUserDefinedMatrix in RenderTarget, so a user could setup own GL_PROJECTION matrix before renderGUI().
Code: Select all
void CEGuiOpenGLBaseApplication::reshape(int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
gluPerspective(60.0, (GLfloat) w/(GLfloat) h, 1.0, 50.0);
glMatrixMode(GL_MODELVIEW);
CEGUI::System::getSingleton().
notifyDisplaySizeChanged(CEGUI::Size((float)w,(float)h));
}
Why this code is needed? The only line that plays role here is the last line there are notifyDisplaySizeChanged() called. Because in OpenGLRenderTarget's code glViewport() and glMatrixMode() is overwritten.
Second, using Rotation property of any window makes window drag moving impossible. I tried to play with it using my own GL_PROJECTION matrix setup, but since its overwritten by CEGUI I had to stop. I don't want to make custom changes to CEGUI, because they will be lost after upgrading/porting to next version And I dunno how to change it, because I'm not matrixes and linear algebra specialist But it would be useful to declare a flag d_isUserDefinedMatrix in RenderTarget, so a user could setup own GL_PROJECTION matrix before renderGUI().