Commit 25fa9adc authored by Frédéric Larue's avatar Frédéric Larue

QOpenGLShaderProgram replaced by GPU::Shader in SelectionToolLasso.

parent 4951e563
......@@ -61,13 +61,12 @@ void SelectionToolLasso::updateSelectionMask()
// Create the shader enabling the visualization of the selection mask.
if( !m_SelectionMaskVizShader.isLinked() )
if( !m_SelectionMaskVizShader.IsCreated() )
{
if( !m_SelectionMaskVizShader.addShaderFromSourceCode( QOpenGLShader::Vertex , s_SelectionMaskVizVPG ) ||
!m_SelectionMaskVizShader.addShaderFromSourceCode( QOpenGLShader::Fragment, s_SelectionMaskVizFPG ) ||
!m_SelectionMaskVizShader.link() )
std::string logs;
if( !GPU::CreateShaderFromSources( m_SelectionMaskVizShader, s_SelectionMaskVizVPG, s_SelectionMaskVizFPG, &logs ) )
{
std::cout << m_SelectionMaskVizShader.log().toStdString() << std::endl;
std::cout << logs << std::endl;
return;
}
}
......@@ -194,8 +193,8 @@ void SelectionToolLasso::display()
if( m_SelectionMask.IsInstantiated() )
{
m_SelectionMask.Bind( 0 );
m_SelectionMaskVizShader.bind();
m_SelectionMaskVizShader.setUniformValue( "u_SelectionMask", 0 );
m_SelectionMaskVizShader.Bind();
m_SelectionMaskVizShader.SetSampler( "u_SelectionMask", 0 );
glBegin( GL_QUADS );
glVertex2i( -1, -1 );
......@@ -204,7 +203,7 @@ void SelectionToolLasso::display()
glVertex2i( -1, 1 );
glEnd();
m_SelectionMaskVizShader.release();
m_SelectionMaskVizShader.Unbind();
m_SelectionMask.Unbind();
}
......
......@@ -25,37 +25,37 @@ class SelectionToolLasso : public SelectionTool
STATE_ENDED ,
};
static const char *s_SelectionMaskVizVPG;
static const char *s_SelectionMaskVizFPG;
static const char *s_SelectionMaskVizVPG;
static const char *s_SelectionMaskVizFPG;
QPoint m_PreviousMousePos;
QVector2D m_CurrentMousePos;
QPoint m_PreviousMousePos;
QVector2D m_CurrentMousePos;
SelectionState m_State;
int m_SelectedPolygonPointId;
QOpenGLShaderProgram m_SelectionMaskVizShader;
QVector<QVector2D> m_PolygonPoints;
GPU::Texture2D m_SelectionMask;
SelectionState m_State;
int m_SelectedPolygonPointId;
GPU::Shader m_SelectionMaskVizShader;
QVector<QVector2D> m_PolygonPoints;
GPU::Texture2D m_SelectionMask;
void updateSelectionMask();
void updateSelectionMask();
public:
SelectionToolLasso( GLViewer &viewer, SelectionTool::Context &context );
std::string getSelectionShaderFunctions();
void initSelectionShader( GPU::Shader &shader );
std::string getSelectionShaderFunctions();
void initSelectionShader( GPU::Shader &shader );
inline void onResize() { m_SelectionMask.Release(); updateSelectionMask(); }
inline void onEnabled() { postSelectionUpdate(); }
inline void onResize() { m_SelectionMask.Release(); updateSelectionMask(); }
inline void onEnabled() { postSelectionUpdate(); }
void preSelectionUpdate();
void postSelectionUpdate();
void preSelectionUpdate();
void postSelectionUpdate();
void display();
void mousePressEvent( QMouseEvent *evt );
void mouseMoveEvent( QMouseEvent *evt );
void mouseReleaseEvent( QMouseEvent *evt );
void mouseDoubleClickEvent( QMouseEvent * evt );
void display();
void mousePressEvent( QMouseEvent *evt );
void mouseMoveEvent( QMouseEvent *evt );
void mouseReleaseEvent( QMouseEvent *evt );
void mouseDoubleClickEvent( QMouseEvent * evt );
};
......
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