OpenGL...Common(3pm)

πŸ“¦
version 0.7004 Β· 2 versions
, in debian trixie, ubuntu resolute

πŸ’– 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