Skip to content

Commit

Permalink
Some Warnings removed in Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
hudrima1 committed Dec 11, 2023
1 parent a2f2590 commit 05642d8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
35 changes: 20 additions & 15 deletions modules/sl/source/gl/SLGLVertexArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ void SLGLVertexArray::deleteGL()
glDeleteBuffers(1, &_idVBOIndices);
_idVBOIndices = 0;
SLGLVertexBuffer::totalBufferCount--;
SLGLVertexBuffer::totalBufferSize -= _numIndicesElements * (SLuint)SLGLVertexBuffer::sizeOfType(_indexDataType);
SLGLVertexBuffer::totalBufferSize -= (SLuint)_numIndicesElements *
(SLuint)SLGLVertexBuffer::sizeOfType(_indexDataType);
}
}
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -220,9 +221,10 @@ void SLGLVertexArray::generate(SLuint numVertices,
_numIndicesEdges && _indexDataEdges)
{
// create temp. buffer with both index arrays
SLuint typeSize = SLGLVertexBuffer::sizeOfType(_indexDataType);
SLuint tmBufSize = (_numIndicesElements + _numIndicesEdges) * (SLuint)typeSize;
SLubyte* tmpBuf = new SLubyte[tmBufSize];
SLuint typeSize = SLGLVertexBuffer::sizeOfType(_indexDataType);
SLuint tmBufSize = (SLuint)(_numIndicesElements + _numIndicesEdges) *
(SLuint)typeSize;
SLubyte* tmpBuf = new SLubyte[tmBufSize];
memcpy(tmpBuf,
_indexDataElements,
_numIndicesElements * (SLuint)typeSize);
Expand All @@ -247,7 +249,8 @@ void SLGLVertexArray::generate(SLuint numVertices,
_indexDataElements,
GL_STATIC_DRAW);
SLGLVertexBuffer::totalBufferCount++;
SLGLVertexBuffer::totalBufferSize += _numIndicesElements * (SLuint)typeSize;
SLGLVertexBuffer::totalBufferSize += (SLuint)_numIndicesElements *
(SLuint)typeSize;
}

glBindVertexArray(0);
Expand Down Expand Up @@ -306,9 +309,10 @@ void SLGLVertexArray::generateTF(SLuint numVertices,
_numIndicesEdges && _indexDataEdges)
{
// create temp. buffer with both index arrays
SLuint typeSize = SLGLVertexBuffer::sizeOfType(_indexDataType);
SLuint tmBufSize = (_numIndicesElements + _numIndicesEdges) * (SLuint)typeSize;
SLubyte* tmpBuf = new SLubyte[tmBufSize];
SLuint typeSize = (SLuint)SLGLVertexBuffer::sizeOfType(_indexDataType);
SLuint tmBufSize = (SLuint)(_numIndicesElements + _numIndicesEdges) *
(SLuint)typeSize;
SLubyte* tmpBuf = new SLubyte[tmBufSize];
memcpy(tmpBuf,
_indexDataElements,
_numIndicesElements * (SLuint)typeSize);
Expand Down Expand Up @@ -336,7 +340,8 @@ void SLGLVertexArray::generateTF(SLuint numVertices,
_indexDataElements,
GL_STATIC_DRAW);
SLGLVertexBuffer::totalBufferCount++;
SLGLVertexBuffer::totalBufferSize += _numIndicesElements * (SLuint)typeSize;
SLGLVertexBuffer::totalBufferSize += (SLuint)_numIndicesElements *
(SLuint)typeSize;
}

glBindVertexArray(0);
Expand Down Expand Up @@ -390,7 +395,7 @@ void SLGLVertexArray::drawElementsAs(SLGLPrimitiveType primitiveType,

// Do the draw call with indices
if (numIndexes == 0)
numIndexes = _numIndicesElements;
numIndexes = (SLuint)_numIndicesElements;

SLuint indexTypeSize = SLGLVertexBuffer::sizeOfType(_indexDataType);

Expand Down Expand Up @@ -490,7 +495,7 @@ void SLGLVertexArray::drawElementsInstanced(SLGLPrimitiveType primitiveType,

// Do the draw call with indices
if (numIndexes == 0)
numIndexes = _numIndicesElements;
numIndexes = (SLuint)_numIndicesElements;

SLuint indexTypeSize = SLGLVertexBuffer::sizeOfType(_indexDataType);

Expand Down Expand Up @@ -552,11 +557,11 @@ void SLGLVertexArray::drawEdges(SLCol4f color,
glLineWidth(lineWidth);
#endif

//////////////////////////////////////////////
//////////////////////////////////////////////////////
drawElementsAs(PT_lines,
_numIndicesEdges,
_numIndicesElements);
//////////////////////////////////////////////
(SLuint)_numIndicesEdges,
(SLuint)_numIndicesElements);
//////////////////////////////////////////////////////

#ifndef SL_GLES
if (lineWidth != 1.0f)
Expand Down
4 changes: 2 additions & 2 deletions modules/sl/source/gl/SLGLVertexArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ class SLGLVertexArray

// Some getters
SLuint numVertices() const { return _numVertices; }
SLuint numIndicesElements() const { return _numIndicesElements; }
SLuint numIndicesEdges() const { return _numIndicesEdges; }
SLuint numIndicesElements() const { return (SLuint)_numIndicesElements; }
SLuint numIndicesEdges() const { return (SLuint)_numIndicesEdges; }
SLGLVertexBuffer* vbo() { return &_vbo; }

// Some statistics
Expand Down

0 comments on commit 05642d8

Please sign in to comment.