Commit Launchpad merge request 194664.
* Modify error handling for OpenGL backend. * Correct Doxygen comments notation.
This commit is contained in:
commit
e8e6b1f7c4
|
@ -93,7 +93,10 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
|
|||
Connect( KIGFX::WX_VIEW_CONTROLS::EVT_REFRESH_MOUSE,
|
||||
wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ), NULL, this );
|
||||
|
||||
// Set up timer that prevents too frequent redraw commands
|
||||
m_refreshTimer.SetOwner( this );
|
||||
m_pendingRefresh = false;
|
||||
m_drawing = false;
|
||||
Connect( wxEVT_TIMER, wxTimerEventHandler( EDA_DRAW_PANEL_GAL::onRefreshTimer ), NULL, this );
|
||||
|
||||
this->SetFocus();
|
||||
|
@ -121,18 +124,25 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
|
|||
m_pendingRefresh = false;
|
||||
m_lastRefresh = wxGetLocalTimeMillis();
|
||||
|
||||
m_gal->BeginDrawing();
|
||||
m_gal->SetBackgroundColor( KIGFX::COLOR4D( 0.0, 0.0, 0.0, 1.0 ) );
|
||||
m_gal->ClearScreen();
|
||||
if( !m_drawing )
|
||||
{
|
||||
m_drawing = true;
|
||||
|
||||
m_view->ClearTargets();
|
||||
// Grid has to be redrawn only when the NONCACHED target is redrawn
|
||||
if( m_view->IsTargetDirty( KIGFX::TARGET_NONCACHED ) )
|
||||
m_gal->DrawGrid();
|
||||
m_view->Redraw();
|
||||
m_gal->DrawCursor( m_viewControls->GetCursorPosition() );
|
||||
m_gal->BeginDrawing();
|
||||
m_gal->SetBackgroundColor( KIGFX::COLOR4D( 0.0, 0.0, 0.0, 1.0 ) );
|
||||
m_gal->ClearScreen();
|
||||
|
||||
m_gal->EndDrawing();
|
||||
m_view->ClearTargets();
|
||||
// Grid has to be redrawn only when the NONCACHED target is redrawn
|
||||
if( m_view->IsTargetDirty( KIGFX::TARGET_NONCACHED ) )
|
||||
m_gal->DrawGrid();
|
||||
m_view->Redraw();
|
||||
m_gal->DrawCursor( m_viewControls->GetCursorPosition() );
|
||||
|
||||
m_gal->EndDrawing();
|
||||
|
||||
m_drawing = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <gal/opengl/vertex_manager.h>
|
||||
#include <gal/opengl/vertex_item.h>
|
||||
#include <gal/opengl/shader.h>
|
||||
#include <confirm.h>
|
||||
#include <wx/log.h>
|
||||
#include <list>
|
||||
#ifdef __WXDEBUG__
|
||||
|
@ -315,7 +316,7 @@ bool CACHED_CONTAINER::defragment( VERTEX* aTarget )
|
|||
|
||||
if( aTarget == NULL )
|
||||
{
|
||||
wxLogError( wxT( "Run out of memory" ) );
|
||||
DisplayError( NULL, wxT( "Run out of memory" ) );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -439,7 +440,7 @@ bool CACHED_CONTAINER::resizeContainer( unsigned int aNewSize )
|
|||
|
||||
if( newContainer == NULL )
|
||||
{
|
||||
wxLogError( wxT( "Run out of memory" ) );
|
||||
DisplayError( NULL, wxT( "Run out of memory" ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -458,7 +459,7 @@ bool CACHED_CONTAINER::resizeContainer( unsigned int aNewSize )
|
|||
|
||||
if( newContainer == NULL )
|
||||
{
|
||||
wxLogError( wxT( "Run out of memory" ) );
|
||||
DisplayError( NULL, wxT( "Run out of memory" ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,9 +32,12 @@
|
|||
#include <gal/opengl/noncached_container.h>
|
||||
#include <gal/opengl/shader.h>
|
||||
#include <typeinfo>
|
||||
#include <wx/log.h>
|
||||
#include <wx/msgdlg.h>
|
||||
#include <confirm.h>
|
||||
#ifdef __WXDEBUG__
|
||||
#include <profile.h>
|
||||
#include <wx/debug.h>
|
||||
#include <wx/log.h>
|
||||
#endif
|
||||
|
||||
using namespace KIGFX;
|
||||
|
@ -70,7 +73,7 @@ void GPU_MANAGER::SetShader( SHADER& aShader )
|
|||
|
||||
if( m_shaderAttrib == -1 )
|
||||
{
|
||||
wxLogFatalError( wxT( "Could not get the shader attribute location" ) );
|
||||
DisplayError( NULL, wxT( "Could not get the shader attribute location" ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -205,7 +208,7 @@ void GPU_CACHED_MANAGER::uploadToGpu()
|
|||
|
||||
if( glGetError() != GL_NO_ERROR )
|
||||
{
|
||||
wxLogError( wxT( "Error during data upload to the GPU memory" ) );
|
||||
DisplayError( NULL, wxT( "Error during data upload to the GPU memory" ) );
|
||||
}
|
||||
|
||||
#ifdef __WXDEBUG__
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
*/
|
||||
|
||||
#include <gal/opengl/opengl_compositor.h>
|
||||
#include <wx/log.h>
|
||||
#include <wx/msgdlg.h>
|
||||
#include <confirm.h>
|
||||
|
||||
using namespace KIGFX;
|
||||
|
||||
|
@ -97,9 +98,9 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer()
|
|||
|
||||
if( usedBuffers() >= m_maxBuffers )
|
||||
{
|
||||
wxLogError( wxT( "Cannot create more framebuffers. OpenGL rendering backend requires at"
|
||||
"least 3 framebuffers. You may try to update/change "
|
||||
"your graphic drivers." ) );
|
||||
DisplayError( NULL, wxT( "Cannot create more framebuffers. OpenGL rendering "
|
||||
"backend requires at least 3 framebuffers. You may try to update/change "
|
||||
"your graphic drivers." ) );
|
||||
return 0; // Unfortunately we have no more free buffers left
|
||||
}
|
||||
|
||||
|
@ -131,38 +132,38 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer()
|
|||
switch( status )
|
||||
{
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT:
|
||||
wxLogFatalError( wxT( "Cannot create the framebuffer." ) );
|
||||
DisplayError( NULL, wxT( "Cannot create the framebuffer." ) );
|
||||
break;
|
||||
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT:
|
||||
wxLogFatalError( wxT( "The framebuffer attachment points are incomplete." ) );
|
||||
DisplayError( NULL, wxT( "The framebuffer attachment points are incomplete." ) );
|
||||
break;
|
||||
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT:
|
||||
wxLogFatalError( wxT( "The framebuffer does not have at least "
|
||||
"one image attached to it." ) );
|
||||
DisplayError( NULL, wxT( "The framebuffer does not have at least "
|
||||
"one image attached to it." ) );
|
||||
break;
|
||||
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT:
|
||||
wxLogFatalError( wxT( "The framebuffer read buffer is incomplete." ) );
|
||||
DisplayError( NULL, wxT( "The framebuffer read buffer is incomplete." ) );
|
||||
break;
|
||||
|
||||
case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
|
||||
wxLogFatalError( wxT( "The combination of internal formats of the attached images "
|
||||
DisplayError( NULL, wxT( "The combination of internal formats of the attached images "
|
||||
"violates an implementation-dependent set of restrictions." ) );
|
||||
break;
|
||||
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT:
|
||||
wxLogFatalError( wxT( "GL_RENDERBUFFER_SAMPLES is not the same "
|
||||
DisplayError( NULL, wxT( "GL_RENDERBUFFER_SAMPLES is not the same "
|
||||
"for all attached renderbuffers" ) );
|
||||
break;
|
||||
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT:
|
||||
wxLogFatalError( wxT( "Framebuffer incomplete layer targets errors." ) );
|
||||
DisplayError( NULL, wxT( "Framebuffer incomplete layer targets errors." ) );
|
||||
break;
|
||||
|
||||
default:
|
||||
wxLogFatalError( wxT( "Cannot create the framebuffer." ) );
|
||||
DisplayError( NULL, wxT( "Cannot create the framebuffer." ) );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -223,7 +224,7 @@ void OPENGL_COMPOSITOR::DrawBuffer( unsigned int aBufferHandle )
|
|||
|
||||
if( aBufferHandle == 0 || aBufferHandle > usedBuffers() )
|
||||
{
|
||||
wxLogError( wxT( "Wrong framebuffer handle" ) );
|
||||
DisplayError( NULL, wxT( "Wrong framebuffer handle" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include <wx/log.h>
|
||||
#include <macros.h>
|
||||
#include <confirm.h>
|
||||
#ifdef __WXDEBUG__
|
||||
#include <profile.h>
|
||||
#endif /* __WXDEBUG__ */
|
||||
|
@ -93,7 +94,8 @@ OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
|
|||
|
||||
if( tesselator == NULL )
|
||||
{
|
||||
wxLogFatalError( wxT( "Could not create the tesselator" ) );
|
||||
DisplayError( parentWindow, wxT( "Could not create the tesselator" ) );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
gluTessProperty( tesselator, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_POSITIVE );
|
||||
|
@ -144,13 +146,22 @@ void OPENGL_GAL::BeginDrawing()
|
|||
if( !isShaderInitialized )
|
||||
{
|
||||
if( !shader.LoadBuiltinShader( 0, SHADER_TYPE_VERTEX ) )
|
||||
wxLogFatalError( wxT( "Cannot compile vertex shader!" ) );
|
||||
{
|
||||
DisplayError( parentWindow, wxT( "Cannot compile vertex shader!" ) );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
if( !shader.LoadBuiltinShader( 1, SHADER_TYPE_FRAGMENT ) )
|
||||
wxLogFatalError( wxT( "Cannot compile fragment shader!" ) );
|
||||
{
|
||||
DisplayError( parentWindow, wxT( "Cannot compile fragment shader!" ) );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
if( !shader.Link() )
|
||||
wxLogFatalError( wxT( "Cannot link the shaders!" ) );
|
||||
{
|
||||
DisplayError( parentWindow, wxT( "Cannot link the shaders!" ) );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
// Make VBOs use shaders
|
||||
cachedManager.SetShader( shader );
|
||||
|
@ -915,7 +926,7 @@ void OPENGL_GAL::initGlew()
|
|||
|
||||
if( GLEW_OK != err )
|
||||
{
|
||||
wxLogError( wxString::FromUTF8( (char*) glewGetErrorString( err ) ) );
|
||||
DisplayError( parentWindow, wxString::FromUTF8( (char*) glewGetErrorString( err ) ) );
|
||||
exit( 1 );
|
||||
}
|
||||
else
|
||||
|
@ -931,21 +942,21 @@ void OPENGL_GAL::initGlew()
|
|||
}
|
||||
else
|
||||
{
|
||||
wxLogError( wxT( "OpenGL Version 2.1 is not supported!" ) );
|
||||
DisplayError( parentWindow, wxT( "OpenGL Version 2.1 is not supported!" ) );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
// Framebuffers have to be supported
|
||||
if( !GLEW_EXT_framebuffer_object )
|
||||
{
|
||||
wxLogError( wxT( "Framebuffer objects are not supported!" ) );
|
||||
DisplayError( parentWindow, wxT( "Framebuffer objects are not supported!" ) );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
// Vertex buffer have to be supported
|
||||
if( !GLEW_ARB_vertex_buffer_object )
|
||||
{
|
||||
wxLogError( wxT( "Vertex buffer objects are not supported!" ) );
|
||||
DisplayError( parentWindow, wxT( "Vertex buffer objects are not supported!" ) );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
|
@ -1040,10 +1051,12 @@ void CALLBACK EdgeCallback( GLboolean aEdgeFlag )
|
|||
|
||||
void CALLBACK ErrorCallback( GLenum aErrorCode )
|
||||
{
|
||||
const GLubyte* estring;
|
||||
const GLubyte* eString = gluErrorString( aErrorCode );
|
||||
|
||||
estring = gluErrorString( aErrorCode );
|
||||
wxLogError( wxT( "Tessellation Error: %s" ), (char*) estring );
|
||||
DisplayError( NULL, wxString( std::string( "Tessellation error: " ) +
|
||||
std::string( (const char*)( eString ) ) ) );
|
||||
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
#include <fstream>
|
||||
|
||||
#include <wx/log.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <confirm.h>
|
||||
|
||||
#include <gal/opengl/shader.h>
|
||||
#include "shader_src.h"
|
||||
|
@ -201,7 +203,7 @@ std::string SHADER::readSource( std::string aShaderSourceName )
|
|||
|
||||
if( !inputFile )
|
||||
{
|
||||
wxLogError( wxString::FromUTF8( "Can't read the shader source: " ) +
|
||||
DisplayError( NULL, wxString::FromUTF8( "Can't read the shader source: " ) +
|
||||
wxString( aShaderSourceName.c_str(), wxConvUTF8 ) );
|
||||
exit( 1 );
|
||||
}
|
||||
|
@ -223,7 +225,7 @@ bool SHADER::addSource( const std::string& aShaderSource, SHADER_TYPE aShaderTyp
|
|||
{
|
||||
if( isShaderLinked )
|
||||
{
|
||||
wxLogError( wxString::FromUTF8( "Shader is already linked!" ) );
|
||||
wxLogDebug( wxT( "Shader is already linked!" ) );
|
||||
}
|
||||
|
||||
// Create the program
|
||||
|
@ -259,7 +261,7 @@ bool SHADER::addSource( const std::string& aShaderSource, SHADER_TYPE aShaderTyp
|
|||
|
||||
if( status != GL_TRUE )
|
||||
{
|
||||
wxLogError( wxT( "Shader compilation error" ) );
|
||||
DisplayError( NULL, wxT( "Shader compilation error" ) );
|
||||
|
||||
shaderInfo( shaderNumber );
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <gal/opengl/noncached_container.h>
|
||||
#include <gal/opengl/gpu_manager.h>
|
||||
#include <gal/opengl/vertex_item.h>
|
||||
#include <confirm.h>
|
||||
|
||||
using namespace KIGFX;
|
||||
|
||||
|
@ -55,7 +56,7 @@ void VERTEX_MANAGER::Vertex( GLfloat aX, GLfloat aY, GLfloat aZ ) const
|
|||
|
||||
if( newVertex == NULL )
|
||||
{
|
||||
wxLogError( wxT( "Vertex allocation error" ) );
|
||||
DisplayError( NULL, wxT( "Vertex allocation error" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -70,7 +71,7 @@ void VERTEX_MANAGER::Vertices( const VERTEX aVertices[], unsigned int aSize ) co
|
|||
|
||||
if( newVertex == NULL )
|
||||
{
|
||||
wxLogError( wxT( "Vertex allocation error" ) );
|
||||
DisplayError( NULL, wxT( "Vertex allocation error" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include <tool/action_manager.h>
|
||||
|
||||
#include <wxPcbStruct.h>
|
||||
#include <confirm.h>
|
||||
#include <class_drawpanel_gal.h>
|
||||
|
||||
using boost::optional;
|
||||
|
@ -136,11 +137,10 @@ void TOOL_MANAGER::RegisterTool( TOOL_BASE* aTool )
|
|||
|
||||
if( aTool->GetType() == INTERACTIVE )
|
||||
{
|
||||
bool initState = static_cast<TOOL_INTERACTIVE*>( aTool )->Init();
|
||||
|
||||
if( !initState )
|
||||
if( !static_cast<TOOL_INTERACTIVE*>( aTool )->Init() )
|
||||
{
|
||||
wxLogError( wxT( "Initialization of the %s tool failed" ), aTool->GetName().c_str() );
|
||||
DisplayError( NULL, wxString( std::string( "Initialization of the %s tool failed" ) +
|
||||
aTool->GetName() ) );
|
||||
|
||||
// Unregister the tool
|
||||
m_toolState.erase( aTool );
|
||||
|
|
|
@ -99,7 +99,7 @@ public:
|
|||
}
|
||||
|
||||
/// @copydoc wxWindow::Refresh()
|
||||
virtual void Refresh( bool eraseBackground = true, const wxRect* rect = NULL );
|
||||
void Refresh( bool eraseBackground = true, const wxRect* rect = NULL );
|
||||
|
||||
/**
|
||||
* Function SetEventDispatcher()
|
||||
|
@ -121,18 +121,35 @@ protected:
|
|||
|
||||
static const int MinRefreshPeriod = 17; ///< 60 FPS.
|
||||
|
||||
wxLongLong m_lastRefresh; ///< Last time the panel was refreshed
|
||||
/// Last timestamp when the panel was refreshed
|
||||
wxLongLong m_lastRefresh;
|
||||
|
||||
/// Is there a redraw event requested?
|
||||
bool m_pendingRefresh;
|
||||
|
||||
/// True if GAL is currently redrawing the view
|
||||
bool m_drawing;
|
||||
|
||||
/// Timer responsible for preventing too frequent refresh
|
||||
wxTimer m_refreshTimer;
|
||||
|
||||
KIGFX::GAL* m_gal; ///< Interface for drawing objects on a 2D-surface
|
||||
KIGFX::VIEW* m_view; ///< Stores view settings (scale, center, etc.)
|
||||
///< and items to be drawn
|
||||
KIGFX::PAINTER* m_painter; ///< Contains information about how to draw items
|
||||
///< using GAL
|
||||
KIGFX::WX_VIEW_CONTROLS* m_viewControls; ///< Control for VIEW (moving, zooming, etc.)
|
||||
GalType m_currentGal; ///< Currently used GAL
|
||||
TOOL_DISPATCHER* m_eventDispatcher; ///< Processes and forwards events to tools
|
||||
/// Interface for drawing objects on a 2D-surface
|
||||
KIGFX::GAL* m_gal;
|
||||
|
||||
/// Stores view settings (scale, center, etc.) and items to be drawn
|
||||
KIGFX::VIEW* m_view;
|
||||
|
||||
/// Contains information about how to draw items using GAL
|
||||
KIGFX::PAINTER* m_painter;
|
||||
|
||||
/// Control for VIEW (moving, zooming, etc.)
|
||||
KIGFX::WX_VIEW_CONTROLS* m_viewControls;
|
||||
|
||||
/// Currently used GAL
|
||||
GalType m_currentGal;
|
||||
|
||||
/// Processes and forwards events to tools
|
||||
TOOL_DISPATCHER* m_eventDispatcher;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <class_module.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <view/view_controls.h>
|
||||
#include <confirm.h>
|
||||
|
||||
#include "common_actions.h"
|
||||
#include "selection_tool.h"
|
||||
|
@ -68,7 +69,7 @@ bool MOVE_TOOL::Init()
|
|||
}
|
||||
else
|
||||
{
|
||||
wxLogError( wxT( "pcbnew.InteractiveSelection tool is not available" ) );
|
||||
DisplayError( NULL, wxT( "pcbnew.InteractiveSelection tool is not available" ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue