C
C#13mo ago
Stigl

✅ Problem with SIlk.Net.OpenGL

So, i am trying to make a simple app in opengl using silk.net. I wrote a simple code for it made up from some examples, but my screen doesnt seem to be clearing to correct color etc. Code:
#pragma warning disable CS8602
using System.Drawing;
using Silk.NET.Maths;
using Silk.NET.Windowing;
using Silk.NET.OpenGL;
GL? gl = null;

WindowOptions options = WindowOptions.Default;
options.Size = new Vector2D<int>(800,600);
options.Title = "Hello, world";
IWindow w = Window.Create(options);

w.Load += onLoad;
w.Update += onUpdate;
w.Render += onRender;

w.Run();
void onLoad(){
gl = GL.GetApi(w.GLContext);
gl.ClearColor(Color.Blue);
}
void onUpdate(double deltaTime){
}
void onRender(double deltaTime){
gl.ClearColor(Color.Blue);
}
#pragma warning disable CS8602
using System.Drawing;
using Silk.NET.Maths;
using Silk.NET.Windowing;
using Silk.NET.OpenGL;
GL? gl = null;

WindowOptions options = WindowOptions.Default;
options.Size = new Vector2D<int>(800,600);
options.Title = "Hello, world";
IWindow w = Window.Create(options);

w.Load += onLoad;
w.Update += onUpdate;
w.Render += onRender;

w.Run();
void onLoad(){
gl = GL.GetApi(w.GLContext);
gl.ClearColor(Color.Blue);
}
void onUpdate(double deltaTime){
}
void onRender(double deltaTime){
gl.ClearColor(Color.Blue);
}
When i try to do test print in the onLoad and onRender, it works just fine. But the screen is black instead of blue how i clearly said it so
No description
3 Replies
Stigl
StiglOP13mo ago
Nevermind, doing gl.Clear(ClearBufferMask.ColorBufferBit); fixed it
lycian
lycian13mo ago
Please /close if this is resolved 🙂
Stigl
StiglOP13mo ago
/close

Did you find this page helpful?