Skip to content

[rlgl] Poor support for disabled SUPPORT_QUADS_DRAW_MODE #4365

@Destructor17

Description

@Destructor17

Issue description

Some GLES drivers has no quads drawing mode support. And it makes sense because this drawing mode is being deprecated for 15 years or so. raylib has SUPPORT_QUADS_DRAW_MODE compiler flag turned on by default. Removing this flag simply makes raylib use RL_TRIANGLES in some routines instead of RL_QUADS. But RL_QUADS is still used in most routines and examples and checking SUPPORT_QUADS_DRAW_MODE or using RL_TRIANGLES is not a good solution. Instead rlgl must emulate quads using triangles if SUPPORT_QUADS_DRAW_MODE is disabled.

I guess it can be done easily by using triangles, same vertex buffer and different index buffer. For example one quad can be rendered using [0, 1, 2, 0, 2, 3] index buffer. I am not experienced in OpenGL so I am not sure it will work everywhere and needs no extensions.

Alternative solution is to add check to rlVertex3f and for each 4th vertex push last but two and last vertex, and only then push one specified in rlVertex3f. It will produce 50% more batches at bunnymark and slow rlVertex3f down even more, but I guess it doesn't depends on OpenGL version and extensions.

Environment

Hehe, well.

Guest: DESKTOP (GLFW, forked for custom platform), WASI sp1, custom WebAssembly embedder, OpenGL ES 2.0 proxied to host's OpenGL ES, no extensions.

Host: Linux, OpenGL ES 3.2 Mesa, AMD Radeon Vega 8 Graphics (radeonsi, raven, LLVM 17.0.6, DRM 3.57, 6.8.0-45-generic).

Issue Screenshot

Here is one for core_2d_camera.c. DrawTexturePro, used by rtext, uses RL_QUADS only, so text is missing.

image

Code Example

Reproduces on most examples. Adding checks for SUPPORT_QUADS_DRAW_MODE to more routines in rshapes and rtextures, of cause, fixes most issues, but it is not the most flexible solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions