From bc5b41657cc4b863b83ab550e2b7b44be6f24bf1 Mon Sep 17 00:00:00 2001 From: Vittorio Romeo Date: Thu, 9 Dec 2021 13:41:16 +0000 Subject: [PATCH] Remove deprecated 'PrimitiveType::Quads' --- include/SFML/Graphics/Drawable.hpp | 2 +- include/SFML/Graphics/PrimitiveType.hpp | 3 +-- include/SFML/Graphics/RenderWindow.hpp | 2 +- include/SFML/Graphics/Vertex.hpp | 6 ++++-- include/SFML/Graphics/VertexArray.hpp | 1 - src/SFML/Graphics/RenderTarget.cpp | 28 +------------------------ 6 files changed, 8 insertions(+), 34 deletions(-) diff --git a/include/SFML/Graphics/Drawable.hpp b/include/SFML/Graphics/Drawable.hpp index 97d448e1f..49a005f02 100644 --- a/include/SFML/Graphics/Drawable.hpp +++ b/include/SFML/Graphics/Drawable.hpp @@ -110,7 +110,7 @@ protected: /// target.draw(m_vertices, states); /// /// // ... or draw with OpenGL directly -/// glBegin(GL_QUADS); +/// glBegin(GL_TRIANGLES); /// ... /// glEnd(); /// } diff --git a/include/SFML/Graphics/PrimitiveType.hpp b/include/SFML/Graphics/PrimitiveType.hpp index 5290321a9..93d56857c 100644 --- a/include/SFML/Graphics/PrimitiveType.hpp +++ b/include/SFML/Graphics/PrimitiveType.hpp @@ -43,8 +43,7 @@ enum PrimitiveType LineStrip, //!< List of connected lines, a point uses the previous point to form a line Triangles, //!< List of individual triangles TriangleStrip, //!< List of connected triangles, a point uses the two previous points to form a triangle - TriangleFan, //!< List of connected triangles, a point uses the common center and the previous point to form a triangle - Quads //!< List of individual quads (deprecated, don't work with OpenGL ES) + TriangleFan //!< List of connected triangles, a point uses the common center and the previous point to form a triangle }; } // namespace sf diff --git a/include/SFML/Graphics/RenderWindow.hpp b/include/SFML/Graphics/RenderWindow.hpp index fedfff42b..8793b0626 100644 --- a/include/SFML/Graphics/RenderWindow.hpp +++ b/include/SFML/Graphics/RenderWindow.hpp @@ -255,7 +255,7 @@ private: /// window.popGLStates(); /// /// // Draw a 3D object using OpenGL -/// glBegin(GL_QUADS); +/// glBegin(GL_TRIANGLES); /// glVertex3f(...); /// ... /// glEnd(); diff --git a/include/SFML/Graphics/Vertex.hpp b/include/SFML/Graphics/Vertex.hpp index 29f05c62a..f4e109b2a 100644 --- a/include/SFML/Graphics/Vertex.hpp +++ b/include/SFML/Graphics/Vertex.hpp @@ -115,7 +115,7 @@ public: /// /// The vertex is the building block of drawing. Everything which /// is visible on screen is made of vertices. They are grouped -/// as 2D primitives (triangles, quads, ...), and these primitives +/// as 2D primitives (lines, triangles, ...), and these primitives /// are grouped to create even more complex 2D entities such as /// sprites, texts, etc. /// @@ -132,11 +132,13 @@ public: /// sf::Vertex(sf::Vector2f( 0, 0), sf::Color::Red, sf::Vector2f( 0, 0)), /// sf::Vertex(sf::Vector2f( 0, 100), sf::Color::Red, sf::Vector2f( 0, 10)), /// sf::Vertex(sf::Vector2f(100, 100), sf::Color::Red, sf::Vector2f(10, 10)), +/// sf::Vertex(sf::Vector2f( 0, 0), sf::Color::Red, sf::Vector2f( 0, 0)), +/// sf::Vertex(sf::Vector2f(100, 100), sf::Color::Red, sf::Vector2f(10, 10)), /// sf::Vertex(sf::Vector2f(100, 0), sf::Color::Red, sf::Vector2f(10, 0)) /// }; /// /// // draw it -/// window.draw(vertices, 4, sf::Quads); +/// window.draw(vertices, 6, sf::Triangles); /// \endcode /// /// Note: although texture coordinates are supposed to be an integer diff --git a/include/SFML/Graphics/VertexArray.hpp b/include/SFML/Graphics/VertexArray.hpp index e7b77b3b2..405f37476 100644 --- a/include/SFML/Graphics/VertexArray.hpp +++ b/include/SFML/Graphics/VertexArray.hpp @@ -144,7 +144,6 @@ public: /// \li As points /// \li As lines /// \li As triangles - /// \li As quads /// The default primitive type is sf::Points. /// /// \param type Type of primitive diff --git a/src/SFML/Graphics/RenderTarget.cpp b/src/SFML/Graphics/RenderTarget.cpp index 9ab9cf753..66062e980 100644 --- a/src/SFML/Graphics/RenderTarget.cpp +++ b/src/SFML/Graphics/RenderTarget.cpp @@ -42,14 +42,6 @@ #include -// GL_QUADS is unavailable on OpenGL ES, thus we need to define GL_QUADS ourselves -#ifndef GL_QUADS - - #define GL_QUADS 0 - -#endif // GL_QUADS - - namespace { // A nested named namespace is used here to allow unity builds of SFML. @@ -277,15 +269,6 @@ void RenderTarget::draw(const Vertex* vertices, std::size_t vertexCount, if (!vertices || (vertexCount == 0)) return; - // GL_QUADS is unavailable on OpenGL ES - #ifdef SFML_OPENGL_ES - if (type == Quads) - { - err() << "sf::Quads primitive type is not supported on OpenGL ES platforms, drawing skipped" << std::endl; - return; - } - #endif - if (RenderTargetImpl::isActive(m_id) || setActive(true)) { // Check if the vertex count is low enough so that we can pre-transform them @@ -377,15 +360,6 @@ void RenderTarget::draw(const VertexBuffer& vertexBuffer, std::size_t firstVerte if (!vertexCount || !vertexBuffer.getNativeHandle()) return; - // GL_QUADS is unavailable on OpenGL ES - #ifdef SFML_OPENGL_ES - if (vertexBuffer.getPrimitiveType() == Quads) - { - err() << "sf::Quads primitive type is not supported on OpenGL ES platforms, drawing skipped" << std::endl; - return; - } - #endif - if (RenderTargetImpl::isActive(m_id) || setActive(true)) { setupDraw(false, states); @@ -758,7 +732,7 @@ void RenderTarget::drawPrimitives(PrimitiveType type, std::size_t firstVertex, s { // Find the OpenGL primitive type static const GLenum modes[] = {GL_POINTS, GL_LINES, GL_LINE_STRIP, GL_TRIANGLES, - GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_QUADS}; + GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN}; GLenum mode = modes[type]; // Draw the primitives