From 6a644b48f01fafe3edb626267a4ec1bcb2c19000 Mon Sep 17 00:00:00 2001 From: goto40 Date: Sat, 8 Feb 2025 11:22:34 +0100 Subject: [PATCH 01/12] doc: audio stream processor, number of channels (#4753) * doc: audio stream processor * fixed accidental encoding effect --- parser/output/raylib_api.json | 6 +++--- parser/output/raylib_api.lua | 4 ++-- parser/output/raylib_api.txt | 4 ++-- parser/output/raylib_api.xml | 4 ++-- projects/Notepad++/raylib_npp_parser/raylib_npp.xml | 4 ++-- projects/Notepad++/raylib_npp_parser/raylib_to_parse.h | 4 ++-- src/raylib.h | 4 ++-- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/parser/output/raylib_api.json b/parser/output/raylib_api.json index 9fd9bcef0..9acb14710 100644 --- a/parser/output/raylib_api.json +++ b/parser/output/raylib_api.json @@ -12119,7 +12119,7 @@ }, { "name": "AttachAudioStreamProcessor", - "description": "Attach audio stream processor to stream, receives the samples as 'float'", + "description": "Attach audio stream processor to stream, receives frames x 2 samples as 'float' (stereo)", "returnType": "void", "params": [ { @@ -12149,7 +12149,7 @@ }, { "name": "AttachAudioMixedProcessor", - "description": "Attach audio stream processor to the entire audio pipeline, receives the samples as 'float'", + "description": "Attach audio stream processor to the entire audio pipeline, receives frames x 2 samples as 'float' (stereo)", "returnType": "void", "params": [ { @@ -12170,4 +12170,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/parser/output/raylib_api.lua b/parser/output/raylib_api.lua index 59eb4b0fc..81dd7f932 100644 --- a/parser/output/raylib_api.lua +++ b/parser/output/raylib_api.lua @@ -8276,7 +8276,7 @@ return { }, { name = "AttachAudioStreamProcessor", - description = "Attach audio stream processor to stream, receives the samples as 'float'", + description = "Attach audio stream processor to stream, receives frames x 2 samples as 'float' (stereo)", returnType = "void", params = { {type = "AudioStream", name = "stream"}, @@ -8294,7 +8294,7 @@ return { }, { name = "AttachAudioMixedProcessor", - description = "Attach audio stream processor to the entire audio pipeline, receives the samples as 'float'", + description = "Attach audio stream processor to the entire audio pipeline, receives frames x 2 samples as 'float' (stereo)", returnType = "void", params = { {type = "AudioCallback", name = "processor"} diff --git a/parser/output/raylib_api.txt b/parser/output/raylib_api.txt index f0fb4eab4..c74a79a5f 100644 --- a/parser/output/raylib_api.txt +++ b/parser/output/raylib_api.txt @@ -4659,7 +4659,7 @@ Function 578: SetAudioStreamCallback() (2 input parameters) Function 579: AttachAudioStreamProcessor() (2 input parameters) Name: AttachAudioStreamProcessor Return type: void - Description: Attach audio stream processor to stream, receives the samples as 'float' + Description: Attach audio stream processor to stream, receives frames x 2 samples as 'float' (stereo) Param[1]: stream (type: AudioStream) Param[2]: processor (type: AudioCallback) Function 580: DetachAudioStreamProcessor() (2 input parameters) @@ -4671,7 +4671,7 @@ Function 580: DetachAudioStreamProcessor() (2 input parameters) Function 581: AttachAudioMixedProcessor() (1 input parameters) Name: AttachAudioMixedProcessor Return type: void - Description: Attach audio stream processor to the entire audio pipeline, receives the samples as 'float' + Description: Attach audio stream processor to the entire audio pipeline, receives frames x 2 samples as 'float' (stereo) Param[1]: processor (type: AudioCallback) Function 582: DetachAudioMixedProcessor() (1 input parameters) Name: DetachAudioMixedProcessor diff --git a/parser/output/raylib_api.xml b/parser/output/raylib_api.xml index 21e9d30e6..b7af0c41a 100644 --- a/parser/output/raylib_api.xml +++ b/parser/output/raylib_api.xml @@ -3104,7 +3104,7 @@ - + @@ -3112,7 +3112,7 @@ - + diff --git a/projects/Notepad++/raylib_npp_parser/raylib_npp.xml b/projects/Notepad++/raylib_npp_parser/raylib_npp.xml index 3c642ad31..0fada9c4f 100644 --- a/projects/Notepad++/raylib_npp_parser/raylib_npp.xml +++ b/projects/Notepad++/raylib_npp_parser/raylib_npp.xml @@ -3634,7 +3634,7 @@ - + @@ -3647,7 +3647,7 @@ - + diff --git a/projects/Notepad++/raylib_npp_parser/raylib_to_parse.h b/projects/Notepad++/raylib_npp_parser/raylib_to_parse.h index 2ff4c9cb3..c6b34b777 100644 --- a/projects/Notepad++/raylib_npp_parser/raylib_to_parse.h +++ b/projects/Notepad++/raylib_npp_parser/raylib_to_parse.h @@ -734,9 +734,9 @@ RLAPI void SetAudioStreamPan(AudioStream stream, float pan); // Set pan RLAPI void SetAudioStreamBufferSizeDefault(int size); // Default size for new audio streams RLAPI void SetAudioStreamCallback(AudioStream stream, AudioCallback callback); // Audio thread callback to request new data -RLAPI void AttachAudioStreamProcessor(AudioStream stream, AudioCallback processor); // Attach audio stream processor to stream, receives the samples as 'float' +RLAPI void AttachAudioStreamProcessor(AudioStream stream, AudioCallback processor); // Attach audio stream processor to stream, receives frames x 2 samples as 'float' (stereo) RLAPI void DetachAudioStreamProcessor(AudioStream stream, AudioCallback processor); // Detach audio stream processor from stream -RLAPI void AttachAudioMixedProcessor(AudioCallback processor); // Attach audio stream processor to the entire audio pipeline, receives the samples as 'float' +RLAPI void AttachAudioMixedProcessor(AudioCallback processor); // Attach audio stream processor to the entire audio pipeline, receives frames x 2 samples as 'float' (stereo) RLAPI void DetachAudioMixedProcessor(AudioCallback processor); // Detach audio stream processor from the entire audio pipeline diff --git a/src/raylib.h b/src/raylib.h index b8428e7ac..791e16c00 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -1701,10 +1701,10 @@ RLAPI void SetAudioStreamPan(AudioStream stream, float pan); // Set pan RLAPI void SetAudioStreamBufferSizeDefault(int size); // Default size for new audio streams RLAPI void SetAudioStreamCallback(AudioStream stream, AudioCallback callback); // Audio thread callback to request new data -RLAPI void AttachAudioStreamProcessor(AudioStream stream, AudioCallback processor); // Attach audio stream processor to stream, receives the samples as 'float' +RLAPI void AttachAudioStreamProcessor(AudioStream stream, AudioCallback processor); // Attach audio stream processor to stream, receives frames x 2 samples as 'float' (stereo) RLAPI void DetachAudioStreamProcessor(AudioStream stream, AudioCallback processor); // Detach audio stream processor from stream -RLAPI void AttachAudioMixedProcessor(AudioCallback processor); // Attach audio stream processor to the entire audio pipeline, receives the samples as 'float' +RLAPI void AttachAudioMixedProcessor(AudioCallback processor); // Attach audio stream processor to the entire audio pipeline, receives frames x 2 samples as 'float' (stereo) RLAPI void DetachAudioMixedProcessor(AudioCallback processor); // Detach audio stream processor from the entire audio pipeline #if defined(__cplusplus) From a61c710b45665dadb9475ccb63aaf17b5cd318ac Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 8 Feb 2025 10:22:50 +0000 Subject: [PATCH 02/12] Update raylib_api.* by CI --- parser/output/raylib_api.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parser/output/raylib_api.json b/parser/output/raylib_api.json index 9acb14710..f5872ec8a 100644 --- a/parser/output/raylib_api.json +++ b/parser/output/raylib_api.json @@ -12170,4 +12170,4 @@ ] } ] -} \ No newline at end of file +} From a1de60f3ba253ce59b2e6fa5cdb69c15eaadc1cb Mon Sep 17 00:00:00 2001 From: Thomas Anderson <5776225+CrackedPixel@users.noreply.github.com> Date: Sat, 8 Feb 2025 04:23:15 -0600 Subject: [PATCH 03/12] added missing file (#4754) --- examples/Makefile.Web | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/Makefile.Web b/examples/Makefile.Web index 6f060652f..b9a521bb0 100644 --- a/examples/Makefile.Web +++ b/examples/Makefile.Web @@ -989,6 +989,7 @@ models/models_rlgl_solar_system: models/models_rlgl_solar_system.c models/models_skybox: models/models_skybox.c $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) -sTOTAL_MEMORY=67108864 -sFORCE_FILESYSTEM=1 \ --preload-file models/resources/dresden_square_2k.hdr@resources/dresden_square_2k.hdr \ + --preload-file models/resources/skybox.png@resources/skybox.png \ --preload-file models/resources/shaders/glsl100/skybox.vs@resources/shaders/glsl100/skybox.vs \ --preload-file models/resources/shaders/glsl100/skybox.fs@resources/shaders/glsl100/skybox.fs \ --preload-file models/resources/shaders/glsl100/cubemap.vs@resources/shaders/glsl100/cubemap.vs \ From 1d87932d93c9c58a4d273783a14a0f7f8d140a87 Mon Sep 17 00:00:00 2001 From: veins1 <19636663+veins1@users.noreply.github.com> Date: Thu, 13 Feb 2025 03:12:10 +0500 Subject: [PATCH 04/12] TextSubtext fixes (#4759) Fix buffer write overflow Fix reading past the end of text --- src/rtext.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/rtext.c b/src/rtext.c index 982402f54..0d06caa9a 100644 --- a/src/rtext.c +++ b/src/rtext.c @@ -1540,21 +1540,21 @@ const char *TextSubtext(const char *text, int position, int length) if (position >= textLength) { - position = textLength - 1; - length = 0; + return buffer; //First char is already '\0' by memset } - if (length >= textLength) length = textLength; + int maxLength = textLength - position; + if (length > maxLength) length = maxLength; + if (length >= MAX_TEXT_BUFFER_LENGTH) length = MAX_TEXT_BUFFER_LENGTH - 1; // NOTE: Alternative: memcpy(buffer, text + position, length) for (int c = 0 ; c < length ; c++) { - *(buffer + c) = *(text + position); - text++; + buffer[c] = text[position + c]; } - *(buffer + length) = '\0'; + buffer[length] = '\0'; return buffer; } From ee946b2f164211941649efc9aee162fa115dd786 Mon Sep 17 00:00:00 2001 From: mannikim Date: Thu, 13 Feb 2025 23:58:33 +0000 Subject: [PATCH 05/12] use strstr instead of TextFindIndex (#4764) --- src/rcore.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rcore.c b/src/rcore.c index 59b1b31c8..165c6f1fb 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -3696,7 +3696,7 @@ static void ScanDirectoryFiles(const char *basePath, FilePathList *files, const } else { - if (TextFindIndex(filter, DIRECTORY_FILTER_TAG) >= 0) + if (strstr(filter, DIRECTORY_FILTER_TAG) != NULL) { strcpy(files->paths[files->count], path); files->count++; @@ -3762,7 +3762,7 @@ static void ScanDirectoryFilesRecursively(const char *basePath, FilePathList *fi } else { - if ((filter != NULL) && (TextFindIndex(filter, DIRECTORY_FILTER_TAG) >= 0)) + if ((filter != NULL) && (strstr(filter, DIRECTORY_FILTER_TAG) != NULL)) { strcpy(files->paths[files->count], path); files->count++; From c647d337034585251d3d76d32093ac88a4c4ab82 Mon Sep 17 00:00:00 2001 From: Le Juez Victor <90587919+Bigfoot71@users.noreply.github.com> Date: Fri, 14 Feb 2025 01:00:05 +0100 Subject: [PATCH 06/12] Better default values for normals and tangents (VBOs) (#4763) --- src/rmodels.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rmodels.c b/src/rmodels.c index 4928d4bf1..812823ac1 100644 --- a/src/rmodels.c +++ b/src/rmodels.c @@ -1307,7 +1307,7 @@ void UploadMesh(Mesh *mesh, bool dynamic) { // Default vertex attribute: normal // WARNING: Default value provided to shader if location available - float value[3] = { 1.0f, 1.0f, 1.0f }; + float value[3] = { 0.0f, 0.0f, 1.0f }; rlSetVertexAttributeDefault(RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL, value, SHADER_ATTRIB_VEC3, 3); rlDisableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL); } @@ -1339,7 +1339,7 @@ void UploadMesh(Mesh *mesh, bool dynamic) { // Default vertex attribute: tangent // WARNING: Default value provided to shader if location available - float value[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; + float value[4] = { 1.0f, 0.0f, 0.0f, 1.0f }; rlSetVertexAttributeDefault(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT, value, SHADER_ATTRIB_VEC4, 4); rlDisableVertexAttribute(RL_DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT); } From 2b59e7475f190a86a45042a00a3a0df8ef19fbc9 Mon Sep 17 00:00:00 2001 From: Le Juez Victor <90587919+Bigfoot71@users.noreply.github.com> Date: Sat, 15 Feb 2025 19:34:51 +0100 Subject: [PATCH 07/12] Implement Android-specific functions (#4769) `GetWindowScaleDPI` and monitor physical dimensions --- src/platforms/rcore_android.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/platforms/rcore_android.c b/src/platforms/rcore_android.c index 96ea367dc..de423e6c5 100644 --- a/src/platforms/rcore_android.c +++ b/src/platforms/rcore_android.c @@ -460,17 +460,21 @@ int GetMonitorHeight(int monitor) } // Get selected monitor physical width in millimetres +// NOTE: It seems to return a slightly underestimated value on some devices int GetMonitorPhysicalWidth(int monitor) { - TRACELOG(LOG_WARNING, "GetMonitorPhysicalWidth() not implemented on target platform"); - return 0; + int widthPixels = ANativeWindow_getWidth(platform.app->window); + float dpi = AConfiguration_getDensity(platform.app->config); + return (widthPixels/dpi)*25.4f; } // Get selected monitor physical height in millimetres +// NOTE: It seems to return a slightly underestimated value on some devices int GetMonitorPhysicalHeight(int monitor) { - TRACELOG(LOG_WARNING, "GetMonitorPhysicalHeight() not implemented on target platform"); - return 0; + int heightPixels = ANativeWindow_getHeight(platform.app->window); + float dpi = AConfiguration_getDensity(platform.app->config); + return (heightPixels/dpi)*25.4f; } // Get selected monitor refresh rate @@ -497,8 +501,9 @@ Vector2 GetWindowPosition(void) // Get window scale DPI factor for current monitor Vector2 GetWindowScaleDPI(void) { - TRACELOG(LOG_WARNING, "GetWindowScaleDPI() not implemented on target platform"); - return (Vector2){ 1.0f, 1.0f }; + int density = AConfiguration_getDensity(platform.app->config); + float scale = (float)density/160; + return (Vector2){ scale, scale }; } // Set clipboard text content From b49c079b1d493bc84bd570a6d01ed4a4c1a499f0 Mon Sep 17 00:00:00 2001 From: vict-Yang <105902098+vict-Yang@users.noreply.github.com> Date: Sun, 16 Feb 2025 22:43:32 +0800 Subject: [PATCH 08/12] Fix typo in rshapes.c (#4772) --- src/rshapes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rshapes.c b/src/rshapes.c index 704d74f40..9327a5543 100644 --- a/src/rshapes.c +++ b/src/rshapes.c @@ -2356,7 +2356,7 @@ bool CheckCollisionPointLine(Vector2 point, Vector2 p1, Vector2 p2, int threshol return collision; } -// Check if circle collides with a line created betweeen two points [p1] and [p2] +// Check if circle collides with a line created between two points [p1] and [p2] RLAPI bool CheckCollisionCircleLine(Vector2 center, float radius, Vector2 p1, Vector2 p2) { float dx = p1.x - p2.x; From 11090ab6cbc9a58dc640c2d712d1d467457c2e98 Mon Sep 17 00:00:00 2001 From: Brian E <72316548+Brian-ED@users.noreply.github.com> Date: Mon, 17 Feb 2025 12:12:59 +0100 Subject: [PATCH 09/12] [raylib.h] Added space after comma (#4774) args for ImageResizeNN were missing a space in the arguments after a comma, i just added one. --- src/raylib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/raylib.h b/src/raylib.h index 791e16c00..7919db775 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -1365,7 +1365,7 @@ RLAPI void ImageAlphaPremultiply(Image *image); RLAPI void ImageBlurGaussian(Image *image, int blurSize); // Apply Gaussian blur using a box blur approximation RLAPI void ImageKernelConvolution(Image *image, const float *kernel, int kernelSize); // Apply custom square convolution kernel to image RLAPI void ImageResize(Image *image, int newWidth, int newHeight); // Resize image (Bicubic scaling algorithm) -RLAPI void ImageResizeNN(Image *image, int newWidth,int newHeight); // Resize image (Nearest-Neighbor scaling algorithm) +RLAPI void ImageResizeNN(Image *image, int newWidth, int newHeight); // Resize image (Nearest-Neighbor scaling algorithm) RLAPI void ImageResizeCanvas(Image *image, int newWidth, int newHeight, int offsetX, int offsetY, Color fill); // Resize canvas and fill with color RLAPI void ImageMipmaps(Image *image); // Compute all mipmap levels for a provided image RLAPI void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp); // Dither image data to 16bpp or lower (Floyd-Steinberg dithering) From 77df0ab1e85fde7a06442021968c2b90d015f7cb Mon Sep 17 00:00:00 2001 From: sleeptightAnsiC <91839286+sleeptightAnsiC@users.noreply.github.com> Date: Tue, 18 Feb 2025 22:53:18 +0100 Subject: [PATCH 10/12] [rcore_desktop_glfw.c] fix: make sure that GLFW uses RL_*alloc macros (#4777) Raylib allows for providing custom allocators via macros. GLFW supports this too, but via function pointers. Make sure that GLFW uses those Raylib macros, by wrapping them in function calls and setting them up inside of InitPlatform(). This is possible because of glfwInitAllocator() and GLFWallocator. Fixes: https://github.com/raysan5/raylib/issues/4776 Relates-to: https://github.com/raysan5/raylib/issues/4751 --- src/platforms/rcore_desktop_glfw.c | 40 ++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/src/platforms/rcore_desktop_glfw.c b/src/platforms/rcore_desktop_glfw.c index 279f8c193..90b725ddb 100644 --- a/src/platforms/rcore_desktop_glfw.c +++ b/src/platforms/rcore_desktop_glfw.c @@ -86,6 +86,8 @@ #include "GLFW/glfw3native.h" // Required for: glfwGetCocoaWindow() #endif +#include // Required for: size_t + //---------------------------------------------------------------------------------- // Types and Structures Definition //---------------------------------------------------------------------------------- @@ -127,6 +129,11 @@ static void MouseScrollCallback(GLFWwindow *window, double xoffset, double yoffs static void CursorEnterCallback(GLFWwindow *window, int enter); // GLFW3 Cursor Enter Callback, cursor enters client area static void JoystickCallback(int jid, int event); // GLFW3 Joystick Connected/Disconnected Callback +// Wrappers used by glfwInitAllocator +static void* AllocateWrapper(size_t size, void* user); // GLFW3 GLFWallocatefun, wrapps around RL_MALLOC macro +static void* ReallocateWrapper(void* block, size_t size, void* user); // GLFW3 GLFWreallocatefun, wrapps around RL_MALLOC macro +static void DeallocateWrapper(void* block, void* user); // GLFW3 GLFWdeallocatefun, wraps around RL_FREE macro + //---------------------------------------------------------------------------------- // Module Functions Declaration //---------------------------------------------------------------------------------- @@ -1287,21 +1294,38 @@ static void SetDimensionsFromMonitor(GLFWmonitor *monitor) if (CORE.Window.screen.height == 0) CORE.Window.screen.height = CORE.Window.display.height; } +// Function wrappers around RL_*alloc macros, used by glfwInitAllocator() inside of InitPlatform() +// We need to provide these because GLFWallocator expects function pointers with specific signatures. +// Similar wrappers exist in utils.c but we cannot reuse them here due to declaration mismatch. +// https://www.glfw.org/docs/latest/intro_guide.html#init_allocator +static void* AllocateWrapper(size_t size, void* user) +{ + (void)user; + return RL_MALLOC(size); +} +static void* ReallocateWrapper(void* block, size_t size, void* user) +{ + (void)user; + return RL_REALLOC(block, size); +} +static void DeallocateWrapper(void* block, void* user) +{ + (void)user; + RL_FREE(block); +} + // Initialize platform: graphics, inputs and more int InitPlatform(void) { glfwSetErrorCallback(ErrorCallback); -/* - // TODO: Setup GLFW custom allocators to match raylib ones + const GLFWallocator allocator = { - .allocate = MemAlloc, - .deallocate = MemFree, - .reallocate = MemRealloc, - .user = NULL + .allocate = AllocateWrapper, + .deallocate = DeallocateWrapper, + .reallocate = ReallocateWrapper, + .user = NULL, // RL_*ALLOC macros are not capable of handling user-provided data }; - glfwInitAllocator(&allocator); -*/ #if defined(__APPLE__) glfwInitHint(GLFW_COCOA_CHDIR_RESOURCES, GLFW_FALSE); From 32fcfd354908614f2aaa9d37016b35e9fbfcbe68 Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 19 Feb 2025 13:38:22 +0100 Subject: [PATCH 11/12] Minor tweaks --- src/platforms/rcore_android.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/platforms/rcore_android.c b/src/platforms/rcore_android.c index de423e6c5..a5484adc6 100644 --- a/src/platforms/rcore_android.c +++ b/src/platforms/rcore_android.c @@ -853,8 +853,7 @@ static int InitGraphicsDevice(void) TRACELOG(LOG_INFO, "DISPLAY: Trying to enable MSAA x4"); } - const EGLint framebufferAttribs[] = - { + const EGLint framebufferAttribs[] = { EGL_RENDERABLE_TYPE, (rlGetVersion() == RL_OPENGL_ES_30)? EGL_OPENGL_ES3_BIT : EGL_OPENGL_ES2_BIT, // Type of context support EGL_RED_SIZE, 8, // RED color bit depth (alternative: 5) EGL_GREEN_SIZE, 8, // GREEN color bit depth (alternative: 6) @@ -862,13 +861,12 @@ static int InitGraphicsDevice(void) //EGL_TRANSPARENT_TYPE, EGL_NONE, // Request transparent framebuffer (EGL_TRANSPARENT_RGB does not work on RPI) EGL_DEPTH_SIZE, 16, // Depth buffer size (Required to use Depth testing!) //EGL_STENCIL_SIZE, 8, // Stencil buffer size - EGL_SAMPLE_BUFFERS, sampleBuffer, // Activate MSAA + EGL_SAMPLE_BUFFERS, sampleBuffer, // Activate MSAA EGL_SAMPLES, samples, // 4x Antialiasing if activated (Free on MALI GPUs) EGL_NONE }; - const EGLint contextAttribs[] = - { + const EGLint contextAttribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; From 5ea60dd3cee3cfbc5eaf527f6486f16d9552f9b3 Mon Sep 17 00:00:00 2001 From: Ray Date: Thu, 20 Feb 2025 18:10:01 +0100 Subject: [PATCH 12/12] Minor tweaks --- src/platforms/rcore_android.c | 2 +- src/platforms/rcore_drm.c | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/platforms/rcore_android.c b/src/platforms/rcore_android.c index a5484adc6..1e726c455 100644 --- a/src/platforms/rcore_android.c +++ b/src/platforms/rcore_android.c @@ -854,7 +854,7 @@ static int InitGraphicsDevice(void) } const EGLint framebufferAttribs[] = { - EGL_RENDERABLE_TYPE, (rlGetVersion() == RL_OPENGL_ES_30)? EGL_OPENGL_ES3_BIT : EGL_OPENGL_ES2_BIT, // Type of context support + EGL_RENDERABLE_TYPE, (rlGetVersion() == RL_OPENGL_ES_30)? EGL_OPENGL_ES3_BIT : EGL_OPENGL_ES2_BIT, // Type of context support EGL_RED_SIZE, 8, // RED color bit depth (alternative: 5) EGL_GREEN_SIZE, 8, // GREEN color bit depth (alternative: 6) EGL_BLUE_SIZE, 8, // BLUE color bit depth (alternative: 5) diff --git a/src/platforms/rcore_drm.c b/src/platforms/rcore_drm.c index 36d255bc0..abd696fb3 100644 --- a/src/platforms/rcore_drm.c +++ b/src/platforms/rcore_drm.c @@ -898,10 +898,9 @@ int InitPlatform(void) TRACELOG(LOG_INFO, "DISPLAY: Trying to enable MSAA x4"); } - const EGLint framebufferAttribs[] = - { - EGL_RENDERABLE_TYPE, (rlGetVersion() == RL_OPENGL_ES_30)? EGL_OPENGL_ES3_BIT : EGL_OPENGL_ES2_BIT, // Type of context support - EGL_SURFACE_TYPE, EGL_WINDOW_BIT, // Don't use it on Android! + const EGLint framebufferAttribs[] = { + EGL_RENDERABLE_TYPE, (rlGetVersion() == RL_OPENGL_ES_30)? EGL_OPENGL_ES3_BIT : EGL_OPENGL_ES2_BIT, // Type of context support + EGL_SURFACE_TYPE, EGL_WINDOW_BIT, // Don't use it on Android! EGL_RED_SIZE, 8, // RED color bit depth (alternative: 5) EGL_GREEN_SIZE, 8, // GREEN color bit depth (alternative: 6) EGL_BLUE_SIZE, 8, // BLUE color bit depth (alternative: 5) @@ -909,7 +908,7 @@ int InitPlatform(void) //EGL_TRANSPARENT_TYPE, EGL_NONE, // Request transparent framebuffer (EGL_TRANSPARENT_RGB does not work on RPI) EGL_DEPTH_SIZE, 16, // Depth buffer size (Required to use Depth testing!) //EGL_STENCIL_SIZE, 8, // Stencil buffer size - EGL_SAMPLE_BUFFERS, sampleBuffer, // Activate MSAA + EGL_SAMPLE_BUFFERS, sampleBuffer, // Activate MSAA EGL_SAMPLES, samples, // 4x Antialiasing if activated (Free on MALI GPUs) EGL_NONE };