Loading common/gal/opengl/opengl_gal.cpp +18 −28 Original line number Original line Diff line number Diff line Loading @@ -27,7 +27,6 @@ */ */ #include <gal/opengl/opengl_gal.h> #include <gal/opengl/opengl_gal.h> #include <gal/opengl/vbo_container.h> #include <gal/definitions.h> #include <gal/definitions.h> #include <wx/log.h> #include <wx/log.h> Loading @@ -53,7 +52,8 @@ const int glAttributes[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 1 OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener, OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener, wxEvtHandler* aPaintListener, bool isUseShaders, const wxString& aName ) : wxEvtHandler* aPaintListener, bool isUseShaders, const wxString& aName ) : wxGLCanvas( aParent, wxID_ANY, (int*) glAttributes, wxDefaultPosition, wxDefaultSize, wxGLCanvas( aParent, wxID_ANY, (int*) glAttributes, wxDefaultPosition, wxDefaultSize, wxEXPAND, aName ) wxEXPAND, aName ), verticesCircle( &precomputedContainer ) { { // Create the OpenGL-Context // Create the OpenGL-Context glContext = new wxGLContext( this ); glContext = new wxGLContext( this ); Loading Loading @@ -106,8 +106,6 @@ OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener, Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( OPENGL_GAL::skipMouseEvent ) ); Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( OPENGL_GAL::skipMouseEvent ) ); #endif #endif vboContainer = new VBO_CONTAINER; // Tesselator initialization // Tesselator initialization tesselator = gluNewTess(); tesselator = gluNewTess(); InitTesselatorCallbacks( tesselator ); InitTesselatorCallbacks( tesselator ); Loading @@ -127,9 +125,6 @@ OPENGL_GAL::~OPENGL_GAL() if( glIsList( displayListCircle ) ) if( glIsList( displayListCircle ) ) glDeleteLists( displayListCircle, 1 ); glDeleteLists( displayListCircle, 1 ); delete verticesCircle; delete precomputedContainer; // Delete the buffers // Delete the buffers if( isFrameBufferInitialized ) if( isFrameBufferInitialized ) { { Loading @@ -143,7 +138,6 @@ OPENGL_GAL::~OPENGL_GAL() { { ClearCache(); ClearCache(); deleteVertexBufferObjects(); deleteVertexBufferObjects(); delete vboContainer; } } delete glContext; delete glContext; Loading Loading @@ -433,7 +427,7 @@ void OPENGL_GAL::BeginDrawing() glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, vboIndices ); glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, vboIndices ); // Discard old buffer, so we can use it again // Discard old buffer, so we can use it again glBufferData( GL_ELEMENT_ARRAY_BUFFER, vboContainer->GetSize() * VBO_ITEM::IndByteSize, glBufferData( GL_ELEMENT_ARRAY_BUFFER, vboContainer.GetSize() * VBO_ITEM::IndByteSize, NULL, GL_STREAM_DRAW ); NULL, GL_STREAM_DRAW ); // Map the GPU memory, so we can store indices that are going to be drawn // Map the GPU memory, so we can store indices that are going to be drawn Loading Loading @@ -549,17 +543,17 @@ void OPENGL_GAL::rebuildVbo() prof_start( &totalTime, false ); prof_start( &totalTime, false ); #endif /* __WXDEBUG__ */ #endif /* __WXDEBUG__ */ GLfloat* data = (GLfloat*) vboContainer->GetAllVertices(); GLfloat* data = (GLfloat*) vboContainer.GetAllVertices(); // Upload vertices coordinates and shader types to GPU memory // Upload vertices coordinates and shader types to GPU memory glBindBuffer( GL_ARRAY_BUFFER, vboVertices ); glBindBuffer( GL_ARRAY_BUFFER, vboVertices ); glBufferData( GL_ARRAY_BUFFER, vboContainer->GetSize() * VBO_ITEM::VertByteSize, glBufferData( GL_ARRAY_BUFFER, vboContainer.GetSize() * VBO_ITEM::VertByteSize, data, GL_DYNAMIC_DRAW ); data, GL_DYNAMIC_DRAW ); glBindBuffer( GL_ARRAY_BUFFER, 0 ); glBindBuffer( GL_ARRAY_BUFFER, 0 ); // Allocate the biggest possible buffer for indices // Allocate the biggest possible buffer for indices glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, vboIndices ); glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, vboIndices ); glBufferData( GL_ELEMENT_ARRAY_BUFFER, vboContainer->GetSize() * VBO_ITEM::IndByteSize, glBufferData( GL_ELEMENT_ARRAY_BUFFER, vboContainer.GetSize() * VBO_ITEM::IndByteSize, NULL, GL_STREAM_DRAW ); NULL, GL_STREAM_DRAW ); glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, 0 ); glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, 0 ); Loading @@ -569,7 +563,7 @@ void OPENGL_GAL::rebuildVbo() prof_end( &totalTime ); prof_end( &totalTime ); wxLogDebug( wxT( "Rebuilding VBO::%d vertices / %.1f ms" ), wxLogDebug( wxT( "Rebuilding VBO::%d vertices / %.1f ms" ), vboContainer->GetSize(), (double) totalTime.value / 1000.0 ); vboContainer.GetSize(), (double) totalTime.value / 1000.0 ); #endif /* __WXDEBUG__ */ #endif /* __WXDEBUG__ */ } } Loading Loading @@ -852,7 +846,7 @@ void OPENGL_GAL::DrawCircle( const VECTOR2D& aCenterPoint, double aRadius ) if( innerScale < outerScale ) if( innerScale < outerScale ) { { // Draw the outline // Draw the outline VBO_VERTEX* circle = verticesCircle->GetVertices(); VBO_VERTEX* circle = verticesCircle.GetVertices(); int next; int next; color4( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a ); color4( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a ); Loading Loading @@ -910,7 +904,7 @@ void OPENGL_GAL::DrawCircle( const VECTOR2D& aCenterPoint, double aRadius ) if( isGrouping ) if( isGrouping ) { { currentGroup->PushVertices( verticesCircle->GetVertices(), CIRCLE_POINTS * 3 ); currentGroup->PushVertices( verticesCircle.GetVertices(), CIRCLE_POINTS * 3 ); } } else else { { Loading Loading @@ -975,7 +969,7 @@ void OPENGL_GAL::drawFilledSemiCircle( const VECTOR2D& aCenterPoint, double aRad if( isGrouping ) if( isGrouping ) { { // It is enough just to push just a half of the circle vertices to make a semicircle // It is enough just to push just a half of the circle vertices to make a semicircle currentGroup->PushVertices( verticesCircle->GetVertices(), CIRCLE_POINTS / 2 * 3 ); currentGroup->PushVertices( verticesCircle.GetVertices(), CIRCLE_POINTS / 2 * 3 ); } } else else { { Loading Loading @@ -1031,7 +1025,7 @@ void OPENGL_GAL::drawStrokedSemiCircle( const VECTOR2D& aCenterPoint, double aRa Rotate( aAngle ); Rotate( aAngle ); // Draw the outline // Draw the outline VBO_VERTEX* circle = verticesCircle->GetVertices(); VBO_VERTEX* circle = verticesCircle.GetVertices(); int next; int next; begin( GL_TRIANGLES ); begin( GL_TRIANGLES ); Loading Loading @@ -1402,7 +1396,7 @@ void OPENGL_GAL::Save() if( isGrouping ) if( isGrouping ) { { transformStack.push( transform ); transformStack.push( transform ); vboContainer->SetTransformMatrix( &transform ); vboContainer.SetTransformMatrix( &transform ); } } else else { { Loading @@ -1421,7 +1415,7 @@ void OPENGL_GAL::Restore() if( transformStack.empty() ) if( transformStack.empty() ) { { // Disable transforming, as the selected matrix is identity // Disable transforming, as the selected matrix is identity vboContainer->SetTransformMatrix( NULL ); vboContainer.SetTransformMatrix( NULL ); } } } } else else Loading @@ -1439,7 +1433,7 @@ int OPENGL_GAL::BeginGroup() vboNeedsUpdate = true; vboNeedsUpdate = true; // Save the pointer for caching the current item // Save the pointer for caching the current item currentGroup = new VBO_ITEM( vboContainer ); currentGroup = new VBO_ITEM( &vboContainer ); int groupNumber = getGroupNumber(); int groupNumber = getGroupNumber(); groups.insert( std::make_pair( groupNumber, currentGroup ) ); groups.insert( std::make_pair( groupNumber, currentGroup ) ); Loading Loading @@ -1503,10 +1497,6 @@ void OPENGL_GAL::ChangeGroupDepth( int aGroupNumber, int aDepth ) void OPENGL_GAL::computeCircleVbo() void OPENGL_GAL::computeCircleVbo() { { // (3 vertices per triangle) * (number of points to draw a circle) precomputedContainer = new VBO_CONTAINER( 3 * CIRCLE_POINTS ); verticesCircle = new VBO_ITEM( precomputedContainer ); // 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 const VBO_VERTEX v0 = { 0.0f, 0.0f, 0.0f }; const VBO_VERTEX v0 = { 0.0f, 0.0f, 0.0f }; Loading @@ -1524,12 +1514,12 @@ void OPENGL_GAL::computeCircleVbo() 0.0f // z 0.0f // z }; }; verticesCircle->PushVertex( &v0 ); verticesCircle.PushVertex( &v0 ); verticesCircle->PushVertex( &v1 ); verticesCircle.PushVertex( &v1 ); verticesCircle->PushVertex( &v2 ); verticesCircle.PushVertex( &v2 ); } } verticesCircle->Finish(); verticesCircle.Finish(); } } Loading include/gal/opengl/opengl_gal.h +25 −7 Original line number Original line Diff line number Diff line Loading @@ -338,8 +338,8 @@ private: wxEvtHandler* paintListener; wxEvtHandler* paintListener; // VBO buffers & display lists (used in immediate mode) // VBO buffers & display lists (used in immediate mode) VBO_CONTAINER* precomputedContainer; ///< Container for storing display lists VBO_CONTAINER precomputedContainer; ///< Container for storing display lists VBO_ITEM* verticesCircle; ///< Buffer for circle & semicircle vertices VBO_ITEM verticesCircle; ///< Buffer for circle & semicircle vertices GLuint displayListCircle; ///< Circle display list GLuint displayListCircle; ///< Circle display list GLuint displayListSemiCircle; ///< Semi circle display list GLuint displayListSemiCircle; ///< Semi circle display list Loading @@ -348,7 +348,7 @@ private: GroupsMap groups; ///< Stores informations about VBO objects (groups) GroupsMap groups; ///< Stores informations about VBO objects (groups) unsigned int groupCounter; ///< Counter used for generating keys for groups unsigned int groupCounter; ///< Counter used for generating keys for groups VBO_ITEM* currentGroup; ///< Currently used VBO_ITEM (for grouping) VBO_ITEM* currentGroup; ///< Currently used VBO_ITEM (for grouping) VBO_CONTAINER* vboContainer; ///< Container for storing VBO_ITEMs VBO_CONTAINER vboContainer; ///< Container for storing VBO_ITEMs GLuint vboVertices; ///< Currently used vertices VBO handle GLuint vboVertices; ///< Currently used vertices VBO handle GLuint vboIndices; ///< Currently used indices VBO handle GLuint vboIndices; ///< Currently used indices VBO handle bool vboNeedsUpdate; ///< Flag indicating if VBO should be rebuilt bool vboNeedsUpdate; ///< Flag indicating if VBO should be rebuilt Loading Loading @@ -399,7 +399,8 @@ private: bool isGrouping; ///< Was a group started? bool isGrouping; ///< Was a group started? /** /** * @brief Draw a semi circle (used for line caps). * @brief Draw a semi circle. Depending on settings (isStrokeEnabled & isFilledEnabled) it runs * the proper function (drawStrokedSemiCircle or drawFilledSemiCircle). * * * @param aCenterPoint is the center point. * @param aCenterPoint is the center point. * @param aRadius is the radius of the semi-circle. * @param aRadius is the radius of the semi-circle. Loading @@ -408,7 +409,24 @@ private: */ */ void drawSemiCircle( const VECTOR2D& aCenterPoint, double aRadius, double aAngle ); void drawSemiCircle( const VECTOR2D& aCenterPoint, double aRadius, double aAngle ); /** * @brief Draw a filled semi circle. * * @param aCenterPoint is the center point. * @param aRadius is the radius of the semi-circle. * @param aAngle is the angle of the semi-circle. * */ void drawFilledSemiCircle( const VECTOR2D& aCenterPoint, double aRadius, double aAngle ); void drawFilledSemiCircle( const VECTOR2D& aCenterPoint, double aRadius, double aAngle ); /** * @brief Draw a stroked semi circle. * * @param aCenterPoint is the center point. * @param aRadius is the radius of the semi-circle. * @param aAngle is the angle of the semi-circle. * */ void drawStrokedSemiCircle( const VECTOR2D& aCenterPoint, double aRadius, double aAngle ); void drawStrokedSemiCircle( const VECTOR2D& aCenterPoint, double aRadius, double aAngle ); /// Compute the points of an unit circle & semicircle and store them in VBO. /// Compute the points of an unit circle & semicircle and store them in VBO. Loading Loading @@ -584,7 +602,7 @@ private: { { if( isGrouping ) if( isGrouping ) { { vboContainer->UseColor( aRed, aGreen, aBlue, aAlpha ); vboContainer.UseColor( aRed, aGreen, aBlue, aAlpha ); } } else else { { Loading @@ -603,7 +621,7 @@ private: { { if( isGrouping ) if( isGrouping ) { { vboContainer->UseColor( aColor ); vboContainer.UseColor( aColor ); } } else else { { Loading @@ -625,7 +643,7 @@ private: { { const GLfloat shader[] = { aShader, aParam1, aParam2, aParam3 }; const GLfloat shader[] = { aShader, aParam1, aParam2, aParam3 }; vboContainer->UseShader( shader ); vboContainer.UseShader( shader ); } } } } }; }; Loading Loading
common/gal/opengl/opengl_gal.cpp +18 −28 Original line number Original line Diff line number Diff line Loading @@ -27,7 +27,6 @@ */ */ #include <gal/opengl/opengl_gal.h> #include <gal/opengl/opengl_gal.h> #include <gal/opengl/vbo_container.h> #include <gal/definitions.h> #include <gal/definitions.h> #include <wx/log.h> #include <wx/log.h> Loading @@ -53,7 +52,8 @@ const int glAttributes[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 1 OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener, OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener, wxEvtHandler* aPaintListener, bool isUseShaders, const wxString& aName ) : wxEvtHandler* aPaintListener, bool isUseShaders, const wxString& aName ) : wxGLCanvas( aParent, wxID_ANY, (int*) glAttributes, wxDefaultPosition, wxDefaultSize, wxGLCanvas( aParent, wxID_ANY, (int*) glAttributes, wxDefaultPosition, wxDefaultSize, wxEXPAND, aName ) wxEXPAND, aName ), verticesCircle( &precomputedContainer ) { { // Create the OpenGL-Context // Create the OpenGL-Context glContext = new wxGLContext( this ); glContext = new wxGLContext( this ); Loading Loading @@ -106,8 +106,6 @@ OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener, Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( OPENGL_GAL::skipMouseEvent ) ); Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( OPENGL_GAL::skipMouseEvent ) ); #endif #endif vboContainer = new VBO_CONTAINER; // Tesselator initialization // Tesselator initialization tesselator = gluNewTess(); tesselator = gluNewTess(); InitTesselatorCallbacks( tesselator ); InitTesselatorCallbacks( tesselator ); Loading @@ -127,9 +125,6 @@ OPENGL_GAL::~OPENGL_GAL() if( glIsList( displayListCircle ) ) if( glIsList( displayListCircle ) ) glDeleteLists( displayListCircle, 1 ); glDeleteLists( displayListCircle, 1 ); delete verticesCircle; delete precomputedContainer; // Delete the buffers // Delete the buffers if( isFrameBufferInitialized ) if( isFrameBufferInitialized ) { { Loading @@ -143,7 +138,6 @@ OPENGL_GAL::~OPENGL_GAL() { { ClearCache(); ClearCache(); deleteVertexBufferObjects(); deleteVertexBufferObjects(); delete vboContainer; } } delete glContext; delete glContext; Loading Loading @@ -433,7 +427,7 @@ void OPENGL_GAL::BeginDrawing() glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, vboIndices ); glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, vboIndices ); // Discard old buffer, so we can use it again // Discard old buffer, so we can use it again glBufferData( GL_ELEMENT_ARRAY_BUFFER, vboContainer->GetSize() * VBO_ITEM::IndByteSize, glBufferData( GL_ELEMENT_ARRAY_BUFFER, vboContainer.GetSize() * VBO_ITEM::IndByteSize, NULL, GL_STREAM_DRAW ); NULL, GL_STREAM_DRAW ); // Map the GPU memory, so we can store indices that are going to be drawn // Map the GPU memory, so we can store indices that are going to be drawn Loading Loading @@ -549,17 +543,17 @@ void OPENGL_GAL::rebuildVbo() prof_start( &totalTime, false ); prof_start( &totalTime, false ); #endif /* __WXDEBUG__ */ #endif /* __WXDEBUG__ */ GLfloat* data = (GLfloat*) vboContainer->GetAllVertices(); GLfloat* data = (GLfloat*) vboContainer.GetAllVertices(); // Upload vertices coordinates and shader types to GPU memory // Upload vertices coordinates and shader types to GPU memory glBindBuffer( GL_ARRAY_BUFFER, vboVertices ); glBindBuffer( GL_ARRAY_BUFFER, vboVertices ); glBufferData( GL_ARRAY_BUFFER, vboContainer->GetSize() * VBO_ITEM::VertByteSize, glBufferData( GL_ARRAY_BUFFER, vboContainer.GetSize() * VBO_ITEM::VertByteSize, data, GL_DYNAMIC_DRAW ); data, GL_DYNAMIC_DRAW ); glBindBuffer( GL_ARRAY_BUFFER, 0 ); glBindBuffer( GL_ARRAY_BUFFER, 0 ); // Allocate the biggest possible buffer for indices // Allocate the biggest possible buffer for indices glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, vboIndices ); glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, vboIndices ); glBufferData( GL_ELEMENT_ARRAY_BUFFER, vboContainer->GetSize() * VBO_ITEM::IndByteSize, glBufferData( GL_ELEMENT_ARRAY_BUFFER, vboContainer.GetSize() * VBO_ITEM::IndByteSize, NULL, GL_STREAM_DRAW ); NULL, GL_STREAM_DRAW ); glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, 0 ); glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, 0 ); Loading @@ -569,7 +563,7 @@ void OPENGL_GAL::rebuildVbo() prof_end( &totalTime ); prof_end( &totalTime ); wxLogDebug( wxT( "Rebuilding VBO::%d vertices / %.1f ms" ), wxLogDebug( wxT( "Rebuilding VBO::%d vertices / %.1f ms" ), vboContainer->GetSize(), (double) totalTime.value / 1000.0 ); vboContainer.GetSize(), (double) totalTime.value / 1000.0 ); #endif /* __WXDEBUG__ */ #endif /* __WXDEBUG__ */ } } Loading Loading @@ -852,7 +846,7 @@ void OPENGL_GAL::DrawCircle( const VECTOR2D& aCenterPoint, double aRadius ) if( innerScale < outerScale ) if( innerScale < outerScale ) { { // Draw the outline // Draw the outline VBO_VERTEX* circle = verticesCircle->GetVertices(); VBO_VERTEX* circle = verticesCircle.GetVertices(); int next; int next; color4( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a ); color4( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a ); Loading Loading @@ -910,7 +904,7 @@ void OPENGL_GAL::DrawCircle( const VECTOR2D& aCenterPoint, double aRadius ) if( isGrouping ) if( isGrouping ) { { currentGroup->PushVertices( verticesCircle->GetVertices(), CIRCLE_POINTS * 3 ); currentGroup->PushVertices( verticesCircle.GetVertices(), CIRCLE_POINTS * 3 ); } } else else { { Loading Loading @@ -975,7 +969,7 @@ void OPENGL_GAL::drawFilledSemiCircle( const VECTOR2D& aCenterPoint, double aRad if( isGrouping ) if( isGrouping ) { { // It is enough just to push just a half of the circle vertices to make a semicircle // It is enough just to push just a half of the circle vertices to make a semicircle currentGroup->PushVertices( verticesCircle->GetVertices(), CIRCLE_POINTS / 2 * 3 ); currentGroup->PushVertices( verticesCircle.GetVertices(), CIRCLE_POINTS / 2 * 3 ); } } else else { { Loading Loading @@ -1031,7 +1025,7 @@ void OPENGL_GAL::drawStrokedSemiCircle( const VECTOR2D& aCenterPoint, double aRa Rotate( aAngle ); Rotate( aAngle ); // Draw the outline // Draw the outline VBO_VERTEX* circle = verticesCircle->GetVertices(); VBO_VERTEX* circle = verticesCircle.GetVertices(); int next; int next; begin( GL_TRIANGLES ); begin( GL_TRIANGLES ); Loading Loading @@ -1402,7 +1396,7 @@ void OPENGL_GAL::Save() if( isGrouping ) if( isGrouping ) { { transformStack.push( transform ); transformStack.push( transform ); vboContainer->SetTransformMatrix( &transform ); vboContainer.SetTransformMatrix( &transform ); } } else else { { Loading @@ -1421,7 +1415,7 @@ void OPENGL_GAL::Restore() if( transformStack.empty() ) if( transformStack.empty() ) { { // Disable transforming, as the selected matrix is identity // Disable transforming, as the selected matrix is identity vboContainer->SetTransformMatrix( NULL ); vboContainer.SetTransformMatrix( NULL ); } } } } else else Loading @@ -1439,7 +1433,7 @@ int OPENGL_GAL::BeginGroup() vboNeedsUpdate = true; vboNeedsUpdate = true; // Save the pointer for caching the current item // Save the pointer for caching the current item currentGroup = new VBO_ITEM( vboContainer ); currentGroup = new VBO_ITEM( &vboContainer ); int groupNumber = getGroupNumber(); int groupNumber = getGroupNumber(); groups.insert( std::make_pair( groupNumber, currentGroup ) ); groups.insert( std::make_pair( groupNumber, currentGroup ) ); Loading Loading @@ -1503,10 +1497,6 @@ void OPENGL_GAL::ChangeGroupDepth( int aGroupNumber, int aDepth ) void OPENGL_GAL::computeCircleVbo() void OPENGL_GAL::computeCircleVbo() { { // (3 vertices per triangle) * (number of points to draw a circle) precomputedContainer = new VBO_CONTAINER( 3 * CIRCLE_POINTS ); verticesCircle = new VBO_ITEM( precomputedContainer ); // 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 const VBO_VERTEX v0 = { 0.0f, 0.0f, 0.0f }; const VBO_VERTEX v0 = { 0.0f, 0.0f, 0.0f }; Loading @@ -1524,12 +1514,12 @@ void OPENGL_GAL::computeCircleVbo() 0.0f // z 0.0f // z }; }; verticesCircle->PushVertex( &v0 ); verticesCircle.PushVertex( &v0 ); verticesCircle->PushVertex( &v1 ); verticesCircle.PushVertex( &v1 ); verticesCircle->PushVertex( &v2 ); verticesCircle.PushVertex( &v2 ); } } verticesCircle->Finish(); verticesCircle.Finish(); } } Loading
include/gal/opengl/opengl_gal.h +25 −7 Original line number Original line Diff line number Diff line Loading @@ -338,8 +338,8 @@ private: wxEvtHandler* paintListener; wxEvtHandler* paintListener; // VBO buffers & display lists (used in immediate mode) // VBO buffers & display lists (used in immediate mode) VBO_CONTAINER* precomputedContainer; ///< Container for storing display lists VBO_CONTAINER precomputedContainer; ///< Container for storing display lists VBO_ITEM* verticesCircle; ///< Buffer for circle & semicircle vertices VBO_ITEM verticesCircle; ///< Buffer for circle & semicircle vertices GLuint displayListCircle; ///< Circle display list GLuint displayListCircle; ///< Circle display list GLuint displayListSemiCircle; ///< Semi circle display list GLuint displayListSemiCircle; ///< Semi circle display list Loading @@ -348,7 +348,7 @@ private: GroupsMap groups; ///< Stores informations about VBO objects (groups) GroupsMap groups; ///< Stores informations about VBO objects (groups) unsigned int groupCounter; ///< Counter used for generating keys for groups unsigned int groupCounter; ///< Counter used for generating keys for groups VBO_ITEM* currentGroup; ///< Currently used VBO_ITEM (for grouping) VBO_ITEM* currentGroup; ///< Currently used VBO_ITEM (for grouping) VBO_CONTAINER* vboContainer; ///< Container for storing VBO_ITEMs VBO_CONTAINER vboContainer; ///< Container for storing VBO_ITEMs GLuint vboVertices; ///< Currently used vertices VBO handle GLuint vboVertices; ///< Currently used vertices VBO handle GLuint vboIndices; ///< Currently used indices VBO handle GLuint vboIndices; ///< Currently used indices VBO handle bool vboNeedsUpdate; ///< Flag indicating if VBO should be rebuilt bool vboNeedsUpdate; ///< Flag indicating if VBO should be rebuilt Loading Loading @@ -399,7 +399,8 @@ private: bool isGrouping; ///< Was a group started? bool isGrouping; ///< Was a group started? /** /** * @brief Draw a semi circle (used for line caps). * @brief Draw a semi circle. Depending on settings (isStrokeEnabled & isFilledEnabled) it runs * the proper function (drawStrokedSemiCircle or drawFilledSemiCircle). * * * @param aCenterPoint is the center point. * @param aCenterPoint is the center point. * @param aRadius is the radius of the semi-circle. * @param aRadius is the radius of the semi-circle. Loading @@ -408,7 +409,24 @@ private: */ */ void drawSemiCircle( const VECTOR2D& aCenterPoint, double aRadius, double aAngle ); void drawSemiCircle( const VECTOR2D& aCenterPoint, double aRadius, double aAngle ); /** * @brief Draw a filled semi circle. * * @param aCenterPoint is the center point. * @param aRadius is the radius of the semi-circle. * @param aAngle is the angle of the semi-circle. * */ void drawFilledSemiCircle( const VECTOR2D& aCenterPoint, double aRadius, double aAngle ); void drawFilledSemiCircle( const VECTOR2D& aCenterPoint, double aRadius, double aAngle ); /** * @brief Draw a stroked semi circle. * * @param aCenterPoint is the center point. * @param aRadius is the radius of the semi-circle. * @param aAngle is the angle of the semi-circle. * */ void drawStrokedSemiCircle( const VECTOR2D& aCenterPoint, double aRadius, double aAngle ); void drawStrokedSemiCircle( const VECTOR2D& aCenterPoint, double aRadius, double aAngle ); /// Compute the points of an unit circle & semicircle and store them in VBO. /// Compute the points of an unit circle & semicircle and store them in VBO. Loading Loading @@ -584,7 +602,7 @@ private: { { if( isGrouping ) if( isGrouping ) { { vboContainer->UseColor( aRed, aGreen, aBlue, aAlpha ); vboContainer.UseColor( aRed, aGreen, aBlue, aAlpha ); } } else else { { Loading @@ -603,7 +621,7 @@ private: { { if( isGrouping ) if( isGrouping ) { { vboContainer->UseColor( aColor ); vboContainer.UseColor( aColor ); } } else else { { Loading @@ -625,7 +643,7 @@ private: { { const GLfloat shader[] = { aShader, aParam1, aParam2, aParam3 }; const GLfloat shader[] = { aShader, aParam1, aParam2, aParam3 }; vboContainer->UseShader( shader ); vboContainer.UseShader( shader ); } } } } }; }; Loading