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

Support various ways for Perl code to use OpenGL (C pointers, packed strings, ndarrays, etc) #47

Open
devel-chm opened this issue Feb 24, 2017 · 1 comment

Comments

@devel-chm
Copy link
Collaborator

See the recent post to the POGL developers list for the initial discussion. The idea is that rather than 1-off implementations of OpenGL bindings for each type of possible array/pointer-ish object (OpenGL::Array, PDL, ...) we would implement a role to implement and require the needed functionality.

The implementation for an argument would then be something like this:

    sub glRoutine ($data_arg) {
        die "No bindings for data arg" unless $data_arg->does(OpenGL::Modern::Role::DataArg);
        # now we can use the role to implement the bindings
        &glRoutine_xs($data_arg->size,,$data_arg->ptr);
    }
@mohawk2
Copy link
Contributor

mohawk2 commented Sep 16, 2024

My summary of that discussion: some sort of polymorphism where a "class" of using code knows how to unwrap its data for OpenGL use, with an interface role providing the cue that that using code can do so.

My feeling is that there may be some value to this, but an alternative is for this distro to provide facilities for other Perl code to make their own bindings into OpenGL, by making available:

  • paths (like an Alien module)
  • lists of OpenGL extensions / functions / signatures
  • maybe utility functions to help generate XS code suitable for each using code's needs

This is effectively the approach taken by the PDL bindings, which knows much better how to scale up OpenGL stuff (using broadcasting) than a thing done once per small-scale "thing" (single Perl array/vector). The way forward would be to let a hundred flowers bloom, and then identify what they have in common. Having worked with the PDL POGL bindings, and created a PDL OpenCV binding, my suspicion is that what will be in common will most usefully be the above.

With that in mind, this issue is too vague to really be actionable, but the link to the discussion is useful, so it should stay open for now.

@mohawk2 mohawk2 changed the title use roles to implement bindings to pointer args Support various ways for Perl code to use OpenGL (C pointers, packed strings, ndarrays, etc) Sep 16, 2024
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