summaryrefslogtreecommitdiff
path: root/examples/opengl
diff options
context:
space:
mode:
authorJames Cowgill <james410@cowgill.org.uk>2015-05-08 21:14:39 +0100
committerJames Cowgill <james410@cowgill.org.uk>2015-05-08 21:14:39 +0100
commitebd1b636e5bf0f8fa6d210690582757e8b47f141 (patch)
tree02dc3aacf1c6f351154432247be0b4347fb14330 /examples/opengl
parentfa21c65d0c764705cfc377bf0d0de08fac26874e (diff)
Imported Upstream version 2.3+dfsg
Diffstat (limited to 'examples/opengl')
-rw-r--r--examples/opengl/CMakeLists.txt2
-rw-r--r--examples/opengl/OpenGL.cpp10
2 files changed, 6 insertions, 6 deletions
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,