OpenGL...Common(3pm)
π OpenGL::Shader::Common π
okay bestie, welcome to OpenGL...Common(3pm) β the perl manual page you didn't know you needed. This is a User Contributed Perl Documentation situation, and it's giving backstage pass to the shader party. π
β¨ NAME β¨
OpenGL::Shader::Common β base class for use with OpenGL::Shader. She's the mother of shader types, the blueprint, the blueprint-est. π
πΈ SYNOPSIS πΈ
Instantiate a shader, bestie. It's literally two lines. Two. You got this.
# Instantiate a shader
use OpenGL::Shader;
my $shdr = new OpenGL::Shader();
π¦ DESCRIPTION π¦
So here's the tea: this module provides a base class for OpenGL shader types. That's her whole job. She's not out here doing the shader work herself β she's the common ground the subclasses stand on. π§
Example usage: (and yes, every single line is here, I'm not skipping a crumb π )
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();
Notice the two little neighborhoods in that block, bestie: the first ########## section is methods defined in this module, and the second one is methods defined in subclasses. She provides the base; the subclasses bring the flavor. π
π AUTHOR π
Bob "grafman" Free β grafman@graphcomp.com. Copyright 2007 Graphcomp β ALL RIGHTS RESERVED. π’
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. (fr fr, go wild within the rules π«Ά)
and that's a wrap, angel π this page is perl v5.40.1, dated 2025-03-21, and it ate. no cap. periodt. π β¨
π¦ where this page comes from
- debian trixie: libopengl-perl 0.7004+dfsg-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libopengl-perl 0.7004+dfsg-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms