Help-Site Computer Manuals
Software
Hardware
Programming
Networking
  Algorithms & Data Structures   Programming Languages   Revision Control
  Protocols
  Cameras   Computers   Displays   Keyboards & Mice   Motherboards   Networking   Printers & Scanners   Storage
  Windows   Linux & Unix   Mac

OpenGL::Shader::Common
copyright 2007 Graphcomp - ALL RIGHTS RESERVED Author: Bob "grafman" Free - grafman@graphcomp.com

OpenGL::Shader::Common - copyright 2007 Graphcomp - ALL RIGHTS RESERVED Author: Bob "grafman" Free - grafman@graphcomp.com


NAME


  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();
Programminig
Wy
Wy
yW
Wy
Programming
Wy
Wy
Wy
Wy