Fixed compile warnings in sfml-graphics
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1293 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
092720c0c2
commit
642c4fecfa
@ -292,7 +292,7 @@ public :
|
|||||||
/// \param index2 Index of the third vertex of the triangle
|
/// \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
|
/// \brief Render the content of the whole queue
|
||||||
@ -330,7 +330,7 @@ private :
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
typedef std::vector<priv::Batch> BatchArray;
|
typedef std::vector<priv::Batch> BatchArray;
|
||||||
typedef std::vector<float> VertexArray;
|
typedef std::vector<float> VertexArray;
|
||||||
typedef std::vector<unsigned int> IndexArray;
|
typedef std::vector<std::size_t> IndexArray;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
@ -343,7 +343,7 @@ private :
|
|||||||
Blend::Mode myCurrentBlendMode; ///< Current blending mode
|
Blend::Mode myCurrentBlendMode; ///< Current blending mode
|
||||||
IntRect myCurrentViewport; ///< Current target viewport
|
IntRect myCurrentViewport; ///< Current target viewport
|
||||||
Vector2f myCurrentViewportSize; ///< Size of the current viewport (for vertex calculations)
|
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::GeometryRenderer* myRenderer; ///< Optimized geometry renderer
|
||||||
priv::Batch* myCurrentBatch; ///< Current geometry block
|
priv::Batch* myCurrentBatch; ///< Current geometry block
|
||||||
BatchArray myBatches; ///< Blocks of geometry to render
|
BatchArray myBatches; ///< Blocks of geometry to render
|
||||||
|
@ -75,7 +75,7 @@ public :
|
|||||||
/// \param indicesCount Number of indices to render
|
/// \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
|
/// \brief Stop rendering geometry
|
||||||
|
@ -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
|
// Store the geometry informations for later rendering
|
||||||
myVertices = vertices;
|
myVertices = vertices;
|
||||||
@ -70,14 +70,14 @@ void GeometryRendererIM::End()
|
|||||||
void GeometryRendererIM::RenderTriangles(std::size_t start, std::size_t count)
|
void GeometryRendererIM::RenderTriangles(std::size_t start, std::size_t count)
|
||||||
{
|
{
|
||||||
// Caculate the bounds of the geometry range to render
|
// Caculate the bounds of the geometry range to render
|
||||||
const unsigned int* begin = myIndices + start;
|
const std::size_t* begin = myIndices + start;
|
||||||
const unsigned int* end = begin + count;
|
const std::size_t* end = begin + count;
|
||||||
|
|
||||||
// Begin rendering
|
// Begin rendering
|
||||||
glBegin(GL_TRIANGLES);
|
glBegin(GL_TRIANGLES);
|
||||||
|
|
||||||
// Send the vertices one by one
|
// 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;
|
const float* vertex = myVertices + *index * 8;
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ public :
|
|||||||
/// \param indicesCount Number of indices to render
|
/// \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
|
/// \brief Stop rendering geometry
|
||||||
@ -97,7 +97,7 @@ public :
|
|||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
const float* myVertices; ///< Pointer to the vertices to render
|
const float* myVertices; ///< Pointer to the vertices to render
|
||||||
const unsigned int* myIndices; ///< Pointer to the indices to render
|
const std::size_t* myIndices; ///< Pointer to the indices to render
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace priv
|
} // namespace priv
|
||||||
|
@ -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);
|
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
|
// Lock (compile) the vertex array if supported
|
||||||
if (GLEW_EXT_compiled_vertex_array)
|
if (GLEW_EXT_compiled_vertex_array)
|
||||||
GLCheck(glLockArraysEXT(0, verticesCount / 8));
|
GLCheck(glLockArraysEXT(0, static_cast<GLsizei>(verticesCount) / 8));
|
||||||
|
|
||||||
// Store indices for later use
|
// Store indices for later use
|
||||||
myIndices = indices;
|
myIndices = indices;
|
||||||
@ -89,7 +89,7 @@ void GeometryRendererVA::End()
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void GeometryRendererVA::RenderTriangles(std::size_t start, std::size_t count)
|
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<GLsizei>(count), GL_UNSIGNED_INT, myIndices + start));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace priv
|
} // namespace priv
|
||||||
|
@ -71,7 +71,7 @@ public :
|
|||||||
/// \param indicesCount Number of indices to render
|
/// \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
|
/// \brief Stop rendering geometry
|
||||||
@ -96,7 +96,7 @@ public :
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// 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
|
} // namespace priv
|
||||||
|
@ -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)
|
// Update the vertex buffer data (make it grow if it is not large enough)
|
||||||
GLCheck(glBindBufferARB(GL_ARRAY_BUFFER_ARB, myVertexBuffer));
|
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));
|
GLCheck(glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, myIndexBuffer));
|
||||||
if (indicesCount > myIndexBufferSize)
|
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;
|
myIndexBufferSize = indicesCount;
|
||||||
}
|
}
|
||||||
else
|
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);
|
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)
|
void GeometryRendererVBO::RenderTriangles(std::size_t start, std::size_t count)
|
||||||
{
|
{
|
||||||
static const unsigned int* pointer = NULL;
|
static const std::size_t* pointer = NULL;
|
||||||
GLCheck(glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_INT, pointer + start));
|
GLCheck(glDrawElements(GL_TRIANGLES, static_cast<GLsizei>(count), GL_UNSIGNED_INT, pointer + start));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace priv
|
} // namespace priv
|
||||||
|
@ -78,7 +78,7 @@ public :
|
|||||||
/// \param indicesCount Number of indices to render
|
/// \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
|
/// \brief Stop rendering geometry
|
||||||
|
@ -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,
|
// Here we choose not to rely on vector::clear and vector::push_back,
|
||||||
// and to handle resizing and appending manually, for performances reasons
|
// and to handle resizing and appending manually, for performances reasons
|
||||||
|
@ -249,7 +249,7 @@ void Shader::Bind() const
|
|||||||
TextureTable::const_iterator it = myTextures.begin();
|
TextureTable::const_iterator it = myTextures.begin();
|
||||||
for (std::size_t i = 0; i < myTextures.size(); ++i)
|
for (std::size_t i = 0; i < myTextures.size(); ++i)
|
||||||
{
|
{
|
||||||
GLint index = i + 1;
|
GLint index = static_cast<GLsizei>(i + 1);
|
||||||
GLCheck(glUniform1iARB(it->first, index));
|
GLCheck(glUniform1iARB(it->first, index));
|
||||||
GLCheck(glActiveTextureARB(GL_TEXTURE0_ARB + index));
|
GLCheck(glActiveTextureARB(GL_TEXTURE0_ARB + index));
|
||||||
it->second->Bind();
|
it->second->Bind();
|
||||||
@ -279,7 +279,7 @@ void Shader::Unbind() const
|
|||||||
// Disable texture units
|
// Disable texture units
|
||||||
for (std::size_t i = 0; i < myTextures.size(); ++i)
|
for (std::size_t i = 0; i < myTextures.size(); ++i)
|
||||||
{
|
{
|
||||||
GLint index = i + 1;
|
GLint index = static_cast<GLsizei>(i + 1);
|
||||||
GLCheck(glActiveTextureARB(GL_TEXTURE0_ARB + index));
|
GLCheck(glActiveTextureARB(GL_TEXTURE0_ARB + index));
|
||||||
GLCheck(glBindTexture(GL_TEXTURE_2D, 0));
|
GLCheck(glBindTexture(GL_TEXTURE_2D, 0));
|
||||||
}
|
}
|
||||||
|
@ -351,8 +351,8 @@ void Shape::Render(RenderTarget&, RenderQueue& queue) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Close the shape by duplicating the first point at the end
|
// Close the shape by duplicating the first point at the end
|
||||||
unsigned int begin = 0;
|
std::size_t begin = 0;
|
||||||
unsigned int last = (myPoints.size() - 2) * 2;
|
std::size_t last = (myPoints.size() - 2) * 2;
|
||||||
queue.AddTriangle(last, last + 1, begin);
|
queue.AddTriangle(last, last + 1, begin);
|
||||||
queue.AddTriangle(begin, last + 1, begin + 1);
|
queue.AddTriangle(begin, last + 1, begin + 1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user