• Advertisement
Sign in to follow this  

SFML - Window Not Opening

This topic is 2106 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So, I open pasted the OpenGL 1.1 test code from the website just to test that my SFML setup is working. Obviously, it is not, otherwise I wouldn't be here. My problem is, as the title states: the Window simply refuses to open. No errors. No nothing. Code:


#include <SFML/Window.hpp>
void initGL() {
glClearDepth(1.f);
glClearColor(0.f, 0.f, 0.f, 0.f);
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90.f, 1.f, 1.f, 500.f);
}
int main() {
//!!Problem area begins here!!
// Create the main window
sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");

initGL();

sf::Clock Clock;

// Start game loop
while (App.IsOpened()) {
// Process events
sf::Event Event;
while (App.GetEvent(Event)) {
switch (Event.Type) {
case sf::Event::Closed:
App.Close();
break;
default:
break;
}
}
App.SetActive();
//!!Problem Area Ends Here!!
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.f, 0.f, -200.f);
glRotatef(Clock.GetElapsedTime() * 50, 1.f, 0.f, 0.f);
glRotatef(Clock.GetElapsedTime() * 30, 0.f, 1.f, 0.f);
glRotatef(Clock.GetElapsedTime() * 90, 0.f, 0.f, 1.f);

glBegin(GL_QUADS);
glVertex3f(-50.f, -50.f, -50.f);
glVertex3f(-50.f, 50.f, -50.f);
glVertex3f( 50.f, 50.f, -50.f);
glVertex3f( 50.f, -50.f, -50.f);
glVertex3f(-50.f, -50.f, 50.f);
glVertex3f(-50.f, 50.f, 50.f);
glVertex3f( 50.f, 50.f, 50.f);
glVertex3f( 50.f, -50.f, 50.f);
glVertex3f(-50.f, -50.f, -50.f);
glVertex3f(-50.f, 50.f, -50.f);
glVertex3f(-50.f, 50.f, 50.f);
glVertex3f(-50.f, -50.f, 50.f);
glVertex3f(50.f, -50.f, -50.f);
glVertex3f(50.f, 50.f, -50.f);
glVertex3f(50.f, 50.f, 50.f);
glVertex3f(50.f, -50.f, 50.f);
glVertex3f(-50.f, -50.f, 50.f);
glVertex3f(-50.f, -50.f, -50.f);
glVertex3f( 50.f, -50.f, -50.f);
glVertex3f( 50.f, -50.f, 50.f);
glVertex3f(-50.f, 50.f, 50.f);
glVertex3f(-50.f, 50.f, -50.f);
glVertex3f( 50.f, 50.f, -50.f);
glVertex3f( 50.f, 50.f, 50.f);
glEnd();
App.Display();
}

return 0;
}


Did I do my project setup wrong? I'm using NetBeans, and I can post some pics of the setup if you'd like.

EDIT: Oh god, I'm a moron. I see the problem. I just wasted days of my life trying to fix this. The App.Display() isn't in the game loop. -.-

EDIT #2: Nevermind not the problem. :/ Edited the code, still broken.

EDIT #3: Turns out SFML 1.6 doesn't support ATI graphics card. Upgrading to SFML 2.0 fixes it. Fixed. Lock this now.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement