aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/OpenTKGameWindow.cs
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2015-09-21 08:30:08 +0200
committerjpbruyere <jp.bruyere@hotmail.com>2015-09-21 08:30:09 +0200
commitf662d49464e2b8326522aad67761ffdcb8a5e5f6 (patch)
treef767f75977721299da029518ec938bfa0366597b /src/OpenTKGameWindow.cs
parentdb3a636d9c4de1e4ee1d4e79e6dfeae738daac8d (diff)
* BmpPicture.cs:
allow unscalled picture * GraphicObject.cs: background image path, problems with repaint of background * Group.cs: background image * HorizontalStack.cs: clean code * Label.cs: debug * TemplatedContainer.cs: fix dataSource==null to clear binding successfully * Window.cs: resizable or not * OpenTKGameWindow.cs: RenderCustomTextureOnUIQuad (usefull for cached content) * Picture.cs: Scale boolean * ListBox.cs: remove debug loading time
Diffstat (limited to 'src/OpenTKGameWindow.cs')
-rwxr-xr-xsrc/OpenTKGameWindow.cs26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/OpenTKGameWindow.cs b/src/OpenTKGameWindow.cs
index ff1ffeed..ebe3735e 100755
--- a/src/OpenTKGameWindow.cs
+++ b/src/OpenTKGameWindow.cs
@@ -25,7 +25,7 @@ namespace go
// DisplayDevice.Default,
// 3,0,OpenTK.Graphics.GraphicsContextFlags.Default)
public OpenTKGameWindow(int _width, int _height, string _title="golib")
- : base(_width, _height, new OpenTK.Graphics.GraphicsMode(32, 24, 0, 8),
+ : base(_width, _height, new OpenTK.Graphics.GraphicsMode(32, 24, 0, 1),
_title,GameWindowFlags.Default,DisplayDevice.GetDisplay(DisplayIndex.Second),
3,2,OpenTK.Graphics.GraphicsContextFlags.Debug|OpenTK.Graphics.GraphicsContextFlags.ForwardCompatible)
// public OpenTKGameWindow(int _width, int _height, string _title="golib")
@@ -153,7 +153,7 @@ namespace go
byte[] bmp;
int texID;
- QuadVAO uiQuad;
+ public QuadVAO uiQuad, uiQuad2;
go.GLBackend.Shader shader;
Matrix4 projectionMatrix,
modelviewMatrix;
@@ -166,6 +166,7 @@ namespace go
if (uiQuad != null)
uiQuad.Dispose ();
uiQuad = new QuadVAO (0, 0, ClientRectangle.Width, ClientRectangle.Height, 0, 1, 1, -1);
+ uiQuad2 = new QuadVAO (0, 0, ClientRectangle.Width, ClientRectangle.Height, 0, 0, 1, 1);
projectionMatrix = Matrix4.CreateOrthographicOffCenter
(0, ClientRectangle.Width, ClientRectangle.Height, 0, 0, 1);
modelviewMatrix = Matrix4.Identity;
@@ -217,6 +218,23 @@ namespace go
shader.Disable ();
GL.Viewport (viewport [0], viewport [1], viewport [2], viewport [3]);
}
+ public void RenderCustomTextureOnUIQuad(int _customTex)
+ {
+ GL.GetInteger (GetPName.Viewport, viewport);
+ GL.Viewport (0, 0, ClientRectangle.Width, ClientRectangle.Height);
+ shader.Enable ();
+ shader.ProjectionMatrix = projectionMatrix;
+ shader.ModelViewMatrix = modelviewMatrix;
+ shader.Color = new Vector4(1f,1f,1f,1f);
+ GL.ActiveTexture (TextureUnit.Texture0);
+ GL.BindTexture (TextureTarget.Texture2D, _customTex);
+ GL.Disable (EnableCap.DepthTest);
+ uiQuad2.Render (PrimitiveType.TriangleStrip);
+ GL.Enable (EnableCap.DepthTest);
+ GL.BindTexture(TextureTarget.Texture2D, 0);
+ shader.Disable ();
+ GL.Viewport (viewport [0], viewport [1], viewport [2], viewport [3]);
+ }
#endregion
@@ -310,10 +328,6 @@ namespace go
// Debug.WriteLine("UPDATE: {0} ticks \t, {1} ms",
// updateTime.ElapsedTicks,
// updateTime.ElapsedMilliseconds);
- //update Mouse cursor
- if (_hoverWidget is Window) {
-
- }
}
#endregion