4
« on: February 28, 2011, 05:47:31 pm »
I am using both SFML (window, system, and graphics) and OpenGl. SFML for the windowing/menu and opengl for rendering the scene. I can't really provide a small working example because the whole project is pretty split up.
Currently all I use opengl for is displaying a bunch of cubes:
void drawScene(){
glBegin(GL_QUADS);
{
glVertex3f(...);
...
}
}
I use shapes/sprites to draw the menu (this is just the background, but other parts are made similarly):
void createMenu(){
sf::Shape fileMenuBackground;
...
}
Before and after I draw the menu (after I draw the scene of openGL cubes) I call these two functions:
void preSFML(){
glMatrixMode(GL_MODELVIEW); glPushMatrix();
glMatrixMode(GL_PROJECTION); glPushMatrix();
glPushAttrib(GL_COLOR_BUFFER_BIT | GL_CURRENT_BIT | GL_ENABLE_BIT |
GL_TEXTURE_BIT | GL_TRANSFORM_BIT | GL_VIEWPORT_BIT);
glDisable(GL_ALPHA_TEST);
glDisable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING);
}
void Gui::postSFML(){
glMatrixMode(GL_PROJECTION); glPopMatrix();
glMatrixMode(GL_MODELVIEW); glPopMatrix();
glPopAttrib();
}
So it looks something like this:
drawScene();
preSFML();
App->Draw(fileMenuBackground);
...
postSFML();
All of this runs just fine in linux. The menu is properly drawn to the 2D screen coordinates and the cubes drawn to the 3D scene coordinates. When I run this program on a mac, both the menu and the cubes are drawn to the 3D scene coordinates. Hopefully this illustrates my problem a little bit better. I am probably just be doing something wrong or have a misconception on how openGL works.
What I was asking in my first post is if there is a known issue of why the menu is being drawn to the 3D coordinates. Is there something I'm doing in the preSFML and postSFML functions that does not work properly on a mac? Possibly anything else? I appreciate the help.