Skip to content

Commit

Permalink
PYMOL-4787: Bind Global Texture before selection indicator write
Browse files Browse the repository at this point in the history
  • Loading branch information
JarrettSJohnson committed Mar 14, 2024
1 parent 112b24d commit 795e664
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
8 changes: 8 additions & 0 deletions layer0/Texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
17 changes: 17 additions & 0 deletions layer0/Texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions layer3/Executive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 795e664

Please sign in to comment.