• Starting with SFML, having trouble with OpenGL
    6 replies, posted
  • [url]http://www.sfml-dev.org/tutorials/1.5/window-opengl.php[/url] Up to that part in the tutorial. [code]#include "stdafx.h" #include <SFML/Window.hpp> #include <iostream> int _tmain(int argc, _TCHAR* argv[]) { sf::Window App(sf::VideoMode(800, 600, 32), "SFML OpenGL"); sf::Clock Clock; /* How to pass settings to the window sf::WindowSettings Settings; Settings.DepthBits = 24; // Request a 24 bits depth buffer Settings.StencilBits = 8; // Request a 8 bits stencil buffer Settings.AntialiasingLevel = 2; //Request 2 levels of AA sf::Window App(sf::VideoMode(800, 600, 32), "SFML OpenGL", sf::Style::Close, Settings); */ // Set color and depth clear value glClearDepth(1.f); glClearColor(0.f, 0.f, 0.f, 0.f); // Enable Z-buffer read and write glEnable(GL_DEPTH_TEST); glDepthMask(GL_TRUE); // Setup a perspective projection glMatrixMode(GL_PROJECTION); glLoadIdentity(); [highlight]gluPerspective(90.f, 1.f, 1.f, 500.f);[/highlight] while (App.IsOpened()) { sf::Event Event; while (App.GetEvent(Event)) { // Window Closed if (Event.Type == sf::Event::Closed) App.Close(); // Escape Key Pressed if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape)) App.Close(); // Window Resized if (Event.Type == sf::Event::Resized) glViewport(0, 0, Event.Size.Width, Event.Size.Height); } // Makes the current window active, // Useless here App.SetActive(); 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 EXIT_SUCCESS; }[/code] Error: [code]1>------ Build started: Project: SFML Test1, Configuration: Release Win32 ------ 1>Compiling... 1>SFML Test1.cpp 1>Linking... 1>SFML Test1.obj : error LNK2001: unresolved external symbol _gluPerspective@32 1>E:\__ALLDATA\SrcCon Project\SrcCon2\SFML\Release\SFML Test1.exe : fatal error LNK1120: 1 unresolved externals 1>Build log was saved at "file://e:\__ALLDATA\SrcCon Project\SrcCon2\SFML\SFML Test1\Release\BuildLog.htm" 1>SFML Test1 - 2 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========[/code] Help?
  • -snip- didn't see /* */ -snip- r4nk_ explained to to me on steam. Most useful post everrr