-
-
04 Sep 2007 16:48:23 UTC
- Distribution: OpenGL-Shader
- Module version: 1.01
- Source (raw)
- Pod Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (2)
- Testers (61 / 10 / 1)
- Kwalitee
Bus factor: 2- % Coverage
- License: unknown
- Activity
24 month- Tools
- Download (9.81KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- OpenGL
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
OpenGL::Shader - copyright 2007 Graphcomp - ALL RIGHTS RESERVED Author: Bob "grafman" Free - grafman@graphcomp.com This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
DESCRIPTION
This module provides an extensible abstraction for managing OpenGL shaders. Requires OpenGL v0.56 or newer.
SYNOPSIS
########## # Load and manage a shader use OpenGL(':all'); use OpenGL::Shader; # Note: these APIs/methods requires a current GL context/window glutInit(); glutInitDisplayMode(GLUT_RGBA); glutInitWindowSize($w,$h); my $Window_ID = glutCreateWindow( "OpenGL::Shader test" ); # Get a hashref of shader types my $shaders = $OpenGL::Shader::GetTypes(); # Test for shader support my $ok = OpenGL::Shader::HasType('Cg'); # Instantiate a shader - list acceptable shaders by priority my $shdr = new OpenGL::Shader('GLSL','ARB'); # Get shader type and version my $type = $shdr->GetType(); my $ver = $shdr->GetVersion(); # Load shader by strings my $stat = $shdr->Load($fragment,$vertex); # Load shader by file my $stat = $shdr->LoadFiles($fragment_file,$vertex_file); # Enable $shdr->Enable(); # Get vertex attribute ID # returns undef if not supported or not found my $attr_id = $self->MapAttr($attr_name); glVertexAttrib4fARB($attr_id,$x,$y,$z,$w); # Get Global Variable ID (uniform/local) my $var_id = $self->Map($var_name); # Set float4 vector variable $stat = $self->SetVector($var_name,$x,$y,$z,$w); # Set float4x4 matrix via OGA $stat = $self->SetMatrix($var_name,$oga); # Do GL rendering # Disable $shdr->Disable(); # Done glutDestroyWindow($Window_ID);
Module Install Instructions
To install OpenGL::Shader, copy and paste the appropriate command in to your terminal.
cpanm OpenGL::Shader
perl -MCPAN -e shell install OpenGL::Shader
For more information on module installation, please visit the detailed CPAN module installation guide.