mirror of
https://github.com/raysan5/raylib.git
synced 2026-05-09 23:24:27 +00:00
added NPOT check to rlLoadTexture to match rlGenTextureMipmaps and WebGL 1.0 standard (#5820)
This commit is contained in:
@@ -3366,8 +3366,15 @@ unsigned int rlLoadTexture(const void *data, int width, int height, int format,
|
||||
// Texture parameters configuration
|
||||
// NOTE: glTexParameteri does NOT affect texture uploading
|
||||
#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
|
||||
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_T, GL_REPEAT); // Set texture to repeat on y-axis
|
||||
|
||||
Reference in New Issue
Block a user