I've never used raylib, but my initial guess is that you're either missing a step, or doing something out-of-order from what the library expects.
It's hard to diagnose your problem based on a single line of code. Can you create a new program that only loads the texture, then post the full source code? That will make it easier to trace through the steps and figure out if you're missing something, doing something wrong, etc.
Raylib is similar to OpenGL (I think it even uses OpenGL BTS).
Here is a minimal example:
packagemain;import"github.com/gen2brain/raylib-go/raylib";// Main function (program entrypoint).funcmain(){vartexrl.Texture2D=rl.LoadTexture("test.jpg");rl.InitWindow(500,500,"Raylib test.");for!rl.WindowShouldClose(){rl.ClearBackground(rl.Black);rl.DrawTexture(tex,0,0,rl.Blank);}}
And I get a pretty similar result to the last (except jpg isn't a supported format, for some reason (not like I use jpg, but I still care about them)).
NOTE: I tried adding rl.UnloadTexture(tex) after the window initialization, and I tried putting it after the for loop. When I do this, the window does appear this time, but it instantly closes, and provides the same (or similar) error (I didn't look too carefully, since they seem the same).
With that said, I can tell it's an issue with rl.LoadTexture(string), and not me, or rl.UnloadTexture(rl.Texture2D).
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I've never used raylib, but my initial guess is that you're either missing a step, or doing something out-of-order from what the library expects.
It's hard to diagnose your problem based on a single line of code. Can you create a new program that only loads the texture, then post the full source code? That will make it easier to trace through the steps and figure out if you're missing something, doing something wrong, etc.
Raylib is similar to OpenGL (I think it even uses OpenGL BTS).
Here is a minimal example:
And I get a pretty similar result to the last (except
jpg
isn't a supported format, for some reason (not like I usejpg
, but I still care about them)).NOTE: I tried adding
rl.UnloadTexture(tex)
after the window initialization, and I tried putting it after thefor
loop. When I do this, the window does appear this time, but it instantly closes, and provides the same (or similar) error (I didn't look too carefully, since they seem the same).With that said, I can tell it's an issue with
rl.LoadTexture(string)
, and not me, orrl.UnloadTexture(rl.Texture2D)
.