|
From: <axl...@us...> - 2010-12-17 22:23:23
|
Revision: 771
http://hgengine.svn.sourceforge.net/hgengine/?rev=771&view=rev
Author: axlecrusher
Date: 2010-12-17 21:57:04 +0000 (Fri, 17 Dec 2010)
Log Message:
-----------
Macro out the glGetError and reduce redundant matrix loads
Modified Paths:
--------------
Mercury2/src/GLHeaders.h
Mercury2/src/GLHelpers.cpp
Modified: Mercury2/src/GLHeaders.h
===================================================================
--- Mercury2/src/GLHeaders.h 2010-11-23 03:04:17 UTC (rev 770)
+++ Mercury2/src/GLHeaders.h 2010-12-17 21:57:04 UTC (rev 771)
@@ -24,12 +24,16 @@
#include <MercuryLog.h>
+#if DO_GLERRORCHECK
#define GLERRORCHECK { \
uint32_t e = GLCALL( glGetError() ); \
if ( e != GL_NO_ERROR ) { \
LOG.Write(ssprintf("GL Error:%s", GlError2String(e).c_str())); \
printf("GL Error:%s", GlError2String(e).c_str()); \
assert(0); } }
+#else
+#define GLERRORCHECK ;
+#endif
#define CHECKFBO { \
uint32_t e = GLCALL( glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) ); \
Modified: Mercury2/src/GLHelpers.cpp
===================================================================
--- Mercury2/src/GLHelpers.cpp 2010-11-23 03:04:17 UTC (rev 770)
+++ Mercury2/src/GLHelpers.cpp 2010-12-17 21:57:04 UTC (rev 771)
@@ -43,10 +43,15 @@
void glLoadMatrix(const MercuryMatrix& m)
{
+ static const MercuryMatrix* lp = NULL;
static MercuryMatrix l;
l = m;
l.Transpose();
- glLoadMatrixf( l.Ptr() );
+ if ( lp != &m )
+ {
+ GLCALL( glLoadMatrixf( l.Ptr() ) );
+ }
+ lp = &m;
}
MercuryMatrix glGetMatrix(unsigned int m)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|