Jump to content

  • Log In with Google      Sign In   
  • Create Account


SFML - Window Not Opening


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 Jode   Members   -  Reputation: 105

Like
0Likes
Like

Posted 16 April 2012 - 01:17 PM

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.
Hobbyist game developer, game designer, and gamer.

Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS