MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / updateTransparencyTexturesSize

Method updateTransparencyTexturesSize

source/MRViewer/MRAlphaSortGL.cpp:121–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119}
120
121void AlphaSortGL::updateTransparencyTexturesSize( int width, int height )
122{
123 if ( transparency_heads_texture_vbo == 0 )
124 return;
125
126 if ( width == 0 || height == 0 )
127 return;
128
129 GL_EXEC( glDeleteTextures( 1, &transparency_heads_texture_vbo ) );
130 GL_EXEC( glGenTextures( 1, &transparency_heads_texture_vbo ) );
131 GL_EXEC( glBindTexture( GL_TEXTURE_2D, transparency_heads_texture_vbo ) );
132 GL_EXEC( glTexStorage2D( GL_TEXTURE_2D, 1, GL_R32UI, GLuint( width ), GLuint( height ) ) );
133#ifndef __EMSCRIPTEN__
134 GL_EXEC( glBindImageTexture( 0, transparency_heads_texture_vbo, 0, GL_FALSE, 0, GL_READ_WRITE, GL_R32UI ) );
135
136 GLuint maxNodes = cAlphaSortStoragePixelCapacity * GLuint( width ) * GLuint( height );
137 GLint nodeSize = 5 * sizeof( GLfloat ) + sizeof( GLuint );
138 GL_EXEC( glBindBuffer( GL_SHADER_STORAGE_BUFFER, transparency_shared_shader_data_vbo ) );
139 GL_EXEC( glBufferData( GL_SHADER_STORAGE_BUFFER, maxNodes * nodeSize, NULL, GL_DYNAMIC_DRAW ) );
140 GL_EXEC( glBindBuffer( GL_SHADER_STORAGE_BUFFER, 0 ) ); // unbind
141#endif
142 std::vector<GLuint> ones( GLuint( width ) * GLuint( height ), 0xFFFFFFFF );
143 GL_EXEC( glBindBuffer( GL_PIXEL_UNPACK_BUFFER, transparency_static_clean_vbo ) );
144 GL_EXEC( glBufferData( GL_PIXEL_UNPACK_BUFFER, ones.size() * sizeof( GLuint ), ones.data(), GL_STATIC_COPY ) );
145 GL_EXEC( glBindBuffer( GL_PIXEL_UNPACK_BUFFER, 0 ) ); // unbind
146
147 width_ = width;
148 height_ = height;
149 clearTransparencyTextures();
150}
151
152}

Callers 3

setupWindow_Method · 0.80
postResizeMethod · 0.80

Calls 2

sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected