mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-18 06:55:48 +03:00
I made some structural changes, and i'm trying to encapsulate a little the renderer to in a future implement an OpenGL3 render, and remove the fixed pipeline.
This commit is contained in:
@@ -60,30 +60,30 @@ void cShader::Init( const Uint32& Type ) {
|
||||
mValid = false;
|
||||
mCompiled = false;
|
||||
mGLId = glCreateShader( mType );
|
||||
}
|
||||
|
||||
void cShader::Reload() {
|
||||
Init( mType );
|
||||
|
||||
SetSource( mSource );
|
||||
|
||||
Compile();
|
||||
}
|
||||
|
||||
void cShader::SetSource( const std::string& Source ) {
|
||||
void cShader::Reload() {
|
||||
Init( mType );
|
||||
|
||||
SetSource( mSource );
|
||||
|
||||
Compile();
|
||||
}
|
||||
|
||||
void cShader::SetSource( const std::string& Source ) {
|
||||
if ( IsCompiled() ) {
|
||||
cLog::instance()->Write( "Can't set source for compiled shaders" );
|
||||
return;
|
||||
}
|
||||
|
||||
mSource = Source;
|
||||
|
||||
}
|
||||
|
||||
mSource = Source;
|
||||
|
||||
const char * src = reinterpret_cast<const char *> ( &Source[0] );
|
||||
|
||||
glShaderSource( mGLId, 1, &src, NULL );
|
||||
}
|
||||
|
||||
void cShader::SetSource( const Uint8 * Data, const Uint32& DataSize ) {
|
||||
void cShader::SetSource( const Uint8 * Data, const Uint32& DataSize ) {
|
||||
std::string _dst( DataSize, 0 );
|
||||
|
||||
memcpy( reinterpret_cast<void*>( &_dst[0] ), reinterpret_cast<const void*>( &Data[0] ), DataSize );
|
||||
@@ -91,10 +91,10 @@ void cShader::SetSource( const Uint8 * Data, const Uint32& DataSize ) {
|
||||
SetSource( _dst );
|
||||
}
|
||||
|
||||
void cShader::SetSource( const std::vector<Uint8>& Source ) {
|
||||
void cShader::SetSource( const std::vector<Uint8>& Source ) {
|
||||
std::string _dst( Source.size(), 0 );
|
||||
|
||||
memcpy( reinterpret_cast<void*>( &_dst[0] ), reinterpret_cast<const void*>( &Source[0] ), Source.size() );
|
||||
|
||||
memcpy( reinterpret_cast<void*>( &_dst[0] ), reinterpret_cast<const void*>( &Source[0] ), Source.size() );
|
||||
|
||||
SetSource( _dst );
|
||||
}
|
||||
@@ -121,7 +121,7 @@ bool cShader::Compile() {
|
||||
glGetShaderInfoLog( GetId(), logarraysize, &logsize, reinterpret_cast<GLchar*>( &mCompileLog[0] ) );
|
||||
|
||||
cLog::instance()->Write( "Couldn't compile shader. Log follows:" );
|
||||
cLog::instance()->Write( mCompileLog );
|
||||
cLog::instance()->Write( mCompileLog );
|
||||
cLog::instance()->Write( mSource );
|
||||
} else {
|
||||
cLog::instance()->Write( "Shader Loaded Succesfully" );
|
||||
@@ -151,7 +151,7 @@ cVertexShader::cVertexShader( cPack * Pack, const std::string& Filename ) :
|
||||
}
|
||||
|
||||
cFragmentShader::cFragmentShader() :
|
||||
cShader(GL_FRAGMENT_SHADER)
|
||||
cShader( GL_FRAGMENT_SHADER )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user