-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rlgl] Custom shaders called with rlLoadDrawQuad()
cannot fetch data from texture uniforms.
#4568
Comments
@mikeemm Considering you are using Note that |
@raysan5 I tried that before, and neither |
@mikeemm Ok, reopening it. |
rlLoadDrawQuad()
cannot fetch data from texture uniforms.
Turns out before you set the sampler uniform you have to bind the texture using However, the other reason this doesn't work is because So this doesn't work:
But this does:
This behavior must be intentional so that it works together with other drawing functions, which seem to set a default texture to texture unit 0 - my question is, where and why is this texture added? It seems incoherent that |
Issue description
TL;DR: Shaders made with rlLoadDrawQuad() can't seem to reliably access sampler2D uniforms via texture or texelFetch.
In my program I render a 3D scene into a RenderTexture. I then call rlLoadDrawQuad with a custom shader to load the previous texture, filter it and render to another RenderTexture, which I then output to the screen. However, it seems rlLoadDrawQuad cannot access uniform texture data when it is being called after BeginTextureMode(); removing that and outputting directly into the screen fixes this, but then I can't do further operations with that RenderTexture.
However, when attempting to create a small code sample to share here, I couldn't get rlLoadDrawQuad() to load a texture at all, even when outputting directly to the screen. Everything else in the shaders work correctly, the uniform location is found and the texture coordinates display fine onscreen, but all shader data is black no matter what texture it tries to access despite the image being loaded. I'm not sure where the problem is at this point to be honest.
Environment
Desktop (GLFW)
Windows 10 64-bit
GPU NVIDIA GeForce RTX 3050 Laptop GPU/PCIe/SSE2
OpenGL: 3.3.0 NVIDIA 537.13
GLSL: 3.30 NVIDIA via Cg compiler
Code Example
The code below should output whatever image you load up as example.png, but instead draws blank.
main.c:
rendertexture_VP.glsl:
rendertexture_FP.glsl:
The text was updated successfully, but these errors were encountered: