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
Shader does not render correctly until rl.DrawGrid(0, 1.0) is called once #326
Comments
Oh, and important to note that this bug is present for versions v4.5.0 and v5.0.0 of this binding. github.com/gen2brain/raylib-go/raylib v0.0.0-20230511170620-d84e4cc82f8d // indirect - version 4.5.0 Unsure if it is an issue with the bindings or raylib. |
@Gishblade Maybe you are missing a |
I've got the Begin/End for both BeginDrawing and BeginMode3D. I don't think there's a third one needed? |
Is this an issue with just the Go bindings or Raylib in general? |
// Draw a grid centered at (0, 0, 0)
void DrawGrid(int slices, float spacing)
{
int halfSlices = slices/2;
rlBegin(RL_LINES);
for (int i = -halfSlices; i <= halfSlices; i++)
{
if (i == 0)
{
rlColor3f(0.5f, 0.5f, 0.5f);
rlColor3f(0.5f, 0.5f, 0.5f);
rlColor3f(0.5f, 0.5f, 0.5f);
rlColor3f(0.5f, 0.5f, 0.5f);
}
else
{
rlColor3f(0.75f, 0.75f, 0.75f);
rlColor3f(0.75f, 0.75f, 0.75f);
rlColor3f(0.75f, 0.75f, 0.75f);
rlColor3f(0.75f, 0.75f, 0.75f);
}
rlVertex3f((float)i*spacing, 0.0f, (float)-halfSlices*spacing);
rlVertex3f((float)i*spacing, 0.0f, (float)halfSlices*spacing);
rlVertex3f((float)-halfSlices*spacing, 0.0f, (float)i*spacing);
rlVertex3f((float)halfSlices*spacing, 0.0f, (float)i*spacing);
}
rlEnd();
} @Gishblade @gen2brain |
oh, so in my case raylib needs rl.Begin() to render correctly, and the examples mostly get away without explicitly calling rl.Begin() because they happen to call DrawGrid() which calls into rl.Begin() ? |
Is it intended for users to call rlBegin() themselves? I don't see a Begin() method in the cheetsheet (just BeginDrawing, BeginMode2D, BeginMode3D, etc.) |
|
I've noticed a weird issue where my shader does not work correctly until
rl.DrawGrid(0, 1.0)
is called at least once(it does not need to be called every frame)
Video of Bug:
https://www.youtube.com/watch?v=lKa4bVZqznE
I suspect it is related to how textures get loaded in the shader.
My rendering loop is
when
modelCase != 2
it does not use my shader at all, and code works as expected (even when not callingrl.DrawGrid(0, 1.0)
.My custom shader is
Importantly, if I change
to
It renders the models original texture (what is being passed by
texture0
) just fine.So the issue seems to be that it does not load the
arguments correctly until after
rl.DrawGrid(0, 1.0)
is called for some reason.The text was updated successfully, but these errors were encountered: