public GLRenderer(bool rendererVisible) { var mode = new GraphicsMode(new ColorFormat(32), 24, 0, 0, ColorFormat.Empty, 1); var win = new GameWindow(1920, 1080, mode, "NightcoreStudio Renderer", GameWindowFlags.FixedWindow, DisplayDevice.Default, 3, 3, GraphicsContextFlags.Default); win.Visible = rendererVisible; if (!rendererVisible) { win.WindowBorder = WindowBorder.Hidden; } win.MakeCurrent(); window = win; ImageShader = new ImageShader(); FlatShader = new FlatShader(); GL.Enable(EnableCap.Texture2D); GL.ClearColor(Color.Purple); GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha); ProjectionMatrix = Matrix4.CreateOrthographicOffCenter(0f, 1920f, 1080f, 0f, 0.0f, 1.0f); Models.BuildModels(); }
public void DrawImage(Texture image, int x, int y, int width, int height) { ImageShader.Bind(); image.Bind(); ImageShader.ProjectionMatrix = ProjectionMatrix; ImageShader.ModelMatrix = Matrix4.CreateScale(width, height, 1.0f) * Matrix4.CreateTranslation(x, y, 0); Models.Rectangle.Draw(); image.Unbind(); ImageShader.Unbind(); }