08 Feb 2019 06:04:34 UTC
- Distribution: OpenGL-Sandbox
- Module version: 0.120
- Source (raw)
- Browse (raw)
- How to Contribute
- Testers (41 / 5 / 31)
- KwaliteeBus factor: 1
- % Coverage
- License: perl_5
- Perl: v5.14.0
- Activity24 month
- Download (93.41KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version
- Reverse dependencies
- CPAN Testers List
- Dependency graph
- COPYRIGHT AND LICENSE
OpenGL::Sandbox::Program - Wrapper object for OpenGL shader program pipeline
OpenGL shaders get combined into a pipeline. In older versions of OpenGL, there was only one program composed of a vertex shader and fragment shader, and attaching one of those shaders was a global change. In newer OpenGL, you may assemble multiple program pipelines and switch between them.
This class tries to support both APIs, by holding a set of shaders which you can then "bind". On newer OpenGL, this calls
glUseProgram. On older OpenGL, this changes the global vertex and fragment shaders to the ones referenced by this object.
Human-readable name of this program (not GL's integer "name")
Boolean; whether the program is ready to run. This is always 'true' for older global-program OpenGL.
A hashref of shaders, each of which will be attached to the program when it is activated. The keys of the hashref are up to you, and simply to help diagnostics or merging shader configurations together with defaults.
A convenient accessor for listing out the values of the "shader" hash.
The OpenGL integer 'name' of this program. On older OpenGL with the global program, this will always be
undef. On newer OpenGL, this should always return a value because accessing it will call
True if the id attribute has been lazy-loaded already.
Lazy-built hashref listing all uniforms of the compiled program.
Whether this has been lazy-built yet
Remove the cache, to be rebuilt on next use
Begin using this program as the active GL pipeline.
$selffor convenient chaining.
For relevant implementations, this attaches the shaders and links the program. If it fails, this throws an exception. For OpenGL 4 implementation, this only happens once, and any changes to "shaders" afterward are ignored. Use "unprepare" to remove the compiled state and be able to rearrange the shaders.
$selffor convenient chaining.
Release resources allocated by "prepare".
Return the attribute ID of the given name, for the prepared program.
Return the uniform ID of the given name, for the prepared program.
$prog->set_uniform( $name, \@values ); $prog->set_uniform( $name, $opengl_array );
Set the value of a uniform. This attempts to guess at the size/geometry of the uniform based on the number or type of values given.
Michael Conrad <firstname.lastname@example.org>
This software is copyright (c) 2019 by Michael Conrad.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Module Install Instructions
To install OpenGL::Sandbox, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install OpenGL::Sandbox
For more information on module installation, please visit the detailed CPAN module installation guide.