Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLEW_VERSION_2_0 and others all seem to be 0 #38

Closed
devel-chm opened this issue Feb 14, 2017 · 15 comments
Closed

GLEW_VERSION_2_0 and others all seem to be 0 #38

devel-chm opened this issue Feb 14, 2017 · 15 comments

Comments

@devel-chm
Copy link
Collaborator

I think something is missing. These routines do appear to be defined so you can get the values with no undefined sub messages. The values seem to always be zero. This makes it difficult to check for OpenGL functionality. This is for OpenGL::Modern 0.02

@wchristian
Copy link
Collaborator

At a guess: Their value is captured before createcontext, so glew can't actually tell you what the GL version is?

@devel-chm
Copy link
Collaborator Author

devel-chm commented Feb 14, 2017 via email

@wchristian
Copy link
Collaborator

Those constants are not generated from spec. They are set in glewContextInit in https://raw.githubusercontent.com/devel-chm/OpenGL-Modern/master/src/glew.c

GLEW_VERSION_2_0   = GLEW_VERSION_2_1   == GL_TRUE || ( major == 2               ) ? GL_TRUE : GL_FALSE;

and are otherwise defaulted to false:

GLboolean __GLEW_VERSION_2_0 = GL_FALSE;

So reading them before a context is initiated should be an error.

@devel-chm
Copy link
Collaborator Author

I was referring to the OpenGL constants, GL_* not the GLEW constants, GLEW_*
The OpenGL constants are set by the specification whether or not a system supports any specific functionality.

@wchristian
Copy link
Collaborator

Oh, might want to edit that title then. :)

@wchristian
Copy link
Collaborator

wchristian commented Feb 16, 2017

Or be a little more specific as to what code you consider to be broken, because on rereading this i'm confused as to what you're saying.

C:\Users\Mithaldu>perl -E "use strict; use warnings; use OpenGL::Modern ':all'; say 'v'.GL_VERSION_2_0()"
v1

C:\Users\Mithaldu>perl -E "use strict; use warnings; use OpenGL::Modern ':all'; say 'v'.GL_VERSION_4_5()"
v1

@devel-chm
Copy link
Collaborator Author

The missing/incorrect ones are GLEW_VERSION_M_N which are the ones to check if a particular OpenGL version is available.

@wchristian
Copy link
Collaborator

Alright, then these should, for all practical purposes, NEVER be constants. This is due to them being set at the time a context is created, which means even if their value is fetched late, it can change if the process switches to rendering on a different graphics card. (Which might not be that uncommon, even my 4 year old laptop has two.)

@devel-chm
Copy link
Collaborator Author

I think they will work if they were to use the AUTOLOAD implementation to have them defined post-glewInit. There are other issues with the current bindings that would need to be addressed to handle multiple contexts and the situations that might come up with features available.

@wchristian
Copy link
Collaborator

AUTOLOAD would still preclude changing their values at a later point.

@devel-chm
Copy link
Collaborator Author

devel-chm commented Feb 17, 2017 via email

@wchristian
Copy link
Collaborator

By what mechanism would you change them?

@devel-chm
Copy link
Collaborator Author

My current plan is to just have XS routines that return the value of the GLEW parameter values.
generate-XS.pl ignores those at the moment. It shouldn't be hard to add this to the code. I'll keep you posted.

@wchristian
Copy link
Collaborator

wchristian commented Feb 17, 2017 via email

@devel-chm
Copy link
Collaborator Author

The implementation is complete. Please follow up with any further problems in issue #46, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants