Commit fbc3d63c authored by Maciej Suminski's avatar Maciej Suminski

Draw the origin marker in OpenGL with shaders GAL.

parent 978b548c
...@@ -97,13 +97,12 @@ void GAL::DrawGrid() ...@@ -97,13 +97,12 @@ void GAL::DrawGrid()
double width = gridLineWidth / worldScale; double width = gridLineWidth / worldScale;
double doubleWidth = 2 * width; double doubleWidth = 2 * width;
// Set line width & color SetLayerDepth( 0.0 );
SetLineWidth( width );
double origSize = (double) gridOriginMarkerSize / worldScale;
// Draw the origin marker // Draw the origin marker
double origSize = (double) gridOriginMarkerSize / worldScale;
SetStrokeColor( COLOR4D( 1.0, 1.0, 1.0, 1.0 ) ); SetStrokeColor( COLOR4D( 1.0, 1.0, 1.0, 1.0 ) );
SetLineWidth( width );
SetIsFill( false ); SetIsFill( false );
DrawLine( gridOrigin + VECTOR2D( -origSize, -origSize ), gridOrigin + VECTOR2D( origSize, origSize ) ); DrawLine( gridOrigin + VECTOR2D( -origSize, -origSize ), gridOrigin + VECTOR2D( origSize, origSize ) );
DrawLine( gridOrigin + VECTOR2D( -origSize, origSize ), gridOrigin + VECTOR2D( origSize, -origSize ) ); DrawLine( gridOrigin + VECTOR2D( -origSize, origSize ), gridOrigin + VECTOR2D( origSize, -origSize ) );
......
...@@ -113,20 +113,18 @@ OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener, ...@@ -113,20 +113,18 @@ OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
InitTesselatorCallbacks( tesselator ); InitTesselatorCallbacks( tesselator );
gluTessProperty( tesselator, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_POSITIVE ); gluTessProperty( tesselator, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_POSITIVE );
if( !isUseShader ) // Buffered semicircle & circle vertices
{ // (3 vertices per triangle) * (2 items [circle&semicircle]) * (number of points per item)
// (3 vertices per triangle) * (2 items [circle&semicircle]) * (number of points per item) precomputedContainer = new VBO_CONTAINER( 3 * 2 * CIRCLE_POINTS );
precomputedContainer = new VBO_CONTAINER( 3 * 2 * CIRCLE_POINTS );
// Compute the unit circles, used for speed up of the circle drawing
// Compute the unit circles, used for speed up of the circle drawing verticesCircle = new VBO_ITEM( precomputedContainer );
verticesCircle = new VBO_ITEM( precomputedContainer ); computeUnitCircle();
computeUnitCircle(); verticesCircle->Finish();
verticesCircle->Finish();
verticesSemiCircle = new VBO_ITEM( precomputedContainer );
verticesSemiCircle = new VBO_ITEM( precomputedContainer ); computeUnitSemiCircle();
computeUnitSemiCircle(); verticesSemiCircle->Finish();
verticesSemiCircle->Finish();
}
} }
...@@ -134,12 +132,9 @@ OPENGL_GAL::~OPENGL_GAL() ...@@ -134,12 +132,9 @@ OPENGL_GAL::~OPENGL_GAL()
{ {
glFlush(); glFlush();
if( !isUseShader ) delete verticesCircle;
{ delete verticesSemiCircle;
delete verticesCircle; delete precomputedContainer;
delete verticesSemiCircle;
delete precomputedContainer;
}
// Delete the buffers // Delete the buffers
if( isFrameBufferInitialized ) if( isFrameBufferInitialized )
...@@ -449,8 +444,6 @@ void OPENGL_GAL::BeginDrawing() ...@@ -449,8 +444,6 @@ void OPENGL_GAL::BeginDrawing()
void OPENGL_GAL::blitMainTexture( bool aIsClearFrameBuffer ) void OPENGL_GAL::blitMainTexture( bool aIsClearFrameBuffer )
{ {
shader.Deactivate();
// Don't use blending for the final blitting // Don't use blending for the final blitting
glDisable( GL_BLEND ); glDisable( GL_BLEND );
...@@ -606,7 +599,7 @@ inline void OPENGL_GAL::drawLineQuad( const VECTOR2D& aStartPoint, const VECTOR2 ...@@ -606,7 +599,7 @@ inline void OPENGL_GAL::drawLineQuad( const VECTOR2D& aStartPoint, const VECTOR2
begin( GL_TRIANGLES ); begin( GL_TRIANGLES );
if( isUseShader ) if( isUseShader && isGrouping )
{ {
glm::vec4 vector( perpendicularVector.x, perpendicularVector.y, 0.0, 0.0 ); glm::vec4 vector( perpendicularVector.x, perpendicularVector.y, 0.0, 0.0 );
...@@ -1026,7 +1019,7 @@ void OPENGL_GAL::DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEn ...@@ -1026,7 +1019,7 @@ void OPENGL_GAL::DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEn
void OPENGL_GAL::DrawCircle( const VECTOR2D& aCenterPoint, double aRadius ) void OPENGL_GAL::DrawCircle( const VECTOR2D& aCenterPoint, double aRadius )
{ {
if( isUseShader ) if( isUseShader && isGrouping )
{ {
if( isFillEnabled ) if( isFillEnabled )
{ {
...@@ -1161,7 +1154,7 @@ void OPENGL_GAL::DrawCircle( const VECTOR2D& aCenterPoint, double aRadius ) ...@@ -1161,7 +1154,7 @@ void OPENGL_GAL::DrawCircle( const VECTOR2D& aCenterPoint, double aRadius )
void OPENGL_GAL::drawSemiCircle( const VECTOR2D& aCenterPoint, double aRadius, double aAngle ) void OPENGL_GAL::drawSemiCircle( const VECTOR2D& aCenterPoint, double aRadius, double aAngle )
{ {
if( isUseShader ) if( isUseShader && isGrouping )
{ {
Save(); Save();
Translate( aCenterPoint ); Translate( aCenterPoint );
...@@ -1924,9 +1917,6 @@ void OPENGL_GAL::DrawGridLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEnd ...@@ -1924,9 +1917,6 @@ void OPENGL_GAL::DrawGridLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEnd
VECTOR2D point3 = aEndPoint + perpendicularVector; VECTOR2D point3 = aEndPoint + perpendicularVector;
VECTOR2D point4 = aEndPoint - perpendicularVector; VECTOR2D point4 = aEndPoint - perpendicularVector;
if( isUseShader )
shader.Deactivate();
// Set color // Set color
glColor4d( gridColor.r, gridColor.g, gridColor.b, gridColor.a ); glColor4d( gridColor.r, gridColor.g, gridColor.b, gridColor.a );
......
...@@ -409,7 +409,6 @@ private: ...@@ -409,7 +409,6 @@ private:
bool isFrameBufferInitialized; ///< Are the frame buffers initialized? bool isFrameBufferInitialized; ///< Are the frame buffers initialized?
bool isVboInitialized; bool isVboInitialized;
bool isShaderInitialized; ///< Was the shader initialized? bool isShaderInitialized; ///< Was the shader initialized?
bool isShaderEnabled; ///< Are the shaders enabled?
bool isUseShader; ///< Should the shaders be used? bool isUseShader; ///< Should the shaders be used?
bool isGrouping; ///< Was a group started? bool isGrouping; ///< Was a group started?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment