© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
3 replies
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
image.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Silk.NET.OpenGL + Silk.NET.SDL, can't render vertexes/shapes
C#CC# / help
3mo ago
❔ OpenGL / Silk.NET - uniform not found on shader
C#CC# / help
3y ago
Does anyone know how to flip textures in Silk.NET OpenGL?
C#CC# / help
16mo ago
Sdl constants in Silk.NET
C#CC# / help
3y ago