Skip to content

Commit

Permalink
Fixes for drawing BGRA textures on iOS. (#5909)
Browse files Browse the repository at this point in the history
#changelog #ios
  • Loading branch information
martinell authored Jan 27, 2021
1 parent b4ea0d9 commit 0818683
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions libs/openFrameworks/gl/ofGLUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ int ofGetGLFormatFromInternal(int glInternalFormat){
case GL_RGBA32UI:
#endif
return GL_RGBA;
#ifdef TARGET_OF_IOS
case GL_BGRA:
return GL_BGRA;
#endif


case GL_RGB:
Expand Down Expand Up @@ -691,6 +695,9 @@ int ofGetNumChannelsFromGLFormat(int glFormat){
switch(glFormat){
case GL_RGB:
return 3;
#ifdef TARGET_OF_IOS
case GL_BGRA:
#endif
case GL_RGBA:
return 4;
case GL_LUMINANCE:
Expand Down
3 changes: 3 additions & 0 deletions libs/openFrameworks/gl/ofTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,9 @@ void ofTexture::loadData(const void * data, int w, int h, int glFormat, int glTy
// bind texture
glBindTexture(texData.textureTarget, (GLuint) texData.textureID);
//update the texture image:
#ifdef TARGET_OF_IOS
glTexImage2D(texData.textureTarget, 0, texData.glInternalFormat, texData.tex_w, texData.tex_h, 0, glFormat, glType, 0);
#endif
glTexSubImage2D(texData.textureTarget, 0, 0, 0, w, h, glFormat, glType, data);
// unbind texture target by binding 0
glBindTexture(texData.textureTarget, 0);
Expand Down

0 comments on commit 0818683

Please sign in to comment.