diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-11-25 04:11:52 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-11-25 04:11:52 +0100 |
| commit | 20de4f3f7291c59a3d22a88f6934b2aaa3f7bb8f (patch) | |
| tree | a43304efe316960bdab19af7d605ff9c3a12b283 /Backends/CairoBackend/src/GLDevice.cs | |
| parent | b25ad7a6e15a7284e40407377a1624747ffe42e5 (diff) | |
vkvg backend nearly ok, refresh problem
Diffstat (limited to 'Backends/CairoBackend/src/GLDevice.cs')
| -rw-r--r-- | Backends/CairoBackend/src/GLDevice.cs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Backends/CairoBackend/src/GLDevice.cs b/Backends/CairoBackend/src/GLDevice.cs index c7992b74..d90fe1a0 100644 --- a/Backends/CairoBackend/src/GLDevice.cs +++ b/Backends/CairoBackend/src/GLDevice.cs @@ -2,6 +2,9 @@ // // This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) using System; +using Drawing2D; +using OpenGL; +using static OpenGL.Gl; namespace Crow.CairoBackend { @@ -11,6 +14,15 @@ namespace Crow.CairoBackend public void SetThreadAware (bool value) { NativeMethods.cairo_gl_device_set_thread_aware (handle, value ? 1 : 0); } + public virtual ISurface CreateSurface(int width, int height) { + uint tex = GenTexture (); + BindTexture (TextureTarget.Texture2d, tex); + TexImage2D (TextureTarget.Texture2d, 0, InternalFormat.Rgb, width, height, + 0, PixelFormat.Rgb, PixelType.UnsignedByte, 0); + TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureMagFilter, NEAREST); + TexParameteri(TextureTarget.Texture2d, TextureParameterName.TextureMinFilter, NEAREST); + return new GLSurface (this, Content.ColorAlpha, tex, width, height); + } } } |