Skip to content
Discussion options

You must be logged in to vote

The texture isn't actually black, it's just never bound to iChannel0 for that draw call. The problem is call order: you call SetShaderValueTexture before BeginTextureMode/BeginShaderMode, and both of those flush the internal render batch, which wipes out the texture-unit registration you just made.

Here's the mechanism in rlgl.h:

  • SetShaderValueTexture → rlSetUniformSampler only sets glUniform1i(locIndex, 1+i) and stashes the texture id in RLGL.State.activeTextureId[i]. It does not bind the texture yet:

    raylib/src/rlgl.h

    Lines 4564 to 4589 in 6ecf21f

    void rlSetUniformSampler(int locIndex, unsigned int textureId)
    {
    #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHI…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@Kunutza
Comment options

Answer selected by raysan5
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants