- attempt to add "some" VBO rendering for static models (need to test if this improves performance in different environments)

This commit is contained in:
Mark Vejvoda
2011-02-04 01:24:26 +00:00
parent 2dc0d97f55
commit dab57fcb34
9 changed files with 177 additions and 201 deletions

View File

@@ -17,13 +17,13 @@
#include "opengl.h"
#include "leak_dumper.h"
namespace Shared{ namespace Graphics{ namespace Gl{
namespace Shared { namespace Graphics { namespace Gl {
// =====================================================
// class ModelRendererGl
// =====================================================
class ModelRendererGl: public ModelRenderer{
class ModelRendererGl: public ModelRenderer {
private:
bool rendering;
bool duplicateTexCoords;
@@ -42,8 +42,8 @@ public:
private:
void renderMesh(Mesh *mesh, bool isStaticModel);
void renderMeshNormals(Mesh *mesh, bool isStaticModel);
void renderMesh(Mesh *mesh);
void renderMeshNormals(Mesh *mesh);
};
}}}//end namespace

View File

@@ -30,6 +30,10 @@ using Util::intToStr;
// Globals
// =====================================================
bool getVBOSupported();
void setVBOSupported(bool value);
void overrideGlExtensionSupport(const char *extensionName,bool value);
bool isGlExtensionSupported(const char *extensionName);
bool isGlVersionSupported(int major, int minor, int release);
const char *getGlVersion();

View File

@@ -25,9 +25,7 @@ using std::string;
using std::map;
using std::pair;
//#define ENABLE_VBO_CODE
namespace Shared{ namespace Graphics{
namespace Shared { namespace Graphics {
class Model;
class Mesh;
@@ -74,14 +72,12 @@ private:
InterpolationData *interpolationData;
TextureManager *textureManager;
#if defined(ENABLE_VBO_CODE)
// Vertex Buffer Object Names
bool hasBuiltVBOs;
uint32 m_nVBOVertices; // Vertex VBO Name
uint32 m_nVBOTexCoords; // Texture Coordinate VBO Name
uint32 m_nVBONormals; // Normal VBO Name
uint32 m_nVBOIndexes; // Indexes VBO Name
#endif
public:
//init & end
@@ -99,17 +95,13 @@ public:
uint32 getIndexCount() const {return indexCount;}
uint32 getTriangleCount() const;
#if defined(ENABLE_VBO_CODE)
uint32 getVBOVertices() const { return m_nVBOVertices;}
uint32 getVBOTexCoords() const { return m_nVBOTexCoords;}
uint32 getVBONormals() const { return m_nVBONormals;}
uint32 getVBOIndexes() const { return m_nVBOIndexes;}
bool hasBuiltVBOEntities() const { return hasBuiltVBOs;}
void BuildVBOs();
void ReleaseVBOs();
#endif
//data
const Vec3f *getVertices() const {return vertices;}
@@ -169,7 +161,6 @@ private:
bool lastCycleVertex;
string fileName;
bool isStaticModel;
public:
//constructor & destructor
@@ -201,9 +192,6 @@ public:
void setTextureManager(TextureManager *textureManager) {this->textureManager= textureManager;}
void deletePixels();
bool getIsStaticModel() const { return isStaticModel; }
void setIsStaticModel(bool value) { isStaticModel = value; }
string getFileName() const { return fileName; }
private: