CXO2's picture

Is All Enums usable for all functions?

Hi
Let's straight to the point, Currently i am trying to translating C++ code into C# and its about Shader thingies.
this C++ code is using ARB Shader, and I found something missing enum on OpenTK.

It was about to create a Handle for Vertex Shader, here the C++ code:
GLhandleARB vertexShader = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB);

and I got confused cuz there not "VertexShaderARB" on ArbShaderObjects Enum
GL.Arb.CreateShaderObject(ArbShaderObjects.??????);

after exploring few enums, I found VertexShaderArb on All enum, but I cant use it like this:
GL.Arb.CreateShaderObject(All.VertexShaderArb); // Error!

So my question is about the All enum, is there a way to use it in CreateShaderObject() function?
if it can't is there any other solution?

Thank you so much ;)


Comments

Comment viewing options

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

You should be able to just insert an explicit cast to cast the value from the All enum to the ArbShaderObjects enum.
GL.Arb.CreateShaderObject((ArbShaderObjects)All.VertexShaderArb);

If this enum value should be part of the ArbShaderObjects enum raise a bug report or pull request at https://github.com/opentk/opentk

CXO2's picture

Its out of my mind
I wasn't thinking about that!

Thanks!

the Fiddler's picture

On hindsight, it would have been better to use the All enum in all functions that do not have typesafe enumerations (which includes most extensions functions). Doing that for the OpenGL namespace is not practical now, for backward compatibility reasons, but the ES* and CL* extensions do take All enums directly.

That's something that could be revisited for a hypothetical 2.0 version in a few years (provided OpenGL still exists by then.)