Im trying to add 2d support(for panels/menu..etc) in my simple 3d app(its more like a demo atm),but im not sure how to change the projection.
In opengl , im doing it like this:
Code: Select all
// Renderer.cpp
inline static void renderMode(const RendererData& r)
{
switch(r.renderer)
{
case RENDERER_OPENGL :
{
glViewport(0, 0, r.getWidth(), r.getHeight());
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if(r.getRenderMode()==RENDER_MODE_2D)
glOrtho( 0, r.getWidth(),r.getHeight(), 0, -1, 1 );
else
gluPerspective(r.getFov(), r.getAspectRatio(), r.getNear(), r.getFar());
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
return;
}
case RENDERER_PSPGU :
{
// -___________________-
return;
}
}
}
}
Thanks.