Possible issue regarding some enums and constants
frabert opened this issue · comments
According to the specifications, glTexParameter
should accept TextureTarget
as the first argument and a TextureParameter
as the second, for example GL_TEXTURE_MAX_LEVEL
.
However, in OpenGL.NET both GL_TEXTURE_MAX_LEVEL
and GL_TEXTURE_2D
belong to the TextureTarget
enum, making it impossible to set some parameters.
This may be a problem with the code generation system so other constants might be affected as well.
Example code:
// Standard C code
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, mipMapCount);
// Expected C# code
Gl.TexParameterI(TextureTarget.Texture2d, TextureParameter.TextureMaxLevel, mipMapCount); // TextureParameter doesn't contain the member TextureMaxLevel
Sadly, the code generator is fine; the cause of the problem is related directly with the XML specification offered by Khronos. I got quite a few problem about it, and the code generator is able to add missing enumeration using its configuration files.
Currently my workaround is a simple cast:
Gl.TexParameter(TextureTarget, (TextureParameterName)Gl.TEXTURE_MAX_LEVEL, _MipmapMaxLevel);
or using the other overload
Gl.TexParameter((int)TextureTarget, Gl.TEXTURE_MAX_LEVEL, _MipmapMaxLevel);
but this misses the point of having the enumerations.
....
Indeed I can easily add missing TextureParameterName
enumeration value, but sadly TextureTarget has some wrong enumerants. This is the current Khronos definition:
<group name="TextureTarget">
<enum name="GL_DETAIL_TEXTURE_2D_SGIS"/>
<enum name="GL_PROXY_TEXTURE_1D"/>
<enum name="GL_PROXY_TEXTURE_1D_EXT"/>
<enum name="GL_PROXY_TEXTURE_2D"/>
<enum name="GL_PROXY_TEXTURE_2D_EXT"/>
<enum name="GL_PROXY_TEXTURE_3D"/>
<enum name="GL_PROXY_TEXTURE_3D_EXT"/>
<enum name="GL_PROXY_TEXTURE_4D_SGIS"/>
<enum name="GL_TEXTURE_1D"/>
<enum name="GL_TEXTURE_2D"/>
<enum name="GL_TEXTURE_3D"/>
<enum name="GL_TEXTURE_3D_EXT"/>
<enum name="GL_TEXTURE_3D_OES"/>
<enum name="GL_TEXTURE_4D_SGIS"/>
<enum name="GL_TEXTURE_BASE_LEVEL"/>
<enum name="GL_TEXTURE_BASE_LEVEL_SGIS"/>
<enum name="GL_TEXTURE_MAX_LEVEL"/>
<enum name="GL_TEXTURE_MAX_LEVEL_SGIS"/>
<enum name="GL_TEXTURE_MAX_LOD"/>
<enum name="GL_TEXTURE_MAX_LOD_SGIS"/>
<enum name="GL_TEXTURE_MIN_LOD"/>
<enum name="GL_TEXTURE_MIN_LOD_SGIS"/>
</group>
Probably this issue should be forwarded to Khronos bug tracking system. In the meanwhile, I'll check those two enumerations (again 😄)
Thanks for the prompt response, I am doing some research on the OpenGL Registry and this looks to be the place to report issues with the API specs: https://github.com/KhronosGroup/OpenGL-API
It's pretty barren, but I shall try and file an issue anyways...
I think the correct bug tracking system is https://www.khronos.org/bugzilla/.
The relevant section seems to be closed to new bug submissions, pointing at the Github repository instead...