Commit fbc3d63c authored by Maciej Suminski's avatar Maciej Suminski
Browse files

Draw the origin marker in OpenGL with shaders GAL.

parent 978b548c
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -97,13 +97,12 @@ void GAL::DrawGrid()
    double  width = gridLineWidth / worldScale;
    double  doubleWidth = 2 * width;

    // Set line width & color
    SetLineWidth( width );

    double origSize = (double) gridOriginMarkerSize / worldScale;
    SetLayerDepth( 0.0 );

    // Draw the origin marker
    double origSize = (double) gridOriginMarkerSize / worldScale;
    SetStrokeColor( COLOR4D( 1.0, 1.0, 1.0, 1.0 ) );
    SetLineWidth( width );
    SetIsFill( false );
    DrawLine( gridOrigin + VECTOR2D( -origSize, -origSize ), gridOrigin + VECTOR2D( origSize, origSize ) );
    DrawLine( gridOrigin + VECTOR2D( -origSize, origSize ),  gridOrigin + VECTOR2D( origSize, -origSize ) );
+18 −28
Original line number Diff line number Diff line
@@ -113,8 +113,7 @@ OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
    InitTesselatorCallbacks( tesselator );
    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)
    precomputedContainer = new VBO_CONTAINER( 3 * 2 * CIRCLE_POINTS );

@@ -127,19 +126,15 @@ OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
    computeUnitSemiCircle();
    verticesSemiCircle->Finish();
}
}


OPENGL_GAL::~OPENGL_GAL()
{
    glFlush();

    if( !isUseShader )
    {
    delete verticesCircle;
    delete verticesSemiCircle;
    delete precomputedContainer;
    }

    // Delete the buffers
    if( isFrameBufferInitialized )
@@ -449,8 +444,6 @@ void OPENGL_GAL::BeginDrawing()

void OPENGL_GAL::blitMainTexture( bool aIsClearFrameBuffer )
{
    shader.Deactivate();

    // Don't use blending for the final blitting
    glDisable( GL_BLEND );

@@ -606,7 +599,7 @@ inline void OPENGL_GAL::drawLineQuad( const VECTOR2D& aStartPoint, const VECTOR2

    begin( GL_TRIANGLES );

    if( isUseShader )
    if( isUseShader && isGrouping )
    {
        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

void OPENGL_GAL::DrawCircle( const VECTOR2D& aCenterPoint, double aRadius )
{
    if( isUseShader )
    if( isUseShader && isGrouping )
    {
        if( isFillEnabled )
        {
@@ -1161,7 +1154,7 @@ void OPENGL_GAL::DrawCircle( const VECTOR2D& aCenterPoint, double aRadius )

void OPENGL_GAL::drawSemiCircle( const VECTOR2D& aCenterPoint, double aRadius, double aAngle )
{
    if( isUseShader )
    if( isUseShader && isGrouping )
    {
        Save();
        Translate( aCenterPoint );
@@ -1924,9 +1917,6 @@ void OPENGL_GAL::DrawGridLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEnd
    VECTOR2D point3 = aEndPoint + perpendicularVector;
    VECTOR2D point4 = aEndPoint - perpendicularVector;

    if( isUseShader )
        shader.Deactivate();

    // Set color
    glColor4d( gridColor.r, gridColor.g, gridColor.b, gridColor.a );

+0 −1
Original line number Diff line number Diff line
@@ -409,7 +409,6 @@ private:
    bool            isFrameBufferInitialized;   ///< Are the frame buffers initialized?
    bool            isVboInitialized;
    bool            isShaderInitialized;        ///< Was the shader initialized?
    bool            isShaderEnabled;            ///< Are the shaders enabled?
    bool            isUseShader;                ///< Should the shaders be used?
    bool            isGrouping;                 ///< Was a group started?