Issues working with the Compute Shader Functionality -- Basic Example #2734
Replies: 3 comments 2 replies
-
So I spent some time digging through rlgl.h, the Khronos docs, and some blogs and was able to put together a basic example using (mostly) the raw GL functions. Not sure why this works but the rlgl (which is almost identical) doesn't. |
Beta Was this translation helpful? Give feedback.
-
Make sure your raylib is compiled with support for opengl 4.3. See #2911 (comment) |
Beta Was this translation helpful? Give feedback.
-
Don't use raylib - use godot. There are fully working compute shaders. Why do you need this raylib? |
Beta Was this translation helpful? Give feedback.
-
Hello,
I'm having trouble getting a compute shader to work with any functionality. My goal is to pass in an image (or image data), and pass out an output image generated pixel by pixel that I can render to the screen; ideally with the built-in DrawTexture().
I have simplified my code in an attempt to output a single float, written as a constant in the compute shader. I'm also new to Shaders so I may have missed something--but I can't tell what.
Excerpts:
[...]
//Qualify internal format of the (previously) set up output image
layout(std430, binding = 0) buffer rbcLayout{
float rbcBufferDest;
};
void main(){
[...]
rbcBufferDest = 0.25;
}
In the main file, I'm trying to use
rlReadShaderBufferElements(ssboA, &temp, sizeof(float), 0);
to read the data back into a float. However, printing this value returns either -0.000000 or -nan. I've been trawling through various documentation and tutorials/blogs all day to no avail.I believe my Raylib and openGL versions are up to date (4.2 and 4.6 respectively).
Thank you to anyone who can give me some advice.
Oh right my compile command is:
gcc -std=c++11 wave8.cpp -lraylib -lGL -lm -lpthread -lrt -lX11 -o wave8.run
I read that hardware could cause issues--I'm running a Radeon RX480 with Ryzen 5 2600X, on an x470 motherboard.
rbc.glsl.txt
rbc_render.glsl.txt
terminalOutput.txt
wave8.cpp.txt
Beta Was this translation helpful? Give feedback.
All reactions