|
From: <axl...@us...> - 2010-01-14 19:34:58
|
Revision: 657
http://hgengine.svn.sourceforge.net/hgengine/?rev=657&view=rev
Author: axlecrusher
Date: 2010-01-14 19:34:46 +0000 (Thu, 14 Jan 2010)
Log Message:
-----------
Fix windows compiling.
Fix shader compiling multiple times.
Fix shader destruction when opengl driver gives successful link message.
Modified Paths:
--------------
Mercury2/src/DataStructures/SpatialHash.h
Mercury2/src/MercuryAsset.cpp
Mercury2/src/Shader.cpp
Modified: Mercury2/src/DataStructures/SpatialHash.h
===================================================================
--- Mercury2/src/DataStructures/SpatialHash.h 2010-01-13 12:06:26 UTC (rev 656)
+++ Mercury2/src/DataStructures/SpatialHash.h 2010-01-14 19:34:46 UTC (rev 657)
@@ -1,7 +1,7 @@
#ifndef SPATIALHASH_H
#define SPATIALHASH_H
-#include <stdint.h>
+//#include <stdint.h>
#include <list>
#include <math.h>
Modified: Mercury2/src/MercuryAsset.cpp
===================================================================
--- Mercury2/src/MercuryAsset.cpp 2010-01-13 12:06:26 UTC (rev 656)
+++ Mercury2/src/MercuryAsset.cpp 2010-01-14 19:34:46 UTC (rev 657)
@@ -3,6 +3,8 @@
#include <MercuryNode.h>
#include <GLHeaders.h>
+#include <time.h>
+
extern bool DOOCCLUSIONCULL;
MercuryAsset::MercuryAsset( const MString & key, bool bInstanced )
@@ -192,7 +194,7 @@
void AssetFactory::RemoveAssetInstance(const MString& key)
{
m_assetInstances.remove( key );
- puts( "removed asset "+key );
+ LOG.Write("removed asset "+key);
}
/****************************************************************************
Modified: Mercury2/src/Shader.cpp
===================================================================
--- Mercury2/src/Shader.cpp 2010-01-13 12:06:26 UTC (rev 656)
+++ Mercury2/src/Shader.cpp 2010-01-14 19:34:46 UTC (rev 657)
@@ -94,6 +94,9 @@
fPriority = StrToFloat( node.Attribute("priority" ) );
ChangeKey( node.Attribute("file") );
+
+ if (iProgramID == NULL)
+ LoadShader();
}
bool Shader::ChangeKey( const MString& path )
@@ -102,7 +105,7 @@
return true;
sShaderName = path;
- LoadShader( );
+// LoadShader( );
return MercuryAsset::ChangeKey( path );
}
@@ -206,8 +209,7 @@
{
char * tmpstr = (char*)malloc( stringLength + 1 );
GLCALL( glGetInfoLogARB( fragmentShader, stringLength, NULL, tmpstr ) );
- puts( "Compiling Fragment Shader response follows:" );
- puts( tmpstr );
+ LOG.Write( ssprintf("Compiling Fragment Shader response follows:%s" ,tmpstr) );
free( tmpstr );
return bFragCompiled!=0;
}
@@ -234,8 +236,7 @@
{
char * tmpstr = (char*)malloc( stringLength + 1 );
GLCALL( glGetInfoLogARB( vertexShader, stringLength, NULL, tmpstr ) );
- puts( "Compiling Vertex Shader response follows:" );
- puts( tmpstr );
+ LOG.Write( ssprintf("Compiling Vertex Shader response follows:%s", tmpstr) );
free( tmpstr );
return bVertCompiled!=0;
}
@@ -263,8 +264,7 @@
{
char * tmpstr = (char*)malloc( stringLength + 1 );
GLCALL( glGetInfoLogARB( geometryShader, stringLength, NULL, tmpstr ) );
- puts( "Compiling Geometry Shader response follows:" );
- puts( tmpstr );
+ LOG.Write( ssprintf("Compiling Geometry Shader response follows:%s",tmpstr) );
free( tmpstr );
return bGeomCompiled!=0;
}
@@ -304,8 +304,8 @@
GLCALL( glGetIntegerv(GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT,&imaxvert) );
if( (ierror = glGetError()) != 0 )
{
- puts( "ERROR: You cannot load a geometry shader when there are still errors left in OpenGL." );
- puts( "Please track down the error remaining by using glGetError() to cordon off your code." );
+ LOG.Write( "ERROR: You cannot load a geometry shader when there are still errors left in OpenGL." );
+ LOG.Write( "Please track down the error remaining by using glGetError() to cordon off your code." );
LOG.Write( ssprintf( "The last error received was: %d", ierror ) );
}
for( i = 1; i < imaxvert; i++ )
@@ -326,11 +326,14 @@
{
char * tmpstr = (char*)malloc( stringLength + 1 );
GLCALL( glGetInfoLogARB( iProgramID, stringLength, NULL, tmpstr ) );
- puts( "Linking shaders. response follows:" );
- puts( tmpstr );
+ LOG.Write( ssprintf("Linking shaders. response follows:%s",tmpstr) );
free( tmpstr );
+ }
+
+ if (bLinked == 0)
+ {
DestroyShader();
- return bLinked!=0;
+ return false;
}
//Build the list of uniform tabs.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|