From e1353b9f7d5f29b4706b305245946b2c5cab6a12 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Mon, 9 Feb 2015 18:29:32 +0100 Subject: [PATCH] Removed some TODO already done --- src/core.c | 3 +-- src/models.c | 10 +--------- src/rlgl.c | 27 ++++++++++++++++++--------- src/textures.c | 2 -- 4 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/core.c b/src/core.c index f0a5af916..a1dc96337 100644 --- a/src/core.c +++ b/src/core.c @@ -690,8 +690,7 @@ Color Fade(Color color, float alpha) return (Color){color.r, color.g, color.b, color.a*alpha}; } -// Enable some window configurations (SetWindowFlags()?) -// TODO: Review function name and usage +// Enable some window/system configurations void SetConfigFlags(char flags) { configFlags = flags; diff --git a/src/models.c b/src/models.c index 96f98c91b..5d76fd650 100644 --- a/src/models.c +++ b/src/models.c @@ -850,15 +850,7 @@ Model LoadCubicmap(Image cubesmap) Vector3 n5 = { 0.0f, 0.0f, 1.0f }; Vector3 n6 = { 0.0f, 0.0f, -1.0f }; - // Define the 4 texture coordinates of the cube, we will combine them accordingly later... - // TODO: Use texture rectangles to define different textures for top-bottom-front-back-right-left (6) - /* - Vector2 vt2 = { 0.0f, 0.0f }; - Vector2 vt1 = { 0.0f, 1.0f }; - Vector2 vt4 = { 1.0f, 0.0f }; - Vector2 vt3 = { 1.0f, 1.0f }; - */ - + // NOTE: We use texture rectangles to define different textures for top-bottom-front-back-right-left (6) typedef struct RectangleF { float x; float y; diff --git a/src/rlgl.c b/src/rlgl.c index 67ef0a484..a30cfbb77 100644 --- a/src/rlgl.c +++ b/src/rlgl.c @@ -353,7 +353,7 @@ void rlScalef(float x, float y, float z) // Multiply the current matrix by another matrix void rlMultMatrixf(float *m) { - // TODO: review Matrix creation from array + // Matrix creation from array Matrix mat = { m[0], m[1], m[2], m[3], m[4], m[5], m[6], m[7], m[8], m[9], m[10], m[11], @@ -511,7 +511,7 @@ void rlEnd(void) } } - // TODO: Make sure normals count match vertex count + // TODO: Make sure normals count match vertex count... if normals support is added in a future... :P } break; default: break; @@ -1417,6 +1417,7 @@ unsigned int rlglLoadTexture(unsigned char *data, int width, int height, bool ge glBindTexture(GL_TEXTURE_2D, id); // NOTE: glTexParameteri does NOT affect texture uploading, just the way it's 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 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); // Set texture to repead on x-axis glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); // Set texture to repead on y-axis @@ -1433,6 +1434,7 @@ unsigned int rlglLoadTexture(unsigned char *data, int width, int height, bool ge } // If mipmaps are being used, we configure mag-min filters accordingly + // NOTE: OpenGL ES 2.0 with no GL_OES_texture_npot support (i.e. WebGL) has limited NPOT support, so only GL_LINEAR or GL_NEAREST can be used if (genMipmaps) { // Trilinear filtering with mipmaps @@ -1476,16 +1478,23 @@ unsigned int rlglLoadTexture(unsigned char *data, int width, int height, bool ge else glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); #endif -#if defined(GRAPHICS_API_OPENGL_33) +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) // NOTE: We define internal (GPU) format as GL_RGBA8 (probably BGRA8 in practice, driver takes care) + // NOTE: On embedded systems, we let the driver choose the best internal format //glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); // OpenGL glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); // WebGL -#elif defined(GRAPHICS_API_OPENGL_ES2) - // NOTE: On embedded systems, we let the driver choose the best internal format - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); -#endif + + // TODO: Add support for multiple color modes (16bit color modes and grayscale) + // Ref: https://www.khronos.org/opengles/sdk/docs/man3/html/glTexImage2D.xhtml + // On WebGL, internalFormat must match format and options allowed are: GL_LUMINANCE, GL_RGB, GL_RGBA + // (sized)internalFormat format type + // GL_R GL_RED GL_UNSIGNED_BYTE + // GL_RGB565 GL_RGB GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT_5_6_5 + // GL_RGB5_A1 GL_RGBA GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT_5_5_5_1 + // GL_RGBA4 GL_RGBA GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT_4_4_4_4 + // GL_RGBA8 GL_RGBA GL_UNSIGNED_BYTE + // GL_RGB8 GL_RGB GL_UNSIGNED_BYTE -#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) if (genMipmaps) { glGenerateMipmap(GL_TEXTURE_2D); // Generate mipmaps automatically @@ -2142,7 +2151,7 @@ static void InitializeBuffersGPU(void) } // Update VBOs with vertex array data -// TODO: If there is not vertex data, buffers doesn't need to be updated (vertexCount > 0) +// NOTE: If there is not vertex data, buffers doesn't need to be updated (vertexCount > 0) // TODO: If no data changed on the CPU arrays --> No need to update GPU arrays every frame! static void UpdateBuffers(void) { diff --git a/src/textures.c b/src/textures.c index e8bf60888..768ead787 100644 --- a/src/textures.c +++ b/src/textures.c @@ -103,8 +103,6 @@ Image LoadImage(const char *fileName) // Force loading to 4 components (RGBA) byte *imgData = stbi_load(fileName, &imgWidth, &imgHeight, &imgBpp, 4); - // TODO: Check if file could be loaded! (imgData == NULL)? - if (imgData != NULL) { // Convert array to pixel array for working convenience