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:
LaurentGom 2009-11-27 08:21:41 +00:00
parent 092720c0c2
commit 642c4fecfa
11 changed files with 27 additions and 27 deletions

View File

@ -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<priv::Batch> BatchArray;
typedef std::vector<float> VertexArray;
typedef std::vector<unsigned int> IndexArray;
typedef std::vector<std::size_t> 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

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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<GLsizei>(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<GLsizei>(count), GL_UNSIGNED_INT, myIndices + start));
}
} // namespace priv

View File

@ -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

View File

@ -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<GLsizei>(count), GL_UNSIGNED_INT, pointer + start));
}
} // namespace priv

View File

@ -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

View File

@ -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

View File

@ -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<GLsizei>(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<GLsizei>(i + 1);
GLCheck(glActiveTextureARB(GL_TEXTURE0_ARB + index));
GLCheck(glBindTexture(GL_TEXTURE_2D, 0));
}

View File

@ -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);
}