diff --git a/include/SFML/Graphics/RenderQueue.hpp b/include/SFML/Graphics/RenderQueue.hpp index ee602e64..176820e4 100644 --- a/include/SFML/Graphics/RenderQueue.hpp +++ b/include/SFML/Graphics/RenderQueue.hpp @@ -292,7 +292,7 @@ public : /// \param index2 Index of the third vertex of the triangle /// //////////////////////////////////////////////////////////// - void AddTriangle(unsigned int index0, unsigned int index1, unsigned int index2); + void AddTriangle(std::size_t index0, std::size_t index1, std::size_t index2); //////////////////////////////////////////////////////////// /// \brief Render the content of the whole queue @@ -330,7 +330,7 @@ private : //////////////////////////////////////////////////////////// typedef std::vector BatchArray; typedef std::vector VertexArray; - typedef std::vector IndexArray; + typedef std::vector IndexArray; //////////////////////////////////////////////////////////// // Member data @@ -343,7 +343,7 @@ private : Blend::Mode myCurrentBlendMode; ///< Current blending mode IntRect myCurrentViewport; ///< Current target viewport Vector2f myCurrentViewportSize; ///< Size of the current viewport (for vertex calculations) - unsigned int myBaseIndex; ///< Base vertex index for the current batch + std::size_t myBaseIndex; ///< Base vertex index for the current batch priv::GeometryRenderer* myRenderer; ///< Optimized geometry renderer priv::Batch* myCurrentBatch; ///< Current geometry block BatchArray myBatches; ///< Blocks of geometry to render diff --git a/src/SFML/Graphics/GeometryRenderer.hpp b/src/SFML/Graphics/GeometryRenderer.hpp index da73c7bd..1a3a295d 100644 --- a/src/SFML/Graphics/GeometryRenderer.hpp +++ b/src/SFML/Graphics/GeometryRenderer.hpp @@ -75,7 +75,7 @@ public : /// \param indicesCount Number of indices to render /// //////////////////////////////////////////////////////////// - virtual void Begin(const float* vertices, std::size_t verticesCount, const unsigned int* indices, std::size_t indicesCount) = 0; + virtual void Begin(const float* vertices, std::size_t verticesCount, const std::size_t* indices, std::size_t indicesCount) = 0; //////////////////////////////////////////////////////////// /// \brief Stop rendering geometry diff --git a/src/SFML/Graphics/GeometryRendererIM.cpp b/src/SFML/Graphics/GeometryRendererIM.cpp index bb546015..6523119e 100644 --- a/src/SFML/Graphics/GeometryRendererIM.cpp +++ b/src/SFML/Graphics/GeometryRendererIM.cpp @@ -51,7 +51,7 @@ myIndices (NULL) //////////////////////////////////////////////////////////// -void GeometryRendererIM::Begin(const float* vertices, std::size_t, const unsigned int* indices, std::size_t) +void GeometryRendererIM::Begin(const float* vertices, std::size_t, const std::size_t* indices, std::size_t) { // Store the geometry informations for later rendering myVertices = vertices; @@ -70,14 +70,14 @@ void GeometryRendererIM::End() void GeometryRendererIM::RenderTriangles(std::size_t start, std::size_t count) { // Caculate the bounds of the geometry range to render - const unsigned int* begin = myIndices + start; - const unsigned int* end = begin + count; + const std::size_t* begin = myIndices + start; + const std::size_t* end = begin + count; // Begin rendering glBegin(GL_TRIANGLES); // Send the vertices one by one - for (const unsigned int* index = begin; index != end; index++) + for (const std::size_t* index = begin; index != end; index++) { const float* vertex = myVertices + *index * 8; diff --git a/src/SFML/Graphics/GeometryRendererIM.hpp b/src/SFML/Graphics/GeometryRendererIM.hpp index 5e2a8ee0..d2ea86d1 100644 --- a/src/SFML/Graphics/GeometryRendererIM.hpp +++ b/src/SFML/Graphics/GeometryRendererIM.hpp @@ -71,7 +71,7 @@ public : /// \param indicesCount Number of indices to render /// //////////////////////////////////////////////////////////// - virtual void Begin(const float* vertices, std::size_t verticesCount, const unsigned int* indices, std::size_t indicesCount); + virtual void Begin(const float* vertices, std::size_t verticesCount, const std::size_t* indices, std::size_t indicesCount); //////////////////////////////////////////////////////////// /// \brief Stop rendering geometry @@ -96,8 +96,8 @@ public : //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - const float* myVertices; ///< Pointer to the vertices to render - const unsigned int* myIndices; ///< Pointer to the indices to render + const float* myVertices; ///< Pointer to the vertices to render + const std::size_t* myIndices; ///< Pointer to the indices to render }; } // namespace priv diff --git a/src/SFML/Graphics/GeometryRendererVA.cpp b/src/SFML/Graphics/GeometryRendererVA.cpp index b4b7e0a9..433c07b8 100644 --- a/src/SFML/Graphics/GeometryRendererVA.cpp +++ b/src/SFML/Graphics/GeometryRendererVA.cpp @@ -51,7 +51,7 @@ myIndices(NULL) //////////////////////////////////////////////////////////// -void GeometryRendererVA::Begin(const float* vertices, std::size_t verticesCount, const unsigned int* indices, std::size_t) +void GeometryRendererVA::Begin(const float* vertices, std::size_t verticesCount, const std::size_t* indices, std::size_t) { static const GLsizei stride = 8 * sizeof(float); @@ -70,7 +70,7 @@ void GeometryRendererVA::Begin(const float* vertices, std::size_t verticesCount, // Lock (compile) the vertex array if supported if (GLEW_EXT_compiled_vertex_array) - GLCheck(glLockArraysEXT(0, verticesCount / 8)); + GLCheck(glLockArraysEXT(0, static_cast(verticesCount) / 8)); // Store indices for later use myIndices = indices; @@ -89,7 +89,7 @@ void GeometryRendererVA::End() //////////////////////////////////////////////////////////// void GeometryRendererVA::RenderTriangles(std::size_t start, std::size_t count) { - GLCheck(glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_INT, myIndices + start)); + GLCheck(glDrawElements(GL_TRIANGLES, static_cast(count), GL_UNSIGNED_INT, myIndices + start)); } } // namespace priv diff --git a/src/SFML/Graphics/GeometryRendererVA.hpp b/src/SFML/Graphics/GeometryRendererVA.hpp index cd05f5bb..fcfddaf5 100644 --- a/src/SFML/Graphics/GeometryRendererVA.hpp +++ b/src/SFML/Graphics/GeometryRendererVA.hpp @@ -71,7 +71,7 @@ public : /// \param indicesCount Number of indices to render /// //////////////////////////////////////////////////////////// - virtual void Begin(const float* vertices, std::size_t verticesCount, const unsigned int* indices, std::size_t indicesCount); + virtual void Begin(const float* vertices, std::size_t verticesCount, const std::size_t* indices, std::size_t indicesCount); //////////////////////////////////////////////////////////// /// \brief Stop rendering geometry @@ -96,7 +96,7 @@ public : //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - const unsigned int* myIndices; ///< Pointer to the indices to render + const std::size_t* myIndices; ///< Pointer to the indices to render }; } // namespace priv diff --git a/src/SFML/Graphics/GeometryRendererVBO.cpp b/src/SFML/Graphics/GeometryRendererVBO.cpp index 32291380..e0927cda 100644 --- a/src/SFML/Graphics/GeometryRendererVBO.cpp +++ b/src/SFML/Graphics/GeometryRendererVBO.cpp @@ -64,7 +64,7 @@ GeometryRendererVBO::~GeometryRendererVBO() //////////////////////////////////////////////////////////// -void GeometryRendererVBO::Begin(const float* vertices, std::size_t verticesCount, const unsigned int* indices, std::size_t indicesCount) +void GeometryRendererVBO::Begin(const float* vertices, std::size_t verticesCount, const std::size_t* indices, std::size_t indicesCount) { // Update the vertex buffer data (make it grow if it is not large enough) GLCheck(glBindBufferARB(GL_ARRAY_BUFFER_ARB, myVertexBuffer)); @@ -82,12 +82,12 @@ void GeometryRendererVBO::Begin(const float* vertices, std::size_t verticesCount GLCheck(glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, myIndexBuffer)); if (indicesCount > myIndexBufferSize) { - GLCheck(glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, indicesCount * sizeof(unsigned int), indices, GL_DYNAMIC_DRAW_ARB)); + GLCheck(glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, indicesCount * sizeof(std::size_t), indices, GL_DYNAMIC_DRAW_ARB)); myIndexBufferSize = indicesCount; } else { - GLCheck(glBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0, indicesCount * sizeof(unsigned int), indices)); + GLCheck(glBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0, indicesCount * sizeof(std::size_t), indices)); } static const GLsizei stride = 8 * sizeof(float); @@ -118,8 +118,8 @@ void GeometryRendererVBO::End() //////////////////////////////////////////////////////////// void GeometryRendererVBO::RenderTriangles(std::size_t start, std::size_t count) { - static const unsigned int* pointer = NULL; - GLCheck(glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_INT, pointer + start)); + static const std::size_t* pointer = NULL; + GLCheck(glDrawElements(GL_TRIANGLES, static_cast(count), GL_UNSIGNED_INT, pointer + start)); } } // namespace priv diff --git a/src/SFML/Graphics/GeometryRendererVBO.hpp b/src/SFML/Graphics/GeometryRendererVBO.hpp index 9bdd2a10..4fee51aa 100644 --- a/src/SFML/Graphics/GeometryRendererVBO.hpp +++ b/src/SFML/Graphics/GeometryRendererVBO.hpp @@ -78,7 +78,7 @@ public : /// \param indicesCount Number of indices to render /// //////////////////////////////////////////////////////////// - virtual void Begin(const float* vertices, std::size_t verticesCount, const unsigned int* indices, std::size_t indicesCount); + virtual void Begin(const float* vertices, std::size_t verticesCount, const std::size_t* indices, std::size_t indicesCount); //////////////////////////////////////////////////////////// /// \brief Stop rendering geometry diff --git a/src/SFML/Graphics/RenderQueue.cpp b/src/SFML/Graphics/RenderQueue.cpp index 7b2e51ed..e05fe013 100644 --- a/src/SFML/Graphics/RenderQueue.cpp +++ b/src/SFML/Graphics/RenderQueue.cpp @@ -259,7 +259,7 @@ void RenderQueue::AddVertex(float x, float y, float u, float v, const Color& col //////////////////////////////////////////////////////////// -void RenderQueue::AddTriangle(unsigned int index0, unsigned int index1, unsigned int index2) +void RenderQueue::AddTriangle(std::size_t index0, std::size_t index1, std::size_t index2) { // Here we choose not to rely on vector::clear and vector::push_back, // and to handle resizing and appending manually, for performances reasons diff --git a/src/SFML/Graphics/Shader.cpp b/src/SFML/Graphics/Shader.cpp index b7d7b0d7..ff8dffdb 100644 --- a/src/SFML/Graphics/Shader.cpp +++ b/src/SFML/Graphics/Shader.cpp @@ -249,7 +249,7 @@ void Shader::Bind() const TextureTable::const_iterator it = myTextures.begin(); for (std::size_t i = 0; i < myTextures.size(); ++i) { - GLint index = i + 1; + GLint index = static_cast(i + 1); GLCheck(glUniform1iARB(it->first, index)); GLCheck(glActiveTextureARB(GL_TEXTURE0_ARB + index)); it->second->Bind(); @@ -279,7 +279,7 @@ void Shader::Unbind() const // Disable texture units for (std::size_t i = 0; i < myTextures.size(); ++i) { - GLint index = i + 1; + GLint index = static_cast(i + 1); GLCheck(glActiveTextureARB(GL_TEXTURE0_ARB + index)); GLCheck(glBindTexture(GL_TEXTURE_2D, 0)); } diff --git a/src/SFML/Graphics/Shape.cpp b/src/SFML/Graphics/Shape.cpp index b7b8e6bf..ed773931 100644 --- a/src/SFML/Graphics/Shape.cpp +++ b/src/SFML/Graphics/Shape.cpp @@ -351,8 +351,8 @@ void Shape::Render(RenderTarget&, RenderQueue& queue) const } // Close the shape by duplicating the first point at the end - unsigned int begin = 0; - unsigned int last = (myPoints.size() - 2) * 2; + std::size_t begin = 0; + std::size_t last = (myPoints.size() - 2) * 2; queue.AddTriangle(last, last + 1, begin); queue.AddTriangle(begin, last + 1, begin + 1); }