[Image] `Attempted to read or write protected memory` When trying make a texture from image
VincentHill opened this issue · comments
Before submitting a new issue, please verify and check:
- The issue is specific to Raylib-cs and not raylib
- I checked there is no similar issue already reported
- My code has no errors or misuse of Raylib-cs
Issue description
Trying to make a texture from an image I got this error.
Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Repeat 2 times:
--------------------------------
at Raylib_cs.Raylib.LoadTextureFromImage(Raylib_cs.Image)
Environment
Platform: x86
OS: Windows 11
OpenGL: 4.60
Raylib-cs: 4.5.0.2
Code example
Image img = GenImageColor(256, 256, Color.WHITE);
Texture2D tx = LoadTextureFromImage(img);
Is the program calling LoadTextureFromImage before InitWindow? It should be called after as it requires the OpenGL context created by InitWindow to work.
yes that was issue, thank for your time.