Loading common/gal/opengl/opengl_gal.cpp +119 −64 Original line number Original line Diff line number Diff line Loading @@ -387,13 +387,18 @@ void OPENGL_GAL::blitMainTexture( bool aIsClearFrameBuffer ) glMatrixMode( GL_PROJECTION ); glMatrixMode( GL_PROJECTION ); glPushMatrix(); glPushMatrix(); glLoadIdentity(); glLoadIdentity(); glBegin( GL_QUADS ); glBegin( GL_TRIANGLES ); glTexCoord2i( 0, 1 ); glTexCoord2i( 0, 1 ); glVertex3i( -1, -1, 0 ); glVertex3i( -1, -1, 0 ); glTexCoord2i( 1, 1 ); glTexCoord2i( 1, 1 ); glVertex3i( 1, -1, 0 ); glVertex3i( 1, -1, 0 ); glTexCoord2i( 1, 0 ); glTexCoord2i( 1, 0 ); glVertex3i( 1, 1, 0 ); glVertex3i( 1, 1, 0 ); glTexCoord2i( 0, 1 ); glVertex3i( -1, -1, 0 ); glTexCoord2i( 1, 0 ); glVertex3i( 1, 1, 0 ); glTexCoord2i( 0, 0 ); glTexCoord2i( 0, 0 ); glVertex3i( -1, 1, 0 ); glVertex3i( -1, 1, 0 ); glEnd(); glEnd(); Loading Loading @@ -463,7 +468,7 @@ void OPENGL_GAL::drawRoundedSegment( const VECTOR2D& aStartPoint, const VECTOR2D selectShader( 0 ); selectShader( 0 ); if( aGlBegin ) if( aGlBegin ) glBegin( GL_QUADS ); glBegin( GL_QUADS ); // shader glNormal3d( aspect, 0, 0 ); glNormal3d( aspect, 0, 0 ); glTexCoord2f( 0.0, 0.0 ); glTexCoord2f( 0.0, 0.0 ); Loading Loading @@ -506,10 +511,13 @@ inline void OPENGL_GAL::drawLineQuad( const VECTOR2D& aStartPoint, const VECTOR2 VECTOR2D point3 = aEndPoint + perpendicularVector; VECTOR2D point3 = aEndPoint + perpendicularVector; VECTOR2D point4 = aEndPoint - perpendicularVector; VECTOR2D point4 = aEndPoint - perpendicularVector; glBegin( GL_QUADS ); glBegin( GL_TRIANGLES ); glVertex3d( point1.x, point1.y, layerDepth ); glVertex3d( point1.x, point1.y, layerDepth ); glVertex3d( point2.x, point2.y, layerDepth ); glVertex3d( point2.x, point2.y, layerDepth ); glVertex3d( point4.x, point4.y, layerDepth ); glVertex3d( point4.x, point4.y, layerDepth ); glVertex3d( point1.x, point1.y, layerDepth ); glVertex3d( point4.x, point4.y, layerDepth ); glVertex3d( point3.x, point3.y, layerDepth ); glVertex3d( point3.x, point3.y, layerDepth ); glEnd(); glEnd(); } } Loading Loading @@ -687,21 +695,21 @@ void OPENGL_GAL::DrawPolyline( std::deque<VECTOR2D>& aPointList ) } } // Now draw the fan // Now draw the fan glBegin( GL_TRIANGLE_FAN ); glBegin( GL_TRIANGLES ); SWAP( angle1, >, angle2 ); for( double a = angle1; a < angle2; ) { glVertex3d( lastPoint.x, lastPoint.y, layerDepth ); glVertex3d( lastPoint.x, lastPoint.y, layerDepth ); glVertex3d( lastPoint.x + adjust * sin( a ), lastPoint.y - adjust * cos( a ), layerDepth ); SWAP( angle1, >, angle2 ); a += M_PI / 32; if(a > angle2) a = angle2; glVertex3d( lastPoint.x + adjust * sin( angle1 ), lastPoint.y - adjust * cos( angle1 ), layerDepth ); for( double a = angle1 + M_PI / 32; a < angle2; a += M_PI / 32 ) { glVertex3d( lastPoint.x + adjust * sin( a ), glVertex3d( lastPoint.x + adjust * sin( a ), lastPoint.y - adjust * cos( a ), layerDepth ); lastPoint.y - adjust * cos( a ), layerDepth ); } } glVertex3d( lastPoint.x + adjust * sin( angle2 ), lastPoint.y - adjust * cos( angle2 ), layerDepth ); glEnd(); glEnd(); break; break; } } Loading Loading @@ -744,7 +752,6 @@ void OPENGL_GAL::DrawPolyline( std::deque<VECTOR2D>& aPointList ) { { point1 = lastPoint + perpendicularVector1; point1 = lastPoint + perpendicularVector1; point3 = lastPoint + perpendicularVector2; point3 = lastPoint + perpendicularVector2; } } VECTOR2D point2 = point1 - lastStartEndVector; VECTOR2D point2 = point1 - lastStartEndVector; Loading @@ -767,10 +774,17 @@ void OPENGL_GAL::DrawPolyline( std::deque<VECTOR2D>& aPointList ) double limit = MITER_LIMIT * lineWidth; double limit = MITER_LIMIT * lineWidth; VECTOR2D mp1 = point1 + ( limit / lineLengthA ) * lastStartEndVector; VECTOR2D mp1 = point1 + ( limit / lineLengthA ) * lastStartEndVector; VECTOR2D mp2 = point3 - ( limit / lineLengthB ) * startEndVector; VECTOR2D mp2 = point3 - ( limit / lineLengthB ) * startEndVector; glBegin( GL_TRIANGLE_FAN ); glBegin( GL_TRIANGLES ); glVertex3d( lastPoint.x, lastPoint.y, layerDepth ); glVertex3d( lastPoint.x, lastPoint.y, layerDepth ); glVertex3d( point1.x, point1.y, layerDepth ); glVertex3d( point1.x, point1.y, layerDepth ); glVertex3d( mp1.x, mp1.y, layerDepth ); glVertex3d( mp1.x, mp1.y, layerDepth ); glVertex3d( lastPoint.x, lastPoint.y, layerDepth ); glVertex3d( mp1.x, mp1.y, layerDepth ); glVertex3d( mp2.x, mp2.y, layerDepth ); glVertex3d( lastPoint.x, lastPoint.y, layerDepth ); glVertex3d( mp2.x, mp2.y, layerDepth ); glVertex3d( mp2.x, mp2.y, layerDepth ); glVertex3d( point3.x, point3.y, layerDepth ); glVertex3d( point3.x, point3.y, layerDepth ); glEnd(); glEnd(); Loading @@ -778,10 +792,13 @@ void OPENGL_GAL::DrawPolyline( std::deque<VECTOR2D>& aPointList ) else else { { // Insert two triangles for the mitered edge // Insert two triangles for the mitered edge glBegin( GL_TRIANGLE_FAN ); glBegin( GL_TRIANGLES ); glVertex3d( lastPoint.x, lastPoint.y, layerDepth ); glVertex3d( lastPoint.x, lastPoint.y, layerDepth ); glVertex3d( point1.x, point1.y, layerDepth ); glVertex3d( point1.x, point1.y, layerDepth ); glVertex3d( miterPoint.x, miterPoint.y, layerDepth ); glVertex3d( miterPoint.x, miterPoint.y, layerDepth ); glVertex3d( lastPoint.x, lastPoint.y, layerDepth ); glVertex3d( miterPoint.x, miterPoint.y, layerDepth ); glVertex3d( point3.x, point3.y, layerDepth ); glVertex3d( point3.x, point3.y, layerDepth ); glEnd(); glEnd(); } } Loading Loading @@ -819,7 +836,7 @@ void OPENGL_GAL::DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEn { { selectShader( 0 ); selectShader( 0 ); glColor4d( fillColor.r, fillColor.g, fillColor.b, fillColor.a ); glColor4d( fillColor.r, fillColor.g, fillColor.b, fillColor.a ); glBegin( GL_QUADS ); glBegin( GL_QUADS ); // shader glNormal3d( 1.0, 0, 0); glNormal3d( 1.0, 0, 0); glTexCoord2f(0.0, 0.0); glTexCoord2f(0.0, 0.0); glVertex3d( aStartPoint.x, aStartPoint.y, layerDepth ); glVertex3d( aStartPoint.x, aStartPoint.y, layerDepth ); Loading @@ -834,15 +851,14 @@ void OPENGL_GAL::DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEn glVertex3d( diagonalPointB.x, diagonalPointB.y, layerDepth ); glVertex3d( diagonalPointB.x, diagonalPointB.y, layerDepth ); glEnd(); glEnd(); } } if(isStrokeEnabled) if(isStrokeEnabled) { { glBegin(GL_QUADS); glBegin( GL_QUADS ); // shader drawRoundedSegment(aStartPoint, diagonalPointA, lineWidth, true, false ); drawRoundedSegment(aStartPoint, diagonalPointA, lineWidth, true, false ); drawRoundedSegment(aEndPoint, diagonalPointA, lineWidth, true, false ); drawRoundedSegment(aEndPoint, diagonalPointA, lineWidth, true, false ); drawRoundedSegment(aStartPoint, diagonalPointB, lineWidth, true, false ); drawRoundedSegment(aStartPoint, diagonalPointB, lineWidth, true, false ); drawRoundedSegment(aEndPoint, diagonalPointB, lineWidth, true, false ); drawRoundedSegment(aEndPoint, diagonalPointB, lineWidth, true, false ); glEnd(); glEnd(); } } Loading @@ -868,10 +884,13 @@ void OPENGL_GAL::DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEn if( isFillEnabled ) if( isFillEnabled ) { { glColor4d( fillColor.r, fillColor.g, fillColor.b, fillColor.a ); glColor4d( fillColor.r, fillColor.g, fillColor.b, fillColor.a ); glBegin( GL_QUADS ); glBegin( GL_TRIANGLES ); glVertex3d( aStartPoint.x, aStartPoint.y, layerDepth ); glVertex3d( aStartPoint.x, aStartPoint.y, layerDepth ); glVertex3d( diagonalPointA.x, diagonalPointA.y, layerDepth ); glVertex3d( diagonalPointA.x, diagonalPointA.y, layerDepth ); glVertex3d( aEndPoint.x, aEndPoint.y, layerDepth ); glVertex3d( aEndPoint.x, aEndPoint.y, layerDepth ); glVertex3d( aStartPoint.x, aStartPoint.y, layerDepth ); glVertex3d( aEndPoint.x, aEndPoint.y, layerDepth ); glVertex3d( diagonalPointB.x, diagonalPointB.y, layerDepth ); glVertex3d( diagonalPointB.x, diagonalPointB.y, layerDepth ); glEnd(); glEnd(); } } Loading Loading @@ -919,12 +938,22 @@ void OPENGL_GAL::DrawCircle( const VECTOR2D& aCenterPoint, double aRadius ) glTranslated( aCenterPoint.x, aCenterPoint.y, 0.0 ); glTranslated( aCenterPoint.x, aCenterPoint.y, 0.0 ); glScaled( aRadius, aRadius, 1.0 ); glScaled( aRadius, aRadius, 1.0 ); glBegin( GL_QUAD_STRIP ); glBegin( GL_TRIANGLES ); for( std::deque<VECTOR2D>::const_iterator it = unitCirclePoints.begin(); for( std::deque<VECTOR2D>::const_iterator it = unitCirclePoints.begin(); it != unitCirclePoints.end(); it++ ) it != unitCirclePoints.end(); it++ ) { { glVertex3d( it->x * innerScale, it->y * innerScale, layerDepth ); double v0[] = { it->x * innerScale, it->y * innerScale }; glVertex3d( it->x * outerScale, it->y * outerScale, layerDepth ); double v1[] = { it->x * outerScale, it->y * outerScale }; double v2[] = { ( it + 1 )->x * innerScale, ( it + 1 )->y * innerScale }; double v3[] = { ( it + 1 )->x * outerScale, ( it + 1 )->y * outerScale }; glVertex3d( v0[0], v0[1], layerDepth ); glVertex3d( v1[0], v1[1], layerDepth ); glVertex3d( v2[0], v2[1], layerDepth ); glVertex3d( v1[0], v1[1], layerDepth ); glVertex3d( v3[0], v3[1], layerDepth ); glVertex3d( v2[0], v2[1], layerDepth ); } } glEnd(); glEnd(); Loading Loading @@ -988,7 +1017,6 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double a VECTOR2D startEndPoint = startPoint + endPoint; VECTOR2D startEndPoint = startPoint + endPoint; VECTOR2D middlePoint = 0.5 * startEndPoint; VECTOR2D middlePoint = 0.5 * startEndPoint; glPushMatrix(); glPushMatrix(); glTranslated( aCenterPoint.x, aCenterPoint.y, layerDepth ); glTranslated( aCenterPoint.x, aCenterPoint.y, layerDepth ); glScaled( aRadius, aRadius, 1.0 ); glScaled( aRadius, aRadius, 1.0 ); Loading @@ -1015,7 +1043,7 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double a VECTOR2D p( cos( aStartAngle ), sin( aStartAngle ) ); VECTOR2D p( cos( aStartAngle ), sin( aStartAngle ) ); glBegin( GL_QUADS ); glBegin( GL_QUADS ); // shader for( int i = 0; i < n_points; i++ ) for( int i = 0; i < n_points; i++ ) { { VECTOR2D p_next( p.x * cosI - p.y * sinI, p.x * sinI + p.y * cosI ); VECTOR2D p_next( p.x * cosI - p.y * sinI, p.x * sinI + p.y * cosI ); Loading @@ -1027,20 +1055,30 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double a } } else else { { double alphaIncrement = 2 * M_PI / CIRCLE_POINTS; glColor4d( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a ); glColor4d( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a ); glBegin( GL_QUAD_STRIP ); glBegin( GL_TRIANGLES ); for( double alpha = aStartAngle; alpha < aEndAngle; ) { double v0[] = { cos( alpha ) * innerScale, sin( alpha ) * innerScale }; double v1[] = { cos( alpha ) * outerScale, sin( alpha ) * outerScale }; double alphaIncrement = 2 * M_PI / CIRCLE_POINTS; alpha += alphaIncrement; if( alpha > aEndAngle ) alpha = aEndAngle; for( double alpha = aStartAngle; alpha < aEndAngle; alpha += alphaIncrement ) double v2[] = { cos( alpha ) * innerScale, sin( alpha ) * innerScale }; { double v3[] = { cos( alpha ) * outerScale, sin( alpha ) * outerScale }; glVertex2d( cos( alpha ) * innerScale, sin( alpha ) * innerScale ); glVertex2d( cos( alpha ) * outerScale, sin( alpha ) * outerScale ); glVertex3d( v0[0], v0[1], layerDepth ); } glVertex3d( v1[0], v1[1], layerDepth ); glVertex3d( v2[0], v2[1], layerDepth ); glVertex2d( cos( aEndAngle ) * innerScale, sin( aEndAngle ) * innerScale ); glVertex3d( v1[0], v1[1], layerDepth ); glVertex2d( cos( aEndAngle ) * outerScale, sin( aEndAngle ) * outerScale ); glVertex3d( v3[0], v3[1], layerDepth ); glVertex3d( v2[0], v2[1], layerDepth ); } glEnd(); glEnd(); Loading @@ -1054,21 +1092,22 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double a if( isFillEnabled ) if( isFillEnabled ) { { glColor4d( fillColor.r, fillColor.g, fillColor.b, fillColor.a ); glBegin( GL_TRIANGLE_FAN ); glVertex2d( middlePoint.x, middlePoint.y ); double alphaIncrement = 2 * M_PI / CIRCLE_POINTS; double alphaIncrement = 2 * M_PI / CIRCLE_POINTS; double alpha; glColor4d( fillColor.r, fillColor.g, fillColor.b, fillColor.a ); for( double alpha = aStartAngle; alpha < aEndAngle; alpha += alphaIncrement ) glBegin( GL_TRIANGLES ); for( alpha = aStartAngle; ( alpha + alphaIncrement ) < aEndAngle; ) { { glVertex2d( middlePoint.x, middlePoint.y ); glVertex2d( cos( alpha ), sin( alpha ) ); alpha += alphaIncrement; glVertex2d( cos( alpha ), sin( alpha ) ); glVertex2d( cos( alpha ), sin( alpha ) ); } } glVertex2d( middlePoint.x, middlePoint.y ); glVertex2d( cos( alpha ), sin( alpha ) ); glVertex2d( endPoint.x, endPoint.y ); glVertex2d( endPoint.x, endPoint.y ); glEnd(); glEnd(); } } Loading @@ -1080,8 +1119,7 @@ struct OGLPOINT { { OGLPOINT() : OGLPOINT() : x( 0.0 ), y( 0.0 ), z( 0.0 ) x( 0.0 ), y( 0.0 ), z( 0.0 ) { {} } OGLPOINT( const char* fastest ) OGLPOINT( const char* fastest ) { { Loading @@ -1090,8 +1128,7 @@ struct OGLPOINT OGLPOINT( const VECTOR2D& aPoint ) : OGLPOINT( const VECTOR2D& aPoint ) : x( aPoint.x ), y( aPoint.y ), z( 0.0 ) x( aPoint.x ), y( aPoint.y ), z( 0.0 ) { {} } OGLPOINT& operator=( const VECTOR2D& aPoint ) OGLPOINT& operator=( const VECTOR2D& aPoint ) { { Loading Loading @@ -1334,17 +1371,25 @@ void OPENGL_GAL::computeUnitArcs() void OPENGL_GAL::computeUnitCircle() void OPENGL_GAL::computeUnitCircle() { { double valueX, valueY; displayListCircle = glGenLists( 1 ); displayListCircle = glGenLists( 1 ); glNewList( displayListCircle, GL_COMPILE ); glNewList( displayListCircle, GL_COMPILE ); glBegin( GL_TRIANGLE_FAN ); glBegin( GL_TRIANGLES ); glVertex2d( 0, 0 ); // Compute the circle points for a given number of segments // Compute the circle points for a given number of segments // Insert in a display list and a vector // Insert in a display list and a vector for( int i = 0; i < CIRCLE_POINTS + 1; i++ ) for( int i = 0; i < CIRCLE_POINTS; i++ ) { { double valueX = cos( 2.0 * M_PI / CIRCLE_POINTS * i ); glVertex2d( 0, 0 ); double valueY = sin( 2.0 * M_PI / CIRCLE_POINTS * i ); valueX = cos( 2.0 * M_PI / CIRCLE_POINTS * i ); valueY = sin( 2.0 * M_PI / CIRCLE_POINTS * i ); glVertex2d( valueX, valueY ); unitCirclePoints.push_back( VECTOR2D( valueX, valueY ) ); valueX = cos( 2.0 * M_PI / CIRCLE_POINTS * ( i + 1 ) ); valueY = sin( 2.0 * M_PI / CIRCLE_POINTS * ( i + 1 ) ); glVertex2d( valueX, valueY ); glVertex2d( valueX, valueY ); unitCirclePoints.push_back( VECTOR2D( valueX, valueY ) ); unitCirclePoints.push_back( VECTOR2D( valueX, valueY ) ); } } Loading @@ -1359,11 +1404,14 @@ void OPENGL_GAL::computeUnitSemiCircle() displayListSemiCircle = glGenLists( 1 ); displayListSemiCircle = glGenLists( 1 ); glNewList( displayListSemiCircle, GL_COMPILE ); glNewList( displayListSemiCircle, GL_COMPILE ); glBegin( GL_TRIANGLE_FAN ); glBegin( GL_TRIANGLES ); glVertex2d( 0, 0 ); for( int i = 0; i < CIRCLE_POINTS / 2; i++ ) for( int i = 0; i < CIRCLE_POINTS / 2 + 1; i++ ) { { glVertex2d( cos( 2.0 * M_PI / CIRCLE_POINTS * i ), sin( 2.0 * M_PI / CIRCLE_POINTS * i ) ); glVertex2d( 0, 0 ); glVertex2d( cos( 2.0 * M_PI / CIRCLE_POINTS * i ), sin( 2.0 * M_PI / CIRCLE_POINTS * i ) ); glVertex2d( cos( 2.0 * M_PI / CIRCLE_POINTS * ( i + 1 ) ), sin( 2.0 * M_PI / CIRCLE_POINTS * ( i + 1 ) ) ); } } glEnd(); glEnd(); Loading Loading @@ -1500,31 +1548,35 @@ void OPENGL_GAL::DrawCursor( VECTOR2D aCursorPosition ) glDisable( GL_TEXTURE_2D ); glDisable( GL_TEXTURE_2D ); glColor4d( cursorColor.r, cursorColor.g, cursorColor.b, cursorColor.a ); glColor4d( cursorColor.r, cursorColor.g, cursorColor.b, cursorColor.a ); glBegin( GL_QUADS ); glBegin( GL_TRIANGLES ); glVertex3f( (int) ( aCursorPosition.x - cursorSize / 2 ) + 1, glVertex3f( (int) ( aCursorPosition.x - cursorSize / 2 ) + 1, (int) ( aCursorPosition.y ), depthRange.x ); (int) ( aCursorPosition.y ), depthRange.x ); glVertex3f( (int) ( aCursorPosition.x + cursorSize / 2 ) + 1, glVertex3f( (int) ( aCursorPosition.x + cursorSize / 2 ) + 1, (int) ( aCursorPosition.y ), depthRange.x ); (int) ( aCursorPosition.y ), depthRange.x ); glVertex3f( (int) ( aCursorPosition.x + cursorSize / 2 ) + 1, glVertex3f( (int) ( aCursorPosition.x + cursorSize / 2 ) + 1, (int) ( aCursorPosition.y + 1 ), depthRange.x ); (int) ( aCursorPosition.y + 1 ), depthRange.x ); glVertex3f( (int) ( aCursorPosition.x - cursorSize / 2 ) + 1, (int) ( aCursorPosition.y ), depthRange.x ); glVertex3f( (int) ( aCursorPosition.x - cursorSize / 2 ) + 1, glVertex3f( (int) ( aCursorPosition.x - cursorSize / 2 ) + 1, (int) ( aCursorPosition.y + 1), depthRange.x ); (int) ( aCursorPosition.y + 1), depthRange.x ); glVertex3f( (int) ( aCursorPosition.x + cursorSize / 2 ) + 1, (int) ( aCursorPosition.y + 1 ), depthRange.x ); glVertex3f( (int) ( aCursorPosition.x ), glVertex3f( (int) ( aCursorPosition.x ), (int) ( aCursorPosition.y - cursorSize / 2 ) + 1, depthRange.x ); (int) ( aCursorPosition.y - cursorSize / 2 ) + 1, depthRange.x ); glVertex3f( (int) ( aCursorPosition.x ), glVertex3f( (int) ( aCursorPosition.x ), (int) ( aCursorPosition.y + cursorSize / 2 ) + 1, depthRange.x ); (int) ( aCursorPosition.y + cursorSize / 2 ) + 1, depthRange.x ); glVertex3f( (int) ( aCursorPosition.x ) + 1, glVertex3f( (int) ( aCursorPosition.x ) + 1, (int) ( aCursorPosition.y + cursorSize / 2 ) + 1, depthRange.x ); (int) ( aCursorPosition.y + cursorSize / 2 ) + 1, depthRange.x ); glVertex3f( (int) ( aCursorPosition.x ), (int) ( aCursorPosition.y - cursorSize / 2 ) + 1, depthRange.x ); glVertex3f( (int) ( aCursorPosition.x ) + 1, glVertex3f( (int) ( aCursorPosition.x ) + 1, (int) ( aCursorPosition.y - cursorSize / 2 ) + 1, depthRange.x ); (int) ( aCursorPosition.y - cursorSize / 2 ) + 1, depthRange.x ); glVertex3f( (int) ( aCursorPosition.x ) + 1, (int) ( aCursorPosition.y + cursorSize / 2 ) + 1, depthRange.x ); glEnd(); glEnd(); // Blit the current screen contents // Blit the current screen contents Loading Loading @@ -1559,11 +1611,14 @@ void OPENGL_GAL::DrawGridLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEnd glColor4d( gridColor.r, gridColor.g, gridColor.b, gridColor.a ); glColor4d( gridColor.r, gridColor.g, gridColor.b, gridColor.a ); // Draw the quad for the grid line // Draw the quad for the grid line glBegin( GL_QUADS ); glBegin( GL_TRIANGLES ); double gridDepth = depthRange.y * 0.75; double gridDepth = depthRange.y * 0.75; glVertex3d( point1.x, point1.y, gridDepth ); glVertex3d( point1.x, point1.y, gridDepth ); glVertex3d( point2.x, point2.y, gridDepth ); glVertex3d( point2.x, point2.y, gridDepth ); glVertex3d( point4.x, point4.y, gridDepth ); glVertex3d( point4.x, point4.y, gridDepth ); glVertex3d( point1.x, point1.y, gridDepth ); glVertex3d( point4.x, point4.y, gridDepth ); glVertex3d( point3.x, point3.y, gridDepth ); glVertex3d( point3.x, point3.y, gridDepth ); glEnd(); glEnd(); } } Loading Loading
common/gal/opengl/opengl_gal.cpp +119 −64 Original line number Original line Diff line number Diff line Loading @@ -387,13 +387,18 @@ void OPENGL_GAL::blitMainTexture( bool aIsClearFrameBuffer ) glMatrixMode( GL_PROJECTION ); glMatrixMode( GL_PROJECTION ); glPushMatrix(); glPushMatrix(); glLoadIdentity(); glLoadIdentity(); glBegin( GL_QUADS ); glBegin( GL_TRIANGLES ); glTexCoord2i( 0, 1 ); glTexCoord2i( 0, 1 ); glVertex3i( -1, -1, 0 ); glVertex3i( -1, -1, 0 ); glTexCoord2i( 1, 1 ); glTexCoord2i( 1, 1 ); glVertex3i( 1, -1, 0 ); glVertex3i( 1, -1, 0 ); glTexCoord2i( 1, 0 ); glTexCoord2i( 1, 0 ); glVertex3i( 1, 1, 0 ); glVertex3i( 1, 1, 0 ); glTexCoord2i( 0, 1 ); glVertex3i( -1, -1, 0 ); glTexCoord2i( 1, 0 ); glVertex3i( 1, 1, 0 ); glTexCoord2i( 0, 0 ); glTexCoord2i( 0, 0 ); glVertex3i( -1, 1, 0 ); glVertex3i( -1, 1, 0 ); glEnd(); glEnd(); Loading Loading @@ -463,7 +468,7 @@ void OPENGL_GAL::drawRoundedSegment( const VECTOR2D& aStartPoint, const VECTOR2D selectShader( 0 ); selectShader( 0 ); if( aGlBegin ) if( aGlBegin ) glBegin( GL_QUADS ); glBegin( GL_QUADS ); // shader glNormal3d( aspect, 0, 0 ); glNormal3d( aspect, 0, 0 ); glTexCoord2f( 0.0, 0.0 ); glTexCoord2f( 0.0, 0.0 ); Loading Loading @@ -506,10 +511,13 @@ inline void OPENGL_GAL::drawLineQuad( const VECTOR2D& aStartPoint, const VECTOR2 VECTOR2D point3 = aEndPoint + perpendicularVector; VECTOR2D point3 = aEndPoint + perpendicularVector; VECTOR2D point4 = aEndPoint - perpendicularVector; VECTOR2D point4 = aEndPoint - perpendicularVector; glBegin( GL_QUADS ); glBegin( GL_TRIANGLES ); glVertex3d( point1.x, point1.y, layerDepth ); glVertex3d( point1.x, point1.y, layerDepth ); glVertex3d( point2.x, point2.y, layerDepth ); glVertex3d( point2.x, point2.y, layerDepth ); glVertex3d( point4.x, point4.y, layerDepth ); glVertex3d( point4.x, point4.y, layerDepth ); glVertex3d( point1.x, point1.y, layerDepth ); glVertex3d( point4.x, point4.y, layerDepth ); glVertex3d( point3.x, point3.y, layerDepth ); glVertex3d( point3.x, point3.y, layerDepth ); glEnd(); glEnd(); } } Loading Loading @@ -687,21 +695,21 @@ void OPENGL_GAL::DrawPolyline( std::deque<VECTOR2D>& aPointList ) } } // Now draw the fan // Now draw the fan glBegin( GL_TRIANGLE_FAN ); glBegin( GL_TRIANGLES ); SWAP( angle1, >, angle2 ); for( double a = angle1; a < angle2; ) { glVertex3d( lastPoint.x, lastPoint.y, layerDepth ); glVertex3d( lastPoint.x, lastPoint.y, layerDepth ); glVertex3d( lastPoint.x + adjust * sin( a ), lastPoint.y - adjust * cos( a ), layerDepth ); SWAP( angle1, >, angle2 ); a += M_PI / 32; if(a > angle2) a = angle2; glVertex3d( lastPoint.x + adjust * sin( angle1 ), lastPoint.y - adjust * cos( angle1 ), layerDepth ); for( double a = angle1 + M_PI / 32; a < angle2; a += M_PI / 32 ) { glVertex3d( lastPoint.x + adjust * sin( a ), glVertex3d( lastPoint.x + adjust * sin( a ), lastPoint.y - adjust * cos( a ), layerDepth ); lastPoint.y - adjust * cos( a ), layerDepth ); } } glVertex3d( lastPoint.x + adjust * sin( angle2 ), lastPoint.y - adjust * cos( angle2 ), layerDepth ); glEnd(); glEnd(); break; break; } } Loading Loading @@ -744,7 +752,6 @@ void OPENGL_GAL::DrawPolyline( std::deque<VECTOR2D>& aPointList ) { { point1 = lastPoint + perpendicularVector1; point1 = lastPoint + perpendicularVector1; point3 = lastPoint + perpendicularVector2; point3 = lastPoint + perpendicularVector2; } } VECTOR2D point2 = point1 - lastStartEndVector; VECTOR2D point2 = point1 - lastStartEndVector; Loading @@ -767,10 +774,17 @@ void OPENGL_GAL::DrawPolyline( std::deque<VECTOR2D>& aPointList ) double limit = MITER_LIMIT * lineWidth; double limit = MITER_LIMIT * lineWidth; VECTOR2D mp1 = point1 + ( limit / lineLengthA ) * lastStartEndVector; VECTOR2D mp1 = point1 + ( limit / lineLengthA ) * lastStartEndVector; VECTOR2D mp2 = point3 - ( limit / lineLengthB ) * startEndVector; VECTOR2D mp2 = point3 - ( limit / lineLengthB ) * startEndVector; glBegin( GL_TRIANGLE_FAN ); glBegin( GL_TRIANGLES ); glVertex3d( lastPoint.x, lastPoint.y, layerDepth ); glVertex3d( lastPoint.x, lastPoint.y, layerDepth ); glVertex3d( point1.x, point1.y, layerDepth ); glVertex3d( point1.x, point1.y, layerDepth ); glVertex3d( mp1.x, mp1.y, layerDepth ); glVertex3d( mp1.x, mp1.y, layerDepth ); glVertex3d( lastPoint.x, lastPoint.y, layerDepth ); glVertex3d( mp1.x, mp1.y, layerDepth ); glVertex3d( mp2.x, mp2.y, layerDepth ); glVertex3d( lastPoint.x, lastPoint.y, layerDepth ); glVertex3d( mp2.x, mp2.y, layerDepth ); glVertex3d( mp2.x, mp2.y, layerDepth ); glVertex3d( point3.x, point3.y, layerDepth ); glVertex3d( point3.x, point3.y, layerDepth ); glEnd(); glEnd(); Loading @@ -778,10 +792,13 @@ void OPENGL_GAL::DrawPolyline( std::deque<VECTOR2D>& aPointList ) else else { { // Insert two triangles for the mitered edge // Insert two triangles for the mitered edge glBegin( GL_TRIANGLE_FAN ); glBegin( GL_TRIANGLES ); glVertex3d( lastPoint.x, lastPoint.y, layerDepth ); glVertex3d( lastPoint.x, lastPoint.y, layerDepth ); glVertex3d( point1.x, point1.y, layerDepth ); glVertex3d( point1.x, point1.y, layerDepth ); glVertex3d( miterPoint.x, miterPoint.y, layerDepth ); glVertex3d( miterPoint.x, miterPoint.y, layerDepth ); glVertex3d( lastPoint.x, lastPoint.y, layerDepth ); glVertex3d( miterPoint.x, miterPoint.y, layerDepth ); glVertex3d( point3.x, point3.y, layerDepth ); glVertex3d( point3.x, point3.y, layerDepth ); glEnd(); glEnd(); } } Loading Loading @@ -819,7 +836,7 @@ void OPENGL_GAL::DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEn { { selectShader( 0 ); selectShader( 0 ); glColor4d( fillColor.r, fillColor.g, fillColor.b, fillColor.a ); glColor4d( fillColor.r, fillColor.g, fillColor.b, fillColor.a ); glBegin( GL_QUADS ); glBegin( GL_QUADS ); // shader glNormal3d( 1.0, 0, 0); glNormal3d( 1.0, 0, 0); glTexCoord2f(0.0, 0.0); glTexCoord2f(0.0, 0.0); glVertex3d( aStartPoint.x, aStartPoint.y, layerDepth ); glVertex3d( aStartPoint.x, aStartPoint.y, layerDepth ); Loading @@ -834,15 +851,14 @@ void OPENGL_GAL::DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEn glVertex3d( diagonalPointB.x, diagonalPointB.y, layerDepth ); glVertex3d( diagonalPointB.x, diagonalPointB.y, layerDepth ); glEnd(); glEnd(); } } if(isStrokeEnabled) if(isStrokeEnabled) { { glBegin(GL_QUADS); glBegin( GL_QUADS ); // shader drawRoundedSegment(aStartPoint, diagonalPointA, lineWidth, true, false ); drawRoundedSegment(aStartPoint, diagonalPointA, lineWidth, true, false ); drawRoundedSegment(aEndPoint, diagonalPointA, lineWidth, true, false ); drawRoundedSegment(aEndPoint, diagonalPointA, lineWidth, true, false ); drawRoundedSegment(aStartPoint, diagonalPointB, lineWidth, true, false ); drawRoundedSegment(aStartPoint, diagonalPointB, lineWidth, true, false ); drawRoundedSegment(aEndPoint, diagonalPointB, lineWidth, true, false ); drawRoundedSegment(aEndPoint, diagonalPointB, lineWidth, true, false ); glEnd(); glEnd(); } } Loading @@ -868,10 +884,13 @@ void OPENGL_GAL::DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEn if( isFillEnabled ) if( isFillEnabled ) { { glColor4d( fillColor.r, fillColor.g, fillColor.b, fillColor.a ); glColor4d( fillColor.r, fillColor.g, fillColor.b, fillColor.a ); glBegin( GL_QUADS ); glBegin( GL_TRIANGLES ); glVertex3d( aStartPoint.x, aStartPoint.y, layerDepth ); glVertex3d( aStartPoint.x, aStartPoint.y, layerDepth ); glVertex3d( diagonalPointA.x, diagonalPointA.y, layerDepth ); glVertex3d( diagonalPointA.x, diagonalPointA.y, layerDepth ); glVertex3d( aEndPoint.x, aEndPoint.y, layerDepth ); glVertex3d( aEndPoint.x, aEndPoint.y, layerDepth ); glVertex3d( aStartPoint.x, aStartPoint.y, layerDepth ); glVertex3d( aEndPoint.x, aEndPoint.y, layerDepth ); glVertex3d( diagonalPointB.x, diagonalPointB.y, layerDepth ); glVertex3d( diagonalPointB.x, diagonalPointB.y, layerDepth ); glEnd(); glEnd(); } } Loading Loading @@ -919,12 +938,22 @@ void OPENGL_GAL::DrawCircle( const VECTOR2D& aCenterPoint, double aRadius ) glTranslated( aCenterPoint.x, aCenterPoint.y, 0.0 ); glTranslated( aCenterPoint.x, aCenterPoint.y, 0.0 ); glScaled( aRadius, aRadius, 1.0 ); glScaled( aRadius, aRadius, 1.0 ); glBegin( GL_QUAD_STRIP ); glBegin( GL_TRIANGLES ); for( std::deque<VECTOR2D>::const_iterator it = unitCirclePoints.begin(); for( std::deque<VECTOR2D>::const_iterator it = unitCirclePoints.begin(); it != unitCirclePoints.end(); it++ ) it != unitCirclePoints.end(); it++ ) { { glVertex3d( it->x * innerScale, it->y * innerScale, layerDepth ); double v0[] = { it->x * innerScale, it->y * innerScale }; glVertex3d( it->x * outerScale, it->y * outerScale, layerDepth ); double v1[] = { it->x * outerScale, it->y * outerScale }; double v2[] = { ( it + 1 )->x * innerScale, ( it + 1 )->y * innerScale }; double v3[] = { ( it + 1 )->x * outerScale, ( it + 1 )->y * outerScale }; glVertex3d( v0[0], v0[1], layerDepth ); glVertex3d( v1[0], v1[1], layerDepth ); glVertex3d( v2[0], v2[1], layerDepth ); glVertex3d( v1[0], v1[1], layerDepth ); glVertex3d( v3[0], v3[1], layerDepth ); glVertex3d( v2[0], v2[1], layerDepth ); } } glEnd(); glEnd(); Loading Loading @@ -988,7 +1017,6 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double a VECTOR2D startEndPoint = startPoint + endPoint; VECTOR2D startEndPoint = startPoint + endPoint; VECTOR2D middlePoint = 0.5 * startEndPoint; VECTOR2D middlePoint = 0.5 * startEndPoint; glPushMatrix(); glPushMatrix(); glTranslated( aCenterPoint.x, aCenterPoint.y, layerDepth ); glTranslated( aCenterPoint.x, aCenterPoint.y, layerDepth ); glScaled( aRadius, aRadius, 1.0 ); glScaled( aRadius, aRadius, 1.0 ); Loading @@ -1015,7 +1043,7 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double a VECTOR2D p( cos( aStartAngle ), sin( aStartAngle ) ); VECTOR2D p( cos( aStartAngle ), sin( aStartAngle ) ); glBegin( GL_QUADS ); glBegin( GL_QUADS ); // shader for( int i = 0; i < n_points; i++ ) for( int i = 0; i < n_points; i++ ) { { VECTOR2D p_next( p.x * cosI - p.y * sinI, p.x * sinI + p.y * cosI ); VECTOR2D p_next( p.x * cosI - p.y * sinI, p.x * sinI + p.y * cosI ); Loading @@ -1027,20 +1055,30 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double a } } else else { { double alphaIncrement = 2 * M_PI / CIRCLE_POINTS; glColor4d( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a ); glColor4d( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a ); glBegin( GL_QUAD_STRIP ); glBegin( GL_TRIANGLES ); for( double alpha = aStartAngle; alpha < aEndAngle; ) { double v0[] = { cos( alpha ) * innerScale, sin( alpha ) * innerScale }; double v1[] = { cos( alpha ) * outerScale, sin( alpha ) * outerScale }; double alphaIncrement = 2 * M_PI / CIRCLE_POINTS; alpha += alphaIncrement; if( alpha > aEndAngle ) alpha = aEndAngle; for( double alpha = aStartAngle; alpha < aEndAngle; alpha += alphaIncrement ) double v2[] = { cos( alpha ) * innerScale, sin( alpha ) * innerScale }; { double v3[] = { cos( alpha ) * outerScale, sin( alpha ) * outerScale }; glVertex2d( cos( alpha ) * innerScale, sin( alpha ) * innerScale ); glVertex2d( cos( alpha ) * outerScale, sin( alpha ) * outerScale ); glVertex3d( v0[0], v0[1], layerDepth ); } glVertex3d( v1[0], v1[1], layerDepth ); glVertex3d( v2[0], v2[1], layerDepth ); glVertex2d( cos( aEndAngle ) * innerScale, sin( aEndAngle ) * innerScale ); glVertex3d( v1[0], v1[1], layerDepth ); glVertex2d( cos( aEndAngle ) * outerScale, sin( aEndAngle ) * outerScale ); glVertex3d( v3[0], v3[1], layerDepth ); glVertex3d( v2[0], v2[1], layerDepth ); } glEnd(); glEnd(); Loading @@ -1054,21 +1092,22 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double a if( isFillEnabled ) if( isFillEnabled ) { { glColor4d( fillColor.r, fillColor.g, fillColor.b, fillColor.a ); glBegin( GL_TRIANGLE_FAN ); glVertex2d( middlePoint.x, middlePoint.y ); double alphaIncrement = 2 * M_PI / CIRCLE_POINTS; double alphaIncrement = 2 * M_PI / CIRCLE_POINTS; double alpha; glColor4d( fillColor.r, fillColor.g, fillColor.b, fillColor.a ); for( double alpha = aStartAngle; alpha < aEndAngle; alpha += alphaIncrement ) glBegin( GL_TRIANGLES ); for( alpha = aStartAngle; ( alpha + alphaIncrement ) < aEndAngle; ) { { glVertex2d( middlePoint.x, middlePoint.y ); glVertex2d( cos( alpha ), sin( alpha ) ); alpha += alphaIncrement; glVertex2d( cos( alpha ), sin( alpha ) ); glVertex2d( cos( alpha ), sin( alpha ) ); } } glVertex2d( middlePoint.x, middlePoint.y ); glVertex2d( cos( alpha ), sin( alpha ) ); glVertex2d( endPoint.x, endPoint.y ); glVertex2d( endPoint.x, endPoint.y ); glEnd(); glEnd(); } } Loading @@ -1080,8 +1119,7 @@ struct OGLPOINT { { OGLPOINT() : OGLPOINT() : x( 0.0 ), y( 0.0 ), z( 0.0 ) x( 0.0 ), y( 0.0 ), z( 0.0 ) { {} } OGLPOINT( const char* fastest ) OGLPOINT( const char* fastest ) { { Loading @@ -1090,8 +1128,7 @@ struct OGLPOINT OGLPOINT( const VECTOR2D& aPoint ) : OGLPOINT( const VECTOR2D& aPoint ) : x( aPoint.x ), y( aPoint.y ), z( 0.0 ) x( aPoint.x ), y( aPoint.y ), z( 0.0 ) { {} } OGLPOINT& operator=( const VECTOR2D& aPoint ) OGLPOINT& operator=( const VECTOR2D& aPoint ) { { Loading Loading @@ -1334,17 +1371,25 @@ void OPENGL_GAL::computeUnitArcs() void OPENGL_GAL::computeUnitCircle() void OPENGL_GAL::computeUnitCircle() { { double valueX, valueY; displayListCircle = glGenLists( 1 ); displayListCircle = glGenLists( 1 ); glNewList( displayListCircle, GL_COMPILE ); glNewList( displayListCircle, GL_COMPILE ); glBegin( GL_TRIANGLE_FAN ); glBegin( GL_TRIANGLES ); glVertex2d( 0, 0 ); // Compute the circle points for a given number of segments // Compute the circle points for a given number of segments // Insert in a display list and a vector // Insert in a display list and a vector for( int i = 0; i < CIRCLE_POINTS + 1; i++ ) for( int i = 0; i < CIRCLE_POINTS; i++ ) { { double valueX = cos( 2.0 * M_PI / CIRCLE_POINTS * i ); glVertex2d( 0, 0 ); double valueY = sin( 2.0 * M_PI / CIRCLE_POINTS * i ); valueX = cos( 2.0 * M_PI / CIRCLE_POINTS * i ); valueY = sin( 2.0 * M_PI / CIRCLE_POINTS * i ); glVertex2d( valueX, valueY ); unitCirclePoints.push_back( VECTOR2D( valueX, valueY ) ); valueX = cos( 2.0 * M_PI / CIRCLE_POINTS * ( i + 1 ) ); valueY = sin( 2.0 * M_PI / CIRCLE_POINTS * ( i + 1 ) ); glVertex2d( valueX, valueY ); glVertex2d( valueX, valueY ); unitCirclePoints.push_back( VECTOR2D( valueX, valueY ) ); unitCirclePoints.push_back( VECTOR2D( valueX, valueY ) ); } } Loading @@ -1359,11 +1404,14 @@ void OPENGL_GAL::computeUnitSemiCircle() displayListSemiCircle = glGenLists( 1 ); displayListSemiCircle = glGenLists( 1 ); glNewList( displayListSemiCircle, GL_COMPILE ); glNewList( displayListSemiCircle, GL_COMPILE ); glBegin( GL_TRIANGLE_FAN ); glBegin( GL_TRIANGLES ); glVertex2d( 0, 0 ); for( int i = 0; i < CIRCLE_POINTS / 2; i++ ) for( int i = 0; i < CIRCLE_POINTS / 2 + 1; i++ ) { { glVertex2d( cos( 2.0 * M_PI / CIRCLE_POINTS * i ), sin( 2.0 * M_PI / CIRCLE_POINTS * i ) ); glVertex2d( 0, 0 ); glVertex2d( cos( 2.0 * M_PI / CIRCLE_POINTS * i ), sin( 2.0 * M_PI / CIRCLE_POINTS * i ) ); glVertex2d( cos( 2.0 * M_PI / CIRCLE_POINTS * ( i + 1 ) ), sin( 2.0 * M_PI / CIRCLE_POINTS * ( i + 1 ) ) ); } } glEnd(); glEnd(); Loading Loading @@ -1500,31 +1548,35 @@ void OPENGL_GAL::DrawCursor( VECTOR2D aCursorPosition ) glDisable( GL_TEXTURE_2D ); glDisable( GL_TEXTURE_2D ); glColor4d( cursorColor.r, cursorColor.g, cursorColor.b, cursorColor.a ); glColor4d( cursorColor.r, cursorColor.g, cursorColor.b, cursorColor.a ); glBegin( GL_QUADS ); glBegin( GL_TRIANGLES ); glVertex3f( (int) ( aCursorPosition.x - cursorSize / 2 ) + 1, glVertex3f( (int) ( aCursorPosition.x - cursorSize / 2 ) + 1, (int) ( aCursorPosition.y ), depthRange.x ); (int) ( aCursorPosition.y ), depthRange.x ); glVertex3f( (int) ( aCursorPosition.x + cursorSize / 2 ) + 1, glVertex3f( (int) ( aCursorPosition.x + cursorSize / 2 ) + 1, (int) ( aCursorPosition.y ), depthRange.x ); (int) ( aCursorPosition.y ), depthRange.x ); glVertex3f( (int) ( aCursorPosition.x + cursorSize / 2 ) + 1, glVertex3f( (int) ( aCursorPosition.x + cursorSize / 2 ) + 1, (int) ( aCursorPosition.y + 1 ), depthRange.x ); (int) ( aCursorPosition.y + 1 ), depthRange.x ); glVertex3f( (int) ( aCursorPosition.x - cursorSize / 2 ) + 1, (int) ( aCursorPosition.y ), depthRange.x ); glVertex3f( (int) ( aCursorPosition.x - cursorSize / 2 ) + 1, glVertex3f( (int) ( aCursorPosition.x - cursorSize / 2 ) + 1, (int) ( aCursorPosition.y + 1), depthRange.x ); (int) ( aCursorPosition.y + 1), depthRange.x ); glVertex3f( (int) ( aCursorPosition.x + cursorSize / 2 ) + 1, (int) ( aCursorPosition.y + 1 ), depthRange.x ); glVertex3f( (int) ( aCursorPosition.x ), glVertex3f( (int) ( aCursorPosition.x ), (int) ( aCursorPosition.y - cursorSize / 2 ) + 1, depthRange.x ); (int) ( aCursorPosition.y - cursorSize / 2 ) + 1, depthRange.x ); glVertex3f( (int) ( aCursorPosition.x ), glVertex3f( (int) ( aCursorPosition.x ), (int) ( aCursorPosition.y + cursorSize / 2 ) + 1, depthRange.x ); (int) ( aCursorPosition.y + cursorSize / 2 ) + 1, depthRange.x ); glVertex3f( (int) ( aCursorPosition.x ) + 1, glVertex3f( (int) ( aCursorPosition.x ) + 1, (int) ( aCursorPosition.y + cursorSize / 2 ) + 1, depthRange.x ); (int) ( aCursorPosition.y + cursorSize / 2 ) + 1, depthRange.x ); glVertex3f( (int) ( aCursorPosition.x ), (int) ( aCursorPosition.y - cursorSize / 2 ) + 1, depthRange.x ); glVertex3f( (int) ( aCursorPosition.x ) + 1, glVertex3f( (int) ( aCursorPosition.x ) + 1, (int) ( aCursorPosition.y - cursorSize / 2 ) + 1, depthRange.x ); (int) ( aCursorPosition.y - cursorSize / 2 ) + 1, depthRange.x ); glVertex3f( (int) ( aCursorPosition.x ) + 1, (int) ( aCursorPosition.y + cursorSize / 2 ) + 1, depthRange.x ); glEnd(); glEnd(); // Blit the current screen contents // Blit the current screen contents Loading Loading @@ -1559,11 +1611,14 @@ void OPENGL_GAL::DrawGridLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEnd glColor4d( gridColor.r, gridColor.g, gridColor.b, gridColor.a ); glColor4d( gridColor.r, gridColor.g, gridColor.b, gridColor.a ); // Draw the quad for the grid line // Draw the quad for the grid line glBegin( GL_QUADS ); glBegin( GL_TRIANGLES ); double gridDepth = depthRange.y * 0.75; double gridDepth = depthRange.y * 0.75; glVertex3d( point1.x, point1.y, gridDepth ); glVertex3d( point1.x, point1.y, gridDepth ); glVertex3d( point2.x, point2.y, gridDepth ); glVertex3d( point2.x, point2.y, gridDepth ); glVertex3d( point4.x, point4.y, gridDepth ); glVertex3d( point4.x, point4.y, gridDepth ); glVertex3d( point1.x, point1.y, gridDepth ); glVertex3d( point4.x, point4.y, gridDepth ); glVertex3d( point3.x, point3.y, gridDepth ); glVertex3d( point3.x, point3.y, gridDepth ); glEnd(); glEnd(); } } Loading