From ebd1b636e5bf0f8fa6d210690582757e8b47f141 Mon Sep 17 00:00:00 2001 From: James Cowgill Date: Fri, 8 May 2015 21:14:39 +0100 Subject: Imported Upstream version 2.3+dfsg --- examples/opengl/CMakeLists.txt | 2 +- examples/opengl/OpenGL.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'examples/opengl') diff --git a/examples/opengl/CMakeLists.txt b/examples/opengl/CMakeLists.txt index 5e1571f..3bac2b9 100644 --- a/examples/opengl/CMakeLists.txt +++ b/examples/opengl/CMakeLists.txt @@ -4,7 +4,7 @@ set(SRCROOT ${PROJECT_SOURCE_DIR}/examples/opengl) # all source files set(SRC ${SRCROOT}/OpenGL.cpp) -# find OpenGL and GLU +# find OpenGL find_package(OpenGL REQUIRED) include_directories(${OPENGL_INCLUDE_DIR}) set(ADDITIONAL_LIBRARIES ${OPENGL_LIBRARIES}) diff --git a/examples/opengl/OpenGL.cpp b/examples/opengl/OpenGL.cpp index c900801..c2d1697 100644 --- a/examples/opengl/OpenGL.cpp +++ b/examples/opengl/OpenGL.cpp @@ -14,9 +14,9 @@ //////////////////////////////////////////////////////////// int main() { - // Request a 32-bits depth buffer when creating the window + // Request a 24-bits depth buffer when creating the window sf::ContextSettings contextSettings; - contextSettings.depthBits = 32; + contextSettings.depthBits = 24; // Create the main window sf::RenderWindow window(sf::VideoMode(800, 600), "SFML graphics with OpenGL", sf::Style::Default, contextSettings); @@ -53,9 +53,9 @@ int main() return EXIT_FAILURE; glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); - gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, image.getSize().x, image.getSize().y, GL_RGBA, GL_UNSIGNED_BYTE, image.getPixelsPtr()); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.getSize().x, image.getSize().y, 0, GL_RGBA, GL_UNSIGNED_BYTE, image.getPixelsPtr()); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); } // Enable Z-buffer read and write @@ -80,7 +80,7 @@ int main() glBindTexture(GL_TEXTURE_2D, texture); // Define a 3D cube (6 faces made of 2 triangles composed by 3 vertices) - GLfloat cube[] = + static const GLfloat cube[] = { // positions // texture coordinates -20, -20, -20, 0, 0, -- cgit v1.2.3