opentk / GLControl

WinForms control for OpenTK 4.x.
https://opentk.net
Other
54 stars 24 forks source link

GLControl 3 to 4 Migration Questions #20

Closed sdreb3421 closed 2 years ago

sdreb3421 commented 2 years ago
  1. The old GLControl constructor could take a GraphicsMode object where the color bits, depth bits, stencil bits and sample count was specified. I've found that the new contructor takes GlControlSettings, but it appears that only sample count can be set. Where to set the remaining bit values?
  2. If creating the control programmatically, is it necessary to set the API, API Version, and compatibility? What should they be set to? Is this the version of OpenTK seen in Nuget, or is it the version set at the top of the shader (ie # version 330 core)? I'm currently using new GLControlSettings() { NumberOfSamples = 8, API = ContextAPI.OpenGL, APIVersion = new Version("3.3.0.0"), Profile = ContextProfile.Core };
NogginBops commented 2 years ago

It does seem like the color, depth and stencil bits settings are missing from the version 4 control, it should be quite easy to make a fix for it. I'll make a new issue to track this.

For API, APIVersion and Profile, yes you want to set these values. API you want to set to OpenGL, APIVersion you want to set to the OpenGL version you are targeting. And Profile you most likely want to set to Core, but if you have old OpenGL code you might need to set it to Compatibility.

sdreb3421 commented 2 years ago

Thank you! So I'm assuming that if I'm using the OpenGL4 using statements that the version should be 4.0.0?

NogginBops commented 2 years ago

The OpenGL4 namespace has an unfortunate name, what it really means it that the namespace only contains the "modern" opengl functions. You can use the OpenGL4 namespace using OpenGL 3.1 thru 4.6. So you don't necessarily need to target 4.0, you can also target 4.6 or something like 4.1 (4.1 is the highest OpenGL version macos supports).

seanofw commented 2 years ago

Since @NogginBops implemented this, I'm going to close this issue. You can open another issue if there's still functionality that's missing.