]> git.tdb.fi Git - libs/gl.git/commitdiff
Use individual component swizzle constants on OpenGL ES
authorMikko Rasa <tdb@tdb.fi>
Mon, 9 Apr 2018 10:51:41 +0000 (13:51 +0300)
committerMikko Rasa <tdb@tdb.fi>
Mon, 9 Apr 2018 10:51:41 +0000 (13:51 +0300)
source/texture.cpp

index a8b2f6d0db3e243a05548e6f452ae8d71fd015f8..1d2ece8074410ded753c621f4c4dd43418e2694d 100644 (file)
@@ -162,10 +162,20 @@ void Texture::update_parameter(int mask) const
                set_parameter_i(GL_TEXTURE_COMPARE_FUNC, cmp_func);
        if(mask&FORMAT_SWIZZLE)
        {
-               if(ARB_direct_state_access)
-                       glTextureParameteriv(id, GL_TEXTURE_SWIZZLE_RGBA, swizzle_orders+swizzle*4);
+               if(get_gl_api()==OPENGL_ES2)
+               {
+                       set_parameter_i(GL_TEXTURE_SWIZZLE_R, swizzle_orders[swizzle*4]);
+                       set_parameter_i(GL_TEXTURE_SWIZZLE_G, swizzle_orders[swizzle*4+1]);
+                       set_parameter_i(GL_TEXTURE_SWIZZLE_B, swizzle_orders[swizzle*4+2]);
+                       set_parameter_i(GL_TEXTURE_SWIZZLE_A, swizzle_orders[swizzle*4+3]);
+               }
                else
-                       glTexParameteriv(target, GL_TEXTURE_SWIZZLE_RGBA, swizzle_orders+swizzle*4);
+               {
+                       if(ARB_direct_state_access)
+                               glTextureParameteriv(id, GL_TEXTURE_SWIZZLE_RGBA, swizzle_orders+swizzle*4);
+                       else
+                               glTexParameteriv(target, GL_TEXTURE_SWIZZLE_RGBA, swizzle_orders+swizzle*4);
+               }
        }
 }