From 9e4d1db0b29dccc4ab661d8129e4e1783d0e6965 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Fri, 29 May 2009 20:37:44 +0100 Subject: [PATCH] Remove some debugging messages --- src/Mesh.cpp | 16 ++++++++-------- src/Model.cpp | 9 ++------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/Mesh.cpp b/src/Mesh.cpp index 3c1fe33..acd32bc 100644 --- a/src/Mesh.cpp +++ b/src/Mesh.cpp @@ -373,7 +373,7 @@ private: int myVertexCount; VertexData* myVertexData; int myIndexCount; - GLuint* myIndices; + GLushort* myIndices; }; VertexArrayMesh::VertexArrayMesh(IMeshBufferPtr aBuffer) @@ -390,7 +390,7 @@ VertexArrayMesh::VertexArrayMesh(IMeshBufferPtr aBuffer) copyVertexData(buf, myVertexData); myIndexCount = buf->indices.size(); - myIndices = new GLuint[myIndexCount]; + myIndices = new GLushort[myIndexCount]; copy(buf->indices.begin(), buf->indices.end(), myIndices); } @@ -430,7 +430,7 @@ void VertexArrayMesh::render() const glNormalPointer(GL_FLOAT, sizeof(VertexData), reinterpret_cast(&myVertexData->nx)); - glDrawElements(GL_TRIANGLES, myIndexCount, GL_UNSIGNED_INT, myIndices); + glDrawElements(GL_TRIANGLES, myIndexCount, GL_UNSIGNED_SHORT, myIndices); glPopClientAttrib(); glPopAttrib(); @@ -476,17 +476,17 @@ VBOMesh::VBOMesh(IMeshBufferPtr aBuffer) // Copy the indices into a temporary array myIndexCount = buf->indices.size(); - GLuint* pIndices = new GLuint[myIndexCount]; + GLshort* pIndices = new GLshort[myIndexCount]; copy(buf->indices.begin(), buf->indices.end(), pIndices); // Build the index buffer glGenBuffersARB(1, &myIndexBuf); glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER, myIndexBuf); - glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER, myIndexCount * sizeof(GLuint), + glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER, myIndexCount * sizeof(GLushort), NULL, GL_STATIC_DRAW); glBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER, 0, - myIndexCount * sizeof(GLuint), pIndices); + myIndexCount * sizeof(GLushort), pIndices); glBindBufferARB(GL_ARRAY_BUFFER, 0); glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER, 0); @@ -535,7 +535,7 @@ void VBOMesh::render() const glNormalPointer(GL_FLOAT, sizeof(VertexData), reinterpret_cast(offsetof(VertexData, nx))); - glDrawElements(GL_TRIANGLES, myIndexCount, GL_UNSIGNED_INT, 0); + glDrawElements(GL_TRIANGLES, myIndexCount, GL_UNSIGNED_SHORT, 0); glBindBufferARB(GL_ARRAY_BUFFER, 0); glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER, 0); @@ -548,7 +548,7 @@ IMeshPtr makeMesh(IMeshBufferPtr aBuffer) { static bool havePrintedMeshChoice = false; - aBuffer->printStats(); + //aBuffer->printStats(); // Prefer VBO meshes if (GLEW_ARB_vertex_buffer_object) { diff --git a/src/Model.cpp b/src/Model.cpp index 6ce6e21..7f77b1c 100644 --- a/src/Model.cpp +++ b/src/Model.cpp @@ -75,7 +75,6 @@ MaterialFile::MaterialFile(const string& aFileName) } else if (word == "newmtl") { is >> activeMaterial; - debug() << "Loading material " << activeMaterial; myMaterials[activeMaterial] = Material(); } @@ -151,10 +150,8 @@ void Model::render() const IModelPtr loadModel(const string& fileName, double aScale) { ModelCache::iterator it = theCache.find(fileName); - if (it != theCache.end()) { - debug() << "Got model " << fileName << " from cache"; + if (it != theCache.end()) return (*it).second; - } ifstream f(fileName.c_str()); if (!f.good()) { @@ -190,7 +187,6 @@ IModelPtr loadModel(const string& fileName, double aScale) // New object string objName; f >> objName; - debug() << "Building object " << objName; } else if (first == "mtllib") { // Material file @@ -318,8 +314,7 @@ IModelPtr loadModel(const string& fileName, double aScale) } Vector dim = makeVector(xmax - xmin, ymax - ymin, zmax - zmin); - log() << dim; - + log() << "Model loaded: " << vertices.size() << " vertices, " << faceCount << " faces"; -- 2.39.2