Skip to content

GLEW_VERSION_2_0 and others all seem to be 0 #38

Closed
@devel-chm

Description

@devel-chm
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

Activity

wchristian

wchristian commented on Feb 14, 2017

@wchristian
Collaborator

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

devel-chm

devel-chm commented on Feb 14, 2017

@devel-chm
CollaboratorAuthor
wchristian

wchristian commented on Feb 14, 2017

@wchristian
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

devel-chm commented on Feb 15, 2017

@devel-chm
CollaboratorAuthor

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

wchristian commented on Feb 16, 2017

@wchristian
Collaborator

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

wchristian

wchristian commented on Feb 16, 2017

@wchristian
Collaborator

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

devel-chm commented on Feb 16, 2017

@devel-chm
CollaboratorAuthor

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

wchristian

wchristian commented on Feb 16, 2017

@wchristian
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

devel-chm commented on Feb 17, 2017

@devel-chm
CollaboratorAuthor

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

wchristian commented on Feb 17, 2017

@wchristian
Collaborator

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

devel-chm

devel-chm commented on Feb 17, 2017

@devel-chm
CollaboratorAuthor
wchristian

wchristian commented on Feb 17, 2017

@wchristian
Collaborator

By what mechanism would you change them?

devel-chm

devel-chm commented on Feb 17, 2017

@devel-chm
CollaboratorAuthor

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

wchristian commented on Feb 17, 2017

@wchristian
Collaborator
devel-chm

devel-chm commented on Feb 21, 2017

@devel-chm
CollaboratorAuthor

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @wchristian@devel-chm

        Issue actions

          GLEW_VERSION_2_0 and others all seem to be 0 · Issue #38 · Perl-GPU/OpenGL-Modern