Skip to content

Conversation

@mardy
Copy link
Collaborator

@mardy mardy commented Jan 27, 2025

Support for using textures in OpenGL 2.0 shader implementations.

Built on top of #99, it must be merged after that.

@mardy mardy marked this pull request as draft February 1, 2025 17:43
@mardy mardy force-pushed the shader-textures branch 2 times, most recently from bf6166c to 0e56aec Compare February 1, 2025 18:32
@mardy mardy marked this pull request as ready for review February 1, 2025 18:43
@mardy mardy mentioned this pull request Feb 3, 2025
@mardy mardy force-pushed the shader-textures branch from defe5d1 to 4932799 Compare March 15, 2025 08:41
mardy added 7 commits March 15, 2025 13:39
The association of a VBO to an array is to be saved in the client state:
we should look up the VBO only when we draw some geometry. The error was
discovered running the cube_tex example (it will be added to the repo in
a later commit), which uses two different VBOs for the position and
texture coordinate attributes.
This example uses SDL2 and glm. At the moment this example does not work
on the Wii/GameCube, as the textured rendering using OpenGL 2.0 will
come in a later commit.

The "common" directory contains textures that get embedded into the
executable, so that examples can be written without access to external
files (which makes testing on the console -- or on the emulator --
very straightforward).
Colors are often specifies as a 3 or 4 long vector of floats, but GX
does not support specifying colors using floating point components.
Therefore, convert such values to GXColor.
The data here is just an integer number representing the texture unit
bound to the uniform.
This is all what is needed to let the client developer write a GX shader
capable of supporting textured geometries.
This is a bit primitive, because we are hardcoding the texture stage and
other TEV variables (we'll improve this later), but it does the job.
To make clear that these functions are to be called only when
implementing shaders in the client code, rename them to have a
"ogx_shader" prefix. Also use the "_gx" or "_gl" suffix to indicate
whether they expect the matrix to be in the GX or OpenGL format.
@mardy mardy force-pushed the shader-textures branch from 4932799 to 41a7cf4 Compare March 15, 2025 10:39
@WinterMute WinterMute merged commit 41a7cf4 into devkitPro:master Mar 24, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants