More code formatting
This commit is contained in:
parent
9bc2bb2651
commit
5a7604cbb4
|
@ -50,24 +50,29 @@ OPENGL_COMPOSITOR::~OPENGL_COMPOSITOR()
|
||||||
clean();
|
clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void OPENGL_COMPOSITOR::SetAntialiasingMode( OPENGL_ANTIALIASING_MODE aMode )
|
void OPENGL_COMPOSITOR::SetAntialiasingMode( OPENGL_ANTIALIASING_MODE aMode )
|
||||||
{
|
{
|
||||||
m_currentAntialiasingMode = aMode;
|
m_currentAntialiasingMode = aMode;
|
||||||
|
|
||||||
if( m_initialized )
|
if( m_initialized )
|
||||||
clean();
|
clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
OPENGL_ANTIALIASING_MODE OPENGL_COMPOSITOR::GetAntialiasingMode() const
|
OPENGL_ANTIALIASING_MODE OPENGL_COMPOSITOR::GetAntialiasingMode() const
|
||||||
{
|
{
|
||||||
return m_currentAntialiasingMode;
|
return m_currentAntialiasingMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void OPENGL_COMPOSITOR::Initialize()
|
void OPENGL_COMPOSITOR::Initialize()
|
||||||
{
|
{
|
||||||
if( m_initialized )
|
if( m_initialized )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch(m_currentAntialiasingMode) {
|
switch( m_currentAntialiasingMode )
|
||||||
|
{
|
||||||
case OPENGL_ANTIALIASING_MODE::NONE:
|
case OPENGL_ANTIALIASING_MODE::NONE:
|
||||||
m_antialiasing.reset( new ANTIALIASING_NONE( this ) );
|
m_antialiasing.reset( new ANTIALIASING_NONE( this ) );
|
||||||
break;
|
break;
|
||||||
|
@ -117,6 +122,8 @@ void OPENGL_COMPOSITOR::Initialize()
|
||||||
|
|
||||||
void OPENGL_COMPOSITOR::Resize( unsigned int aWidth, unsigned int aHeight )
|
void OPENGL_COMPOSITOR::Resize( unsigned int aWidth, unsigned int aHeight )
|
||||||
{
|
{
|
||||||
|
assert( aWidth > 0 && aHeight > 0 );
|
||||||
|
|
||||||
if( m_initialized )
|
if( m_initialized )
|
||||||
clean();
|
clean();
|
||||||
|
|
||||||
|
@ -126,11 +133,13 @@ void OPENGL_COMPOSITOR::Resize( unsigned int aWidth, unsigned int aHeight )
|
||||||
m_height = aHeight;
|
m_height = aHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned int OPENGL_COMPOSITOR::CreateBuffer()
|
unsigned int OPENGL_COMPOSITOR::CreateBuffer()
|
||||||
{
|
{
|
||||||
return m_antialiasing->CreateBuffer();
|
return m_antialiasing->CreateBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned int OPENGL_COMPOSITOR::CreateBuffer( VECTOR2U aDimensions )
|
unsigned int OPENGL_COMPOSITOR::CreateBuffer( VECTOR2U aDimensions )
|
||||||
{
|
{
|
||||||
assert( m_initialized );
|
assert( m_initialized );
|
||||||
|
@ -241,12 +250,14 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer( VECTOR2U aDimensions )
|
||||||
return usedBuffers();
|
return usedBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GLenum OPENGL_COMPOSITOR::GetBufferTexture( unsigned int aBufferHandle )
|
GLenum OPENGL_COMPOSITOR::GetBufferTexture( unsigned int aBufferHandle )
|
||||||
{
|
{
|
||||||
assert( aBufferHandle > 0 && aBufferHandle <= usedBuffers() );
|
assert( aBufferHandle > 0 && aBufferHandle <= usedBuffers() );
|
||||||
return m_buffers[aBufferHandle - 1].textureTarget;
|
return m_buffers[aBufferHandle - 1].textureTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void OPENGL_COMPOSITOR::SetBuffer( unsigned int aBufferHandle )
|
void OPENGL_COMPOSITOR::SetBuffer( unsigned int aBufferHandle )
|
||||||
{
|
{
|
||||||
assert( m_initialized );
|
assert( m_initialized );
|
||||||
|
@ -264,13 +275,14 @@ void OPENGL_COMPOSITOR::SetBuffer( unsigned int aBufferHandle )
|
||||||
|
|
||||||
glViewport( 0, 0,
|
glViewport( 0, 0,
|
||||||
m_buffers[m_curBuffer].dimensions.x, m_buffers[m_curBuffer].dimensions.y );
|
m_buffers[m_curBuffer].dimensions.x, m_buffers[m_curBuffer].dimensions.y );
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
glViewport( 0, 0, GetScreenSize().x, GetScreenSize().y );
|
glViewport( 0, 0, GetScreenSize().x, GetScreenSize().y );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void OPENGL_COMPOSITOR::ClearBuffer()
|
void OPENGL_COMPOSITOR::ClearBuffer()
|
||||||
{
|
{
|
||||||
assert( m_initialized );
|
assert( m_initialized );
|
||||||
|
@ -279,21 +291,25 @@ void OPENGL_COMPOSITOR::ClearBuffer()
|
||||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
|
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VECTOR2U OPENGL_COMPOSITOR::GetScreenSize() const
|
VECTOR2U OPENGL_COMPOSITOR::GetScreenSize() const
|
||||||
{
|
{
|
||||||
return { m_width, m_height };
|
return { m_width, m_height };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void OPENGL_COMPOSITOR::Begin()
|
void OPENGL_COMPOSITOR::Begin()
|
||||||
{
|
{
|
||||||
m_antialiasing->Begin();
|
m_antialiasing->Begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void OPENGL_COMPOSITOR::DrawBuffer( unsigned int aBufferHandle )
|
void OPENGL_COMPOSITOR::DrawBuffer( unsigned int aBufferHandle )
|
||||||
{
|
{
|
||||||
m_antialiasing->DrawBuffer( aBufferHandle );
|
m_antialiasing->DrawBuffer( aBufferHandle );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void OPENGL_COMPOSITOR::DrawBuffer( unsigned int aSourceHandle, unsigned int aDestHandle )
|
void OPENGL_COMPOSITOR::DrawBuffer( unsigned int aSourceHandle, unsigned int aDestHandle )
|
||||||
{
|
{
|
||||||
assert( m_initialized );
|
assert( m_initialized );
|
||||||
|
@ -340,12 +356,15 @@ void OPENGL_COMPOSITOR::DrawBuffer( unsigned int aSourceHandle, unsigned int aDe
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void OPENGL_COMPOSITOR::Present()
|
void OPENGL_COMPOSITOR::Present()
|
||||||
{
|
{
|
||||||
m_antialiasing->Present();
|
m_antialiasing->Present();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OPENGL_COMPOSITOR::bindFb( unsigned int aFb ) {
|
|
||||||
|
void OPENGL_COMPOSITOR::bindFb( unsigned int aFb )
|
||||||
|
{
|
||||||
// Currently there are only 2 valid FBOs
|
// Currently there are only 2 valid FBOs
|
||||||
assert( aFb == DIRECT_RENDERING || aFb == m_mainFbo );
|
assert( aFb == DIRECT_RENDERING || aFb == m_mainFbo );
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,8 @@ OPENGL_GAL::OPENGL_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent,
|
||||||
|
|
||||||
++instanceCounter;
|
++instanceCounter;
|
||||||
|
|
||||||
// Check if OpenGL requirements are met
|
// Check if OpenGL requirements are met. The test procedure also initializes a few parts
|
||||||
|
// of the OpenGL backend (e.g. GLEW), so it is required that it is invoked before any GL calls.
|
||||||
runTest();
|
runTest();
|
||||||
|
|
||||||
// Make VBOs use shaders
|
// Make VBOs use shaders
|
||||||
|
|
|
@ -157,7 +157,7 @@ void SHADER::SetParameter( int parameterNumber, float f0, float f1, float f2, fl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int SHADER::GetAttribute( std::string aAttributeName ) const
|
int SHADER::GetAttribute( const std::string& aAttributeName ) const
|
||||||
{
|
{
|
||||||
return glGetAttribLocation( programNumber, aAttributeName.c_str() );
|
return glGetAttribLocation( programNumber, aAttributeName.c_str() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,8 @@ public:
|
||||||
virtual bool IsInitialized() const override { return IsShownOnScreen(); }
|
virtual bool IsInitialized() const override { return IsShownOnScreen(); }
|
||||||
|
|
||||||
///> @copydoc GAL::IsVisible()
|
///> @copydoc GAL::IsVisible()
|
||||||
bool IsVisible() const override {
|
bool IsVisible() const override
|
||||||
|
{
|
||||||
return IsShownOnScreen();
|
return IsShownOnScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -190,7 +190,7 @@ public:
|
||||||
* @param aAttributeName is the name of the attribute.
|
* @param aAttributeName is the name of the attribute.
|
||||||
* @return the location.
|
* @return the location.
|
||||||
*/
|
*/
|
||||||
int GetAttribute( std::string aAttributeName ) const;
|
int GetAttribute( const std::string& aAttributeName ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read the shader source file
|
* @brief Read the shader source file
|
||||||
|
|
Loading…
Reference in New Issue