Hi all, I am stumped by the following problem. I created a class that will represent my game's menu screen. There's really nothing in this class other than it inherits public sf::Drawable and I'm overriding the draw function as follows:
void ScreenMenu::draw(sf::RenderTarget& target, sf::RenderStates states) const {
target.clear(sf::Color::Black);
glBegin(GL_QUADS);
glVertex3f( 0.0f, 0.0f, 0.f);
glVertex3f( 5.0f, 0.0f, 0.f);
glVertex3f( 5.0f, 5.0f, 0.f);
glVertex3f( 0.0f, 5.0f, 0.f);
glEnd();
}
This gets called here from my main class:
while (mWindow.isOpen()){
// check all the window's events that were triggered since the last iteration of the loop
sf::Event event;
while (mWindow.pollEvent(event)){
// "close requested" event: we close the window
if (event.type == sf::Event::Closed)
mWindow.close();
}
mWindow.draw(screenMenu);
}
There must be something stupid I'm not initializing correctly...the screen comes up all white and its laggy as hell. I can close the window (after some serious lag) or if I don't my graphics card driver crashes and restarts. Is there something I'm forgetting to do here?