PYMOL-4787: Bind Global Texture before selection indicator write

This commit is contained in:
Jarrett Johnson
2024-02-28 14:12:54 -05:00
parent 112b24d72f
commit 795e664d7f
3 changed files with 27 additions and 2 deletions

View File

@@ -260,6 +260,14 @@ void TextureGetPlacementForNewSubtexture(PyMOLGlobals * G, int new_texture_width
I->xpos += new_texture_width + 1; // added space for running on Ipad/Iphone (weird artifacts)
}
void TextureFillNewSubtexture(PyMOLGlobals* G, int width, int height, int x, int y, const void* data)
{
CTexture *I = G->Texture;
if (I->texture) {
I->texture->texture_subdata_2D(x, y, width, height, data);
}
}
void TextureFree(PyMOLGlobals * G)
{
/* TODO -- free all the resident textures */

View File

@@ -34,7 +34,24 @@ void TextureInitTextTexture(PyMOLGlobals * G);
* Binds the global Text Texture
*/
void TextureBindTexture(PyMOLGlobals* G);
/**
* Allocates a section of the global texture for a new subtexture.
* @param new_texture_width width of the new subtexture
* @param new_texture_height height of the new subtexture
* @param[out] new_texture_posx x position of the new subtexture
* @param[out] new_texture_posy y position of the new subtexture
*/
void TextureGetPlacementForNewSubtexture(PyMOLGlobals * G, int new_texture_width, int new_texture_height, int *new_texture_posx, int *new_texture_posy);
/**
* Fills a new subtexture with the given data.
* @param width width of the new subtexture
* @param height height of the new subtexture
* @param x x position of the new subtexture
* @param y y position of the new subtexture
*/
void TextureFillNewSubtexture(PyMOLGlobals* G, int width, int height, int x, int y, const void* data);
int TextureGetTextTextureSize(PyMOLGlobals * G);
#endif

View File

@@ -8056,8 +8056,8 @@ static void ExecutiveRegenerateTextureForSelector(PyMOLGlobals *G, int round_poi
// printf("\n");
}
}
glTexSubImage2D(GL_TEXTURE_2D, 0, I->selectorTexturePosX, I->selectorTexturePosY,
widths_arg[0], widths_arg[0], GL_RGBA, GL_UNSIGNED_BYTE, temp_buffer);
TextureFillNewSubtexture(G, widths_arg[0], widths_arg[0],
I->selectorTexturePosX, I->selectorTexturePosY, temp_buffer);
FreeP(temp_buffer);
}