[email protected] 8 years ago
parent
commit
80c2024a70

+ 2 - 0
oxygine/src/oxygine/core/gl/ShaderProgramGL.cpp

@@ -83,6 +83,8 @@ namespace oxygine
     {
     {
         GLuint shader = oxglCreateShader(type);
         GLuint shader = oxglCreateShader(type);
 
 
+        checkGLError();
+
         const char* sources[16];
         const char* sources[16];
         const char** ptr = &sources[0];
         const char** ptr = &sources[0];
 
 

+ 7 - 2
oxygine/src/oxygine/core/gl/VideoDriverGLES20.cpp

@@ -98,8 +98,11 @@ namespace oxygine
 
 
 
 
 
 
-    void VideoDriverGLES20::draw(PRIMITIVE_TYPE pt, const VertexDeclaration* decl_, const void* vdata, unsigned int size)
+    void VideoDriverGLES20::draw(PRIMITIVE_TYPE pt, const VertexDeclaration* decl_, const void* vdata, unsigned int verticesDataSize)
     {
     {
+        OX_ASSERT(verticesDataSize > 0);
+        OX_ASSERT((verticesDataSize % decl_->size) == 0);
+
         const VertexDeclarationGL* decl = static_cast<const VertexDeclarationGL*>(decl_);
         const VertexDeclarationGL* decl = static_cast<const VertexDeclarationGL*>(decl_);
 
 
         const unsigned char* verticesData = (const unsigned char*)vdata;
         const unsigned char* verticesData = (const unsigned char*)vdata;
@@ -112,7 +115,7 @@ namespace oxygine
             el++;
             el++;
         }
         }
 
 
-        size_t primitives = size / decl->size;
+        size_t primitives = verticesDataSize / decl->size;
         glDrawArrays(getPT(pt), 0, (GLsizei)primitives);
         glDrawArrays(getPT(pt), 0, (GLsizei)primitives);
 
 
         el = decl->elements;
         el = decl->elements;
@@ -130,6 +133,8 @@ namespace oxygine
 
 
     void VideoDriverGLES20::draw(PRIMITIVE_TYPE pt, const VertexDeclaration* decl_, const void* vdata, unsigned int verticesDataSize, const unsigned short* indicesData, unsigned int numIndices)
     void VideoDriverGLES20::draw(PRIMITIVE_TYPE pt, const VertexDeclaration* decl_, const void* vdata, unsigned int verticesDataSize, const unsigned short* indicesData, unsigned int numIndices)
     {
     {
+        OX_ASSERT(verticesDataSize > 0);
+        OX_ASSERT((verticesDataSize % decl_->size) == 0);
         const VertexDeclarationGL* decl = static_cast<const VertexDeclarationGL*>(decl_);
         const VertexDeclarationGL* decl = static_cast<const VertexDeclarationGL*>(decl_);
 
 
         const unsigned char* verticesData = (const unsigned char*)vdata;
         const unsigned char* verticesData = (const unsigned char*)vdata;

+ 4 - 3
oxygine/src/oxygine/dev_tools/TreeInspectorPreview.cpp

@@ -332,6 +332,7 @@ namespace oxygine
         current().vdecl = decl;
         current().vdecl = decl;
         current().pt = pt;
         current().pt = pt;
         current().numVertices = verticesDataSize / decl->size;
         current().numVertices = verticesDataSize / decl->size;
+        OX_ASSERT(current().numVertices != 0);
         current().numIndices = numIndices;
         current().numIndices = numIndices;
         current().vertices.assign((const char*)verticesData, (const char*)verticesData + verticesDataSize);
         current().vertices.assign((const char*)verticesData, (const char*)verticesData + verticesDataSize);
         current().indices.assign(indicesData, indicesData + numIndices);
         current().indices.assign(indicesData, indicesData + numIndices);
@@ -339,12 +340,12 @@ namespace oxygine
         nextBatch();
         nextBatch();
     }
     }
 
 
-    void VideoDriverCache::draw(PRIMITIVE_TYPE pt, const VertexDeclaration* decl, const void* verticesData, unsigned int numVertices)
+    void VideoDriverCache::draw(PRIMITIVE_TYPE pt, const VertexDeclaration* decl, const void* verticesData, unsigned int verticesDataSize)
     {
     {
         current().vdecl = decl;
         current().vdecl = decl;
         current().pt = pt;
         current().pt = pt;
-        current().numVertices = numVertices;
-        current().vertices.assign((const char*)verticesData, (const char*)verticesData + current().vdecl->size * numVertices);
+        current().numVertices = verticesDataSize/decl->size;
+        current().vertices.assign((const char*)verticesData, (const char*)verticesData + verticesDataSize);
         nextBatch();
         nextBatch();
     }
     }