From: Mikko Rasa Date: Mon, 9 Apr 2018 10:51:41 +0000 (+0300) Subject: Use individual component swizzle constants on OpenGL ES X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=ed2d1c8c5ac065751a7887b178b4499007c1ffe4;p=libs%2Fgl.git Use individual component swizzle constants on OpenGL ES --- diff --git a/source/texture.cpp b/source/texture.cpp index a8b2f6d0..1d2ece80 100644 --- a/source/texture.cpp +++ b/source/texture.cpp @@ -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); + } } }