Permalink
Browse files

Updated to current source and remove conflict in Text.cpp

  • Loading branch information...
2 parents 9b3eb80 + 90f4dbc commit ea1a63a091aa315ca8215e0129f864d8916a3e3d @Foaly committed Aug 3, 2013
Showing with 2,004 additions and 1,396 deletions.
  1. +10 −0 .travis.yml
  2. +1 −1 CMakeLists.txt
  3. +6 −2 cmake/Macros.cmake
  4. +3 −0 examples/cocoa/CMakeLists.txt
  5. BIN examples/cocoa/resources/icon.icns
  6. BIN examples/cocoa/resources/logo.png
  7. +83 −51 examples/opengl/OpenGL.cpp
  8. +85 −57 examples/window/Window.cpp
  9. +1 −1 include/SFML/Audio.hpp
  10. +1 −1 include/SFML/Audio/Export.hpp
  11. +1 −1 include/SFML/Audio/Listener.hpp
  12. +1 −1 include/SFML/Audio/Music.hpp
  13. +1 −1 include/SFML/Audio/Sound.hpp
  14. +1 −1 include/SFML/Audio/SoundBuffer.hpp
  15. +1 −1 include/SFML/Audio/SoundBufferRecorder.hpp
  16. +1 −1 include/SFML/Audio/SoundRecorder.hpp
  17. +1 −1 include/SFML/Audio/SoundSource.hpp
  18. +1 −1 include/SFML/Audio/SoundStream.hpp
  19. +2 −2 include/SFML/Config.hpp
  20. +1 −1 include/SFML/Graphics.hpp
  21. +1 −1 include/SFML/Graphics/BlendMode.hpp
  22. +1 −1 include/SFML/Graphics/CircleShape.hpp
  23. +1 −1 include/SFML/Graphics/Color.hpp
  24. +1 −1 include/SFML/Graphics/ConvexShape.hpp
  25. +1 −1 include/SFML/Graphics/Drawable.hpp
  26. +1 −1 include/SFML/Graphics/Export.hpp
  27. +1 −1 include/SFML/Graphics/Font.hpp
  28. +1 −1 include/SFML/Graphics/Glyph.hpp
  29. +2 −3 include/SFML/Graphics/Image.hpp
  30. +1 −1 include/SFML/Graphics/PrimitiveType.hpp
  31. +1 −1 include/SFML/Graphics/Rect.hpp
  32. +27 −5 include/SFML/Graphics/Rect.inl
  33. +1 −1 include/SFML/Graphics/RectangleShape.hpp
  34. +1 −1 include/SFML/Graphics/RenderStates.hpp
  35. +1 −1 include/SFML/Graphics/RenderTarget.hpp
  36. +24 −1 include/SFML/Graphics/RenderTexture.hpp
  37. +1 −1 include/SFML/Graphics/RenderWindow.hpp
  38. +13 −1 include/SFML/Graphics/Shader.hpp
  39. +1 −1 include/SFML/Graphics/Shape.hpp
  40. +1 −1 include/SFML/Graphics/Sprite.hpp
  41. +3 −4 include/SFML/Graphics/Text.hpp
  42. +1 −1 include/SFML/Graphics/Texture.hpp
  43. +1 −1 include/SFML/Graphics/Transform.hpp
  44. +3 −3 include/SFML/Graphics/Transformable.hpp
  45. +1 −1 include/SFML/Graphics/Vertex.hpp
  46. +1 −1 include/SFML/Graphics/VertexArray.hpp
  47. +1 −1 include/SFML/Graphics/View.hpp
  48. +1 −1 include/SFML/Network.hpp
  49. +1 −1 include/SFML/Network/Export.hpp
  50. +1 −1 include/SFML/Network/Ftp.hpp
  51. +1 −1 include/SFML/Network/Http.hpp
  52. +1 −1 include/SFML/Network/IpAddress.hpp
  53. +1 −1 include/SFML/Network/Packet.hpp
  54. +1 −1 include/SFML/Network/Socket.hpp
  55. +1 −1 include/SFML/Network/SocketHandle.hpp
  56. +1 −1 include/SFML/Network/SocketSelector.hpp
  57. +1 −1 include/SFML/Network/TcpListener.hpp
  58. +1 −1 include/SFML/Network/TcpSocket.hpp
  59. +1 −1 include/SFML/Network/UdpSocket.hpp
  60. +1 −1 include/SFML/OpenGL.hpp
  61. +1 −1 include/SFML/System.hpp
  62. +1 −1 include/SFML/System/Clock.hpp
  63. +1 −1 include/SFML/System/Err.hpp
  64. +1 −1 include/SFML/System/Export.hpp
  65. +5 −2 include/SFML/System/InputStream.hpp
  66. +1 −1 include/SFML/System/Lock.hpp
  67. +1 −1 include/SFML/System/Mutex.hpp
  68. +1 −1 include/SFML/System/NonCopyable.hpp
  69. +1 −1 include/SFML/System/Sleep.hpp
  70. +1 −1 include/SFML/System/String.hpp
  71. +1 −1 include/SFML/System/Thread.hpp
  72. +1 −1 include/SFML/System/ThreadLocal.hpp
  73. +1 −1 include/SFML/System/ThreadLocalPtr.hpp
  74. +1 −1 include/SFML/System/Time.hpp
  75. +1 −1 include/SFML/System/Utf.hpp
  76. +7 −29 include/SFML/System/Utf.inl
  77. +1 −1 include/SFML/System/Vector2.hpp
  78. +1 −1 include/SFML/System/Vector3.hpp
  79. +1 −1 include/SFML/Window.hpp
  80. +1 −1 include/SFML/Window/Context.hpp
  81. +1 −1 include/SFML/Window/ContextSettings.hpp
  82. +1 −1 include/SFML/Window/Event.hpp
  83. +1 −1 include/SFML/Window/Export.hpp
  84. +1 −1 include/SFML/Window/GlResource.hpp
  85. +1 −1 include/SFML/Window/Joystick.hpp
  86. +1 −1 include/SFML/Window/Keyboard.hpp
  87. +1 −1 include/SFML/Window/Mouse.hpp
  88. +1 −1 include/SFML/Window/VideoMode.hpp
  89. +2 −1 include/SFML/Window/Window.hpp
  90. +1 −1 include/SFML/Window/WindowHandle.hpp
  91. +1 −1 include/SFML/Window/WindowStyle.hpp
  92. +1 −1 license.txt
  93. +3 −3 readme.txt
  94. +1 −1 src/SFML/Audio/ALCheck.cpp
  95. +1 −1 src/SFML/Audio/ALCheck.hpp
  96. +15 −8 src/SFML/Audio/AudioDevice.cpp
  97. +1 −1 src/SFML/Audio/AudioDevice.hpp
  98. +1 −1 src/SFML/Audio/Listener.cpp
  99. +1 −1 src/SFML/Audio/Music.cpp
  100. +1 −1 src/SFML/Audio/Sound.cpp
  101. +1 −1 src/SFML/Audio/SoundBuffer.cpp
  102. +1 −1 src/SFML/Audio/SoundBufferRecorder.cpp
  103. +50 −30 src/SFML/Audio/SoundFile.cpp
  104. +9 −5 src/SFML/Audio/SoundFile.hpp
  105. +1 −1 src/SFML/Audio/SoundRecorder.cpp
  106. +1 −1 src/SFML/Audio/SoundSource.cpp
  107. +1 −1 src/SFML/Audio/SoundStream.cpp
  108. +1 −1 src/SFML/Graphics/CircleShape.cpp
  109. +1 −1 src/SFML/Graphics/Color.cpp
  110. +1 −1 src/SFML/Graphics/ConvexShape.cpp
  111. +10 −2 src/SFML/Graphics/Font.cpp
  112. +1 −1 src/SFML/Graphics/GLCheck.cpp
  113. +1 −1 src/SFML/Graphics/GLCheck.hpp
  114. +1 −1 src/SFML/Graphics/Image.cpp
  115. +4 −1 src/SFML/Graphics/ImageLoader.cpp
  116. +1 −1 src/SFML/Graphics/ImageLoader.hpp
  117. +1 −1 src/SFML/Graphics/RectangleShape.cpp
  118. +1 −1 src/SFML/Graphics/RenderStates.cpp
  119. +13 −1 src/SFML/Graphics/RenderTarget.cpp
  120. +15 −1 src/SFML/Graphics/RenderTexture.cpp
  121. +1 −1 src/SFML/Graphics/RenderTextureImpl.cpp
  122. +1 −1 src/SFML/Graphics/RenderTextureImpl.hpp
  123. +1 −1 src/SFML/Graphics/RenderTextureImplDefault.cpp
  124. +1 −1 src/SFML/Graphics/RenderTextureImplDefault.hpp
  125. +1 −1 src/SFML/Graphics/RenderTextureImplFBO.cpp
  126. +1 −1 src/SFML/Graphics/RenderTextureImplFBO.hpp
  127. +1 −1 src/SFML/Graphics/RenderWindow.cpp
  128. +69 −42 src/SFML/Graphics/Shader.cpp
  129. +7 −4 src/SFML/Graphics/Shape.cpp
  130. +1 −1 src/SFML/Graphics/Sprite.cpp
  131. +22 −5 src/SFML/Graphics/Text.cpp
  132. +10 −1 src/SFML/Graphics/Texture.cpp
  133. +1 −1 src/SFML/Graphics/TextureSaver.cpp
  134. +1 −1 src/SFML/Graphics/TextureSaver.hpp
  135. +1 −1 src/SFML/Graphics/Transform.cpp
  136. +1 −1 src/SFML/Graphics/Transformable.cpp
  137. +1 −1 src/SFML/Graphics/Vertex.cpp
  138. +1 −1 src/SFML/Graphics/VertexArray.cpp
  139. +1 −1 src/SFML/Graphics/View.cpp
  140. +1 −1 src/SFML/Main/SFML_Main.cpp
  141. +1 −1 src/SFML/Network/Ftp.cpp
  142. +1 −1 src/SFML/Network/Http.cpp
  143. +15 −4 src/SFML/Network/IpAddress.cpp
  144. +4 −9 src/SFML/Network/Packet.cpp
  145. +9 −1 src/SFML/Network/Socket.cpp
  146. +1 −1 src/SFML/Network/SocketImpl.hpp
  147. +1 −1 src/SFML/Network/SocketSelector.cpp
  148. +1 −1 src/SFML/Network/TcpListener.cpp
  149. +30 −19 src/SFML/Network/TcpSocket.cpp
  150. +1 −1 src/SFML/Network/UdpSocket.cpp
  151. +2 −1 src/SFML/Network/Unix/SocketImpl.cpp
  152. +1 −1 src/SFML/Network/Unix/SocketImpl.hpp
  153. +3 −1 src/SFML/Network/Win32/SocketImpl.cpp
  154. +10 −1 src/SFML/Network/Win32/SocketImpl.hpp
  155. +1 −0 src/SFML/System/CMakeLists.txt
  156. +1 −1 src/SFML/System/Clock.cpp
  157. +1 −1 src/SFML/System/Err.cpp
  158. +1 −1 src/SFML/System/Lock.cpp
  159. +1 −1 src/SFML/System/Mutex.cpp
  160. +1 −1 src/SFML/System/Sleep.cpp
  161. +1 −1 src/SFML/System/String.cpp
  162. +1 −1 src/SFML/System/Thread.cpp
  163. +1 −1 src/SFML/System/ThreadLocal.cpp
  164. +1 −1 src/SFML/System/Time.cpp
  165. +1 −1 src/SFML/System/Unix/ClockImpl.cpp
  166. +1 −1 src/SFML/System/Unix/ClockImpl.hpp
  167. +1 −1 src/SFML/System/Unix/MutexImpl.cpp
  168. +1 −1 src/SFML/System/Unix/MutexImpl.hpp
  169. +1 −1 src/SFML/System/Unix/SleepImpl.cpp
  170. +1 −1 src/SFML/System/Unix/SleepImpl.hpp
  171. +1 −1 src/SFML/System/Unix/ThreadImpl.cpp
  172. +1 −1 src/SFML/System/Unix/ThreadImpl.hpp
  173. +1 −1 src/SFML/System/Unix/ThreadLocalImpl.cpp
  174. +1 −1 src/SFML/System/Unix/ThreadLocalImpl.hpp
  175. +1 −1 src/SFML/System/Win32/ClockImpl.cpp
  176. +1 −1 src/SFML/System/Win32/ClockImpl.hpp
  177. +1 −1 src/SFML/System/Win32/MutexImpl.cpp
  178. +1 −1 src/SFML/System/Win32/MutexImpl.hpp
  179. +1 −1 src/SFML/System/Win32/SleepImpl.cpp
  180. +1 −1 src/SFML/System/Win32/SleepImpl.hpp
  181. +1 −1 src/SFML/System/Win32/ThreadImpl.cpp
  182. +1 −1 src/SFML/System/Win32/ThreadImpl.hpp
  183. +1 −1 src/SFML/System/Win32/ThreadLocalImpl.cpp
  184. +1 −1 src/SFML/System/Win32/ThreadLocalImpl.hpp
  185. +5 −1 src/SFML/Window/CMakeLists.txt
  186. +1 −1 src/SFML/Window/Context.cpp
  187. +1 −1 src/SFML/Window/GlContext.cpp
  188. +1 −1 src/SFML/Window/GlContext.hpp
  189. +1 −1 src/SFML/Window/GlResource.cpp
  190. +1 −1 src/SFML/Window/InputImpl.hpp
  191. +1 −1 src/SFML/Window/Joystick.cpp
  192. +1 −1 src/SFML/Window/JoystickImpl.hpp
  193. +4 −1 src/SFML/Window/JoystickManager.cpp
  194. +1 −1 src/SFML/Window/JoystickManager.hpp
  195. +1 −1 src/SFML/Window/Keyboard.cpp
  196. +1 −1 src/SFML/Window/Linux/Display.cpp
  197. +1 −1 src/SFML/Window/Linux/Display.hpp
  198. +132 −104 src/SFML/Window/Linux/GlxContext.cpp
  199. +13 −1 src/SFML/Window/Linux/GlxContext.hpp
  200. +1 −1 src/SFML/Window/Linux/InputImpl.cpp
  201. +1 −1 src/SFML/Window/Linux/InputImpl.hpp
  202. +104 −17 src/SFML/Window/Linux/JoystickImpl.cpp
  203. +13 −1 src/SFML/Window/Linux/JoystickImpl.hpp
  204. +1 −1 src/SFML/Window/Linux/VideoModeImpl.cpp
  205. +123 −79 src/SFML/Window/Linux/WindowImplX11.cpp
  206. +14 −13 src/SFML/Window/Linux/WindowImplX11.hpp
  207. +1 −1 src/SFML/Window/Mouse.cpp
  208. +1 −1 src/SFML/Window/OSX/HIDInputManager.hpp
  209. +4 −7 src/SFML/Window/OSX/HIDInputManager.mm
  210. +1 −1 src/SFML/Window/OSX/HIDJoystickManager.cpp
  211. +1 −1 src/SFML/Window/OSX/HIDJoystickManager.hpp
  212. +1 −1 src/SFML/Window/OSX/InputImpl.hpp
  213. +4 −2 src/SFML/Window/OSX/InputImpl.mm
  214. +19 −4 src/SFML/Window/OSX/JoystickImpl.cpp
  215. +13 −1 src/SFML/Window/OSX/JoystickImpl.hpp
  216. +11 −1 src/SFML/Window/OSX/SFApplication.h
  217. +11 −2 src/SFML/Window/OSX/SFApplication.m
  218. +1 −1 src/SFML/Window/OSX/SFContext.hpp
  219. +61 −0 src/SFML/Window/OSX/SFKeyboardModifiersHelper.h
  220. +247 −0 src/SFML/Window/OSX/SFKeyboardModifiersHelper.mm
  221. +26 −15 src/SFML/Window/OSX/SFOpenGLView.h
  222. +169 −574 src/SFML/Window/OSX/SFOpenGLView.mm
  223. +41 −0 src/SFML/Window/OSX/SFSilentResponder.h
  224. +39 −0 src/SFML/Window/OSX/SFSilentResponder.m
  225. +0 −8 src/SFML/Window/OSX/SFViewController.mm
  226. +19 −13 src/SFML/Window/OSX/SFWindowController.mm
  227. +1 −1 src/SFML/Window/OSX/VideoModeImpl.cpp
  228. +3 −2 src/SFML/Window/OSX/WindowImplCocoa.hpp
  229. +6 −4 src/SFML/Window/OSX/WindowImplCocoa.mm
  230. +0 −6 src/SFML/Window/OSX/WindowImplDelegateProtocol.h
  231. +1 −1 src/SFML/Window/OSX/cg_sf_conversion.cpp
  232. +1 −1 src/SFML/Window/OSX/cg_sf_conversion.hpp
  233. +1 −1 src/SFML/Window/VideoMode.cpp
  234. +1 −1 src/SFML/Window/VideoModeImpl.hpp
  235. +1 −1 src/SFML/Window/Win32/InputImpl.cpp
  236. +1 −1 src/SFML/Window/Win32/InputImpl.hpp
  237. +30 −5 src/SFML/Window/Win32/JoystickImpl.cpp
  238. +13 −1 src/SFML/Window/Win32/JoystickImpl.hpp
  239. +1 −1 src/SFML/Window/Win32/VideoModeImpl.cpp
  240. +4 −4 src/SFML/Window/Win32/WglContext.cpp
  241. +1 −1 src/SFML/Window/Win32/WglContext.hpp
  242. +93 −39 src/SFML/Window/Win32/WindowImplWin32.cpp
  243. +4 −3 src/SFML/Window/Win32/WindowImplWin32.hpp
  244. +19 −6 src/SFML/Window/Window.cpp
  245. +3 −3 src/SFML/Window/WindowImpl.cpp
  246. +4 −2 src/SFML/Window/WindowImpl.hpp
  247. +1 −1 tools/xcode/templates/readme.txt
View
@@ -0,0 +1,10 @@
+language: cpp
+compiler:
+ - gcc
+before_script:
+ - sudo apt-get install libpthread-stubs0-dev libgl1-mesa-dev libx11-dev
+ - sudo apt-get install libxrandr-dev libfreetype6-dev libglew1.5-dev
+ - sudo apt-get install libjpeg8-dev libgpgme11-dev libsndfile1-dev libopenal-dev
+ - cmake .
+script:
+ - make -j4
View
@@ -21,7 +21,7 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Config.cmake)
# setup version numbers
set(VERSION_MAJOR 2)
-set(VERSION_MINOR 0)
+set(VERSION_MINOR 1)
set(VERSION_PATCH 0)
# add the SFML header path
View
@@ -241,12 +241,16 @@ macro(sfml_add_example target)
install(TARGETS ${target}
RUNTIME DESTINATION ${INSTALL_MISC_DIR}/examples/${target} COMPONENT examples)
+ # install the example's source code
+ install(FILES ${THIS_SOURCES}
+ DESTINATION ${INSTALL_MISC_DIR}/examples/${target}
+ COMPONENT examples)
+
# install the example's resources as well
set(EXAMPLE_RESOURCES "${CMAKE_SOURCE_DIR}/examples/${target}/resources")
if(EXISTS ${EXAMPLE_RESOURCES})
install(DIRECTORY ${EXAMPLE_RESOURCES}
DESTINATION ${INSTALL_MISC_DIR}/examples/${target}
- COMPONENT examples
- PATTERN ".svn" EXCLUDE)
+ COMPONENT examples)
endif()
endmacro()
@@ -28,6 +28,9 @@ set_target_properties(cocoa PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${SRCROOT}/resources/Cocoa-Info.plist)
target_link_libraries(cocoa "-framework Cocoa -framework Foundation"
sfml-system sfml-window sfml-graphics)
+
+# set the target's folder (for IDEs that support it, e.g. Visual Studio)
+set_target_properties(cocoa PROPERTIES FOLDER "Examples")
# compile XIB files
find_program(IBTOOL ibtool HINTS "/usr/bin" "${OSX_DEVELOPER_ROOT}/usr/bin")
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -14,21 +14,31 @@
////////////////////////////////////////////////////////////
int main()
{
+ // Request a 32-bits depth buffer when creating the window
+ sf::ContextSettings contextSettings;
+ contextSettings.depthBits = 32;
+
// Create the main window
- sf::RenderWindow window(sf::VideoMode(800, 600), "SFML OpenGL", sf::Style::Default, sf::ContextSettings(32));
+ sf::RenderWindow window(sf::VideoMode(800, 600), "SFML graphics with OpenGL", sf::Style::Default, contextSettings);
window.setVerticalSyncEnabled(true);
- // Load a font for drawing some text
- sf::Font font;
- if (!font.loadFromFile("resources/sansation.ttf"))
- return EXIT_FAILURE;
+ // Make it the active window for OpenGL calls
+ window.setActive();
// Create a sprite for the background
sf::Texture backgroundTexture;
if (!backgroundTexture.loadFromFile("resources/background.jpg"))
return EXIT_FAILURE;
sf::Sprite background(backgroundTexture);
+ // Create some text to draw on top of our OpenGL object
+ sf::Font font;
+ if (!font.loadFromFile("resources/sansation.ttf"))
+ return EXIT_FAILURE;
+ sf::Text text("SFML / OpenGL demo", font);
+ text.setColor(sf::Color(255, 255, 255, 170));
+ text.setPosition(250.f, 450.f);
+
// Load an OpenGL texture.
// We could directly use a sf::Texture as an OpenGL texture (with its Bind() member function),
// but here we want more control on it (generate mipmaps, ...) so we create a new one from an image
@@ -49,15 +59,78 @@ int main()
glDepthMask(GL_TRUE);
glClearDepth(1.f);
+ // Disable lighting
+ glDisable(GL_LIGHTING);
+
+ // Configure the viewport (the same size as the window)
+ glViewport(0, 0, window.getSize().x, window.getSize().y);
+
// Setup a perspective projection
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- gluPerspective(90.f, 1.f, 1.f, 500.f);
+ GLfloat ratio = static_cast<float>(window.getSize().x) / window.getSize().y;
+ glFrustum(-ratio, ratio, -1.f, 1.f, 1.f, 500.f);
- // Bind our texture
+ // Bind the texture
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture);
- glColor4f(1.f, 1.f, 1.f, 1.f);
+
+ // Define a 3D cube (6 faces made of 2 triangles composed by 3 vertices)
+ GLfloat cube[] =
+ {
+ // positions // texture coordinates
+ -20, -20, -20, 0, 0,
+ -20, 20, -20, 1, 0,
+ -20, -20, 20, 0, 1,
+ -20, -20, 20, 0, 1,
+ -20, 20, -20, 1, 0,
+ -20, 20, 20, 1, 1,
+
+ 20, -20, -20, 0, 0,
+ 20, 20, -20, 1, 0,
+ 20, -20, 20, 0, 1,
+ 20, -20, 20, 0, 1,
+ 20, 20, -20, 1, 0,
+ 20, 20, 20, 1, 1,
+
+ -20, -20, -20, 0, 0,
+ 20, -20, -20, 1, 0,
+ -20, -20, 20, 0, 1,
+ -20, -20, 20, 0, 1,
+ 20, -20, -20, 1, 0,
+ 20, -20, 20, 1, 1,
+
+ -20, 20, -20, 0, 0,
+ 20, 20, -20, 1, 0,
+ -20, 20, 20, 0, 1,
+ -20, 20, 20, 0, 1,
+ 20, 20, -20, 1, 0,
+ 20, 20, 20, 1, 1,
+
+ -20, -20, -20, 0, 0,
+ 20, -20, -20, 1, 0,
+ -20, 20, -20, 0, 1,
+ -20, 20, -20, 0, 1,
+ 20, -20, -20, 1, 0,
+ 20, 20, -20, 1, 1,
+
+ -20, -20, 20, 0, 0,
+ 20, -20, 20, 1, 0,
+ -20, 20, 20, 0, 1,
+ -20, 20, 20, 0, 1,
+ 20, -20, 20, 1, 0,
+ 20, 20, 20, 1, 1
+ };
+
+ // Enable position and texture coordinates vertex components
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ glVertexPointer(3, GL_FLOAT, 5 * sizeof(GLfloat), cube);
+ glTexCoordPointer(2, GL_FLOAT, 5 * sizeof(GLfloat), cube + 3);
+
+ // Disable normal and color vertex components
+ glDisableClientState(GL_NORMAL_ARRAY);
+ glDisableClientState(GL_COLOR_ARRAY);
// Create a clock for measuring the time elapsed
sf::Clock clock;
@@ -87,11 +160,6 @@ int main()
window.draw(background);
window.popGLStates();
- // Activate the window before using OpenGL commands.
- // This is useless here because we have only one window which is
- // always the active one, but don't forget it if you use multiple windows
- window.setActive();
-
// Clear the depth buffer
glClear(GL_DEPTH_BUFFER_BIT);
@@ -107,47 +175,11 @@ int main()
glRotatef(clock.getElapsedTime().asSeconds() * 30.f, 0.f, 1.f, 0.f);
glRotatef(clock.getElapsedTime().asSeconds() * 90.f, 0.f, 0.f, 1.f);
- // Draw a cube
- float size = 20.f;
- glBegin(GL_QUADS);
-
- glTexCoord2f(0, 0); glVertex3f(-size, -size, -size);
- glTexCoord2f(0, 1); glVertex3f(-size, size, -size);
- glTexCoord2f(1, 1); glVertex3f( size, size, -size);
- glTexCoord2f(1, 0); glVertex3f( size, -size, -size);
-
- glTexCoord2f(0, 0); glVertex3f(-size, -size, size);
- glTexCoord2f(0, 1); glVertex3f(-size, size, size);
- glTexCoord2f(1, 1); glVertex3f( size, size, size);
- glTexCoord2f(1, 0); glVertex3f( size, -size, size);
-
- glTexCoord2f(0, 0); glVertex3f(-size, -size, -size);
- glTexCoord2f(0, 1); glVertex3f(-size, size, -size);
- glTexCoord2f(1, 1); glVertex3f(-size, size, size);
- glTexCoord2f(1, 0); glVertex3f(-size, -size, size);
-
- glTexCoord2f(0, 0); glVertex3f(size, -size, -size);
- glTexCoord2f(0, 1); glVertex3f(size, size, -size);
- glTexCoord2f(1, 1); glVertex3f(size, size, size);
- glTexCoord2f(1, 0); glVertex3f(size, -size, size);
-
- glTexCoord2f(0, 1); glVertex3f(-size, -size, size);
- glTexCoord2f(0, 0); glVertex3f(-size, -size, -size);
- glTexCoord2f(1, 0); glVertex3f( size, -size, -size);
- glTexCoord2f(1, 1); glVertex3f( size, -size, size);
-
- glTexCoord2f(0, 1); glVertex3f(-size, size, size);
- glTexCoord2f(0, 0); glVertex3f(-size, size, -size);
- glTexCoord2f(1, 0); glVertex3f( size, size, -size);
- glTexCoord2f(1, 1); glVertex3f( size, size, size);
-
- glEnd();
+ // Draw the cube
+ glDrawArrays(GL_TRIANGLES, 0, 36);
// Draw some text on top of our OpenGL object
window.pushGLStates();
- sf::Text text("SFML / OpenGL demo", font);
- text.setColor(sf::Color(255, 255, 255, 170));
- text.setPosition(250.f, 450.f);
window.draw(text);
window.popGLStates();
Oops, something went wrong.

0 comments on commit ea1a63a

Please sign in to comment.