added NPOT check to rlLoadTexture to match rlGenTextureMipmaps and WebGL 1.0 standard
This commit is contained in:
parent
2dd8d7e8b1
commit
f907fc40f3
|
|
@ -3366,8 +3366,15 @@ unsigned int rlLoadTexture(const void *data, int width, int height, int format,
|
||||||
// Texture parameters configuration
|
// Texture parameters configuration
|
||||||
// NOTE: glTexParameteri does NOT affect texture uploading
|
// NOTE: glTexParameteri does NOT affect texture uploading
|
||||||
#if defined(GRAPHICS_API_OPENGL_ES2)
|
#if defined(GRAPHICS_API_OPENGL_ES2)
|
||||||
|
|
||||||
|
// Check if texture is power-of-two (POT)
|
||||||
|
bool texIsPOT = false;
|
||||||
|
|
||||||
|
if (((width > 0) && ((width & (width - 1)) == 0)) &&
|
||||||
|
((height > 0) && ((height & (height - 1)) == 0))) texIsPOT = true;
|
||||||
|
|
||||||
// NOTE: OpenGL ES 2.0 with no GL_OES_texture_npot support (i.e. WebGL) has limited NPOT support, so CLAMP_TO_EDGE must be used
|
// NOTE: OpenGL ES 2.0 with no GL_OES_texture_npot support (i.e. WebGL) has limited NPOT support, so CLAMP_TO_EDGE must be used
|
||||||
if (RLGL.ExtSupported.texNPOT)
|
if ((texIsPOT) || (RLGL.ExtSupported.texNPOT))
|
||||||
{
|
{
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); // Set texture to repeat on x-axis
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); // Set texture to repeat on x-axis
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); // Set texture to repeat on y-axis
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); // Set texture to repeat on y-axis
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user