OpenGL::Shader::Common - 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 a base class for OpenGL shader types.
Requires the OpenGL module.
SYNOPSIS
##########
# Instantiate a shader
use OpenGL::Shader;
my $shdr = new OpenGL::Shader();
##########
# Methods defined in this module:
# Get shader type.
my $type = $shdr->GetType();
# Get shader version
my $ver = $shdr->GetVersion();
# Get shader description
my $desc = $shdr->GetDescription();
# Load shader files.
my $stat = $shdr->LoadFiles($fragment_file,$vertex_file);
# Get shader GL constants.
my $fragment_const = $shdr->GetFragmentConstant();
my $vertex_const = $shdr->GetVertexConstant();
# Get objects.
my $fragment_shader = $shdr->GetFragmentShader();
my $vertex_shader = $shdr->GetVertexShader();
my $program = $shdr->GetProgram();
##########
# Methods defined in subclasses:
# Load shader text.
$shdr->Load($fragment,$vertex);
# Enable shader.
$shdr->Enable();
# Set Vertex Attribute
my $attr_id = $self->MapAttr($attr_name);
glVertexAttrib4fARB($attr_id,$x,$y,$z,$w);
# Get Global Variable ID (uniform/env)
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);
# Disable shader.
$shdr->Disable();
# Destructor.
$shdr->DESTROY();
Module Install Instructions
To install OpenGL::Shader, copy and paste the appropriate command in to your terminal.