HappyEmu's picture

GUI: Gwen OpenTK Renderer

Hi folks

I plan to include some kind of GUI into one of my recent OpenTK projects and I selected a C# port of the Gwen GUI framework (https://code.google.com/p/gwen-dotnet/). I downloaded the latest snapshot and tried out the OpenTK Sample. I noticed that the included renderer is drawing quads and is using now deprecated vertex arrays. Since my project is targeting OpenGL version 4.3 I can't really use the OpenTK Renderer included in the project without a fair bit of modification.

Does anybody know if there is already a more modern renderer that works well with newer OpenGL versions? Right now, I am working on a version that is using VBOs, but if there already exists a more "convenient" option, I'd be very grateful if you could point that out to me.

Thanks and greetings


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
xenapior's picture

Why not create a forward-compatible context? It is designed for porting legacy code. If the code just WORKS, then leave it there. You can use 4.3 features and transform the data into vertex arrays when calling Gwen.
btw: In nvidia documents, they mentioned that using a core profile will not result any performance gain.

HappyEmu's picture

One reason not to use a forward-compatible context is the fact that I make heavy use of Nvidia Nsight for debugging purposes. Sadly, it does not support legacy OpenGL features such as the matrix stack (glMatrixMode), which, as far as I can tell, is used by the OpenTK renderer. I'm not sure whether vertex arrays are supported by Nsight, I'll have to test this. Also, I'm not sure if this fixed pipeline legacy stuff mixes well with my other stuff which heavily relies on shaders.

Edit: I just tested the unchanged renderer with a forward compatible 4.3 context using a Debug OpenTK build. Calls to "GL.Color4" or "GL.AlphaFunc" within the Gwen OpenTK renderer produce an "InvalidOperation" error.

Edit: First version using VBOs and shaders is working now although it's quite a bit slower than the client side vertex arrays version, presumably because the heavy use of GL.BufferSubData to update the VBOs multiple times per frame. But its working with a core context (should work from 3.0 onwards) and can be debugged using Nsight, so the problem is solved :-) I will probably upload the renderer .dll and sources once I cleaned up the code a bit.

publicENEMY's picture


Im also looking for using gwen.net in modern opengl environment.

If you released the renderer source, do let me know.