check if skeleton texture is already allocated before reallocating

(cherry picked from commit 99de3906ba)
This commit is contained in:
clayjohn 2019-08-18 21:50:33 -07:00 committed by Rémi Verschelde
parent 61ef8e98ba
commit 5acb21dd7b
1 changed files with 2 additions and 1 deletions

View File

@ -3466,6 +3466,8 @@ RID RasterizerStorageGLES2::skeleton_create() {
Skeleton *skeleton = memnew(Skeleton); Skeleton *skeleton = memnew(Skeleton);
glGenTextures(1, &skeleton->tex_id);
return skeleton_owner.make_rid(skeleton); return skeleton_owner.make_rid(skeleton);
} }
@ -3483,7 +3485,6 @@ void RasterizerStorageGLES2::skeleton_allocate(RID p_skeleton, int p_bones, bool
skeleton->use_2d = p_2d_skeleton; skeleton->use_2d = p_2d_skeleton;
if (config.float_texture_supported) { if (config.float_texture_supported) {
glGenTextures(1, &skeleton->tex_id);
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, skeleton->tex_id); glBindTexture(GL_TEXTURE_2D, skeleton->tex_id);