Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions source/MRMesh/MRObjectLabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ void ObjectLabel::setDefaultColors_()
{
setFrontColor( SceneColors::get( SceneColors::Labels ) );
setFrontColor( SceneColors::get( SceneColors::Labels ), false );
setSourcePointColor( SceneColors::get( SceneColors::Labels ) );
setLeaderLineColor( SceneColors::get( SceneColors::Labels ) );
}

void ObjectLabel::buildMesh_()
Expand Down
17 changes: 17 additions & 0 deletions source/MRViewer/MRRenderLabelObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,21 @@ void RenderLabelObject::renderSourcePoint_( const RenderParams& renderParams ) c

GL_EXEC( glUniform1ui( glGetUniformLocation( shader, "primBucketSize" ), 1 ) );

// Selection
GL_EXEC( glActiveTexture( GL_TEXTURE0 ) );
GL_EXEC( glBindTexture( GL_TEXTURE_2D, srcIndicesSelectionTexId_ ) );
if ( dirtySrc_ )
{
GL_EXEC( glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT ) );
GL_EXEC( glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT ) );
GL_EXEC( glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST ) );
GL_EXEC( glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ) );
GL_EXEC( glPixelStorei( GL_UNPACK_ALIGNMENT, 1 ) );
unsigned selTexture = 0;
GL_EXEC( glTexImage2D( GL_TEXTURE_2D, 0, GL_R32UI, 1, 1, 0, GL_RED_INTEGER, GL_UNSIGNED_INT, &selTexture ) );
}
GL_EXEC( glUniform1i( glGetUniformLocation( shader, "selection" ), 0 ) );

getViewerInstance().incrementThisFrameGLPrimitivesCount( Viewer::GLPrimitivesType::PointElementsNum, pointIndices.size() );

#ifdef __EMSCRIPTEN__
Expand Down Expand Up @@ -335,6 +350,7 @@ void RenderLabelObject::initBuffers_()
GL_EXEC( glBindVertexArray( srcArrayObjId_ ) );
GL_EXEC( glGenBuffers( 1, &srcVertPosBufferObjId_ ) );
GL_EXEC( glGenBuffers( 1, &srcIndicesBufferObjId_ ) );
GL_EXEC( glGenTextures( 1, &srcIndicesSelectionTexId_ ) );

GL_EXEC( glGenVertexArrays( 1, &bgArrayObjId_ ) );
GL_EXEC( glBindVertexArray( bgArrayObjId_ ) );
Expand Down Expand Up @@ -364,6 +380,7 @@ void RenderLabelObject::freeBuffers_()
GL_EXEC( glDeleteVertexArrays( 1, &srcArrayObjId_ ) );
GL_EXEC( glDeleteBuffers( 1, &srcVertPosBufferObjId_ ) );
GL_EXEC( glDeleteBuffers( 1, &srcIndicesBufferObjId_ ) );
GL_EXEC( glDeleteTextures( 1, &srcIndicesSelectionTexId_ ) );

GL_EXEC( glDeleteVertexArrays( 1, &bgArrayObjId_ ) );
GL_EXEC( glDeleteBuffers( 1, &bgVertPosBufferObjId_ ) );
Expand Down
1 change: 1 addition & 0 deletions source/MRViewer/MRRenderLabelObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class RenderLabelObject : public IRenderObject
GLuint srcArrayObjId_{ 0 };
GLuint srcVertPosBufferObjId_{ 0 };
GLuint srcIndicesBufferObjId_{ 0 };
GLuint srcIndicesSelectionTexId_{ 0 };

GLuint bgArrayObjId_{ 0 };
GLuint bgVertPosBufferObjId_{ 0 };
Expand Down