mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-27 13:38:30 +00:00
Corrected crazy bug about model textures
On OpenGL ES it was set to use GL_CLAMP_TO_EDGE wrap mode for textures. On LoadOBJ() texture coordinates were wrongly Y-flipped
This commit is contained in:
15
src/rlgl.c
15
src/rlgl.c
@@ -1219,7 +1219,7 @@ void rlglClose(void)
|
||||
|
||||
rlDeleteVertexArrays(postproQuad.mesh.vaoId);
|
||||
|
||||
TraceLog(INFO, "[FBO %i] Unloaded postpro quad data", fbo);
|
||||
TraceLog(INFO, "[FBO %i] Unloaded postprocessing data", fbo);
|
||||
}
|
||||
|
||||
free(draws);
|
||||
@@ -1780,8 +1780,17 @@ unsigned int rlglLoadTexture(void *data, int width, int height, int textureForma
|
||||
// NOTE: glTexParameteri does NOT affect texture uploading, just the way it's used
|
||||
#if defined(GRAPHICS_API_OPENGL_ES2)
|
||||
// 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
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); // Set texture to clamp on x-axis
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); // Set texture to clamp on y-axis
|
||||
if (npotSupported)
|
||||
{
|
||||
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
|
||||
}
|
||||
else
|
||||
{
|
||||
// NOTE: If using negative texture coordinates (LoadOBJ()), it does not work!
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); // Set texture to clamp on x-axis
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); // Set texture to clamp on y-axis
|
||||
}
|
||||
#else
|
||||
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