arbeit
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

PShaderTxt Class Reference

#include <PShaderTxt.h>

List of all members.


Detailed Description

editable text for a shader must be created in conjunction with a "gl" window, needs context to load programs

Definition at line 35 of file PShaderTxt.h.

Public Types

enum  SUPPORTED_SHADERS {
  NOT_LOADED, UNKNOWN, ARB_FP, ARB_VP,
  SHADER_LAST
}

Public Slots

void loadShader ()
 load Shader

void loadShader (glift::ProgShaderSP shader)
 load shader, from glift shader

void loadShaderFromFile (const QString &fname)
 load Shader from file

void loadShaderFromText (const QString &text)
 load Shader from text

void saveShader (const QString &lastPath)
 save shader

void saveShaderAs (const QString &lastPath)
 save shader as

void closeShader (const QString &lastPath)
 close shader


Signals

void initAFP (glift::FragProgARBSP fp)
void initAVP (glift::VertexProgARBSP vp)

Public Member Functions

 PShaderTxt (const QGLContext *ctx, QWidget *parent, const char *name=0, WFlags wf=0)
 PShaderTxt (const QGLContext *ctx, glift::ProgShaderSP s, QWidget *parent, const char *name=0, WFlags wf=0)
virtual ~PShaderTxt ()
int getShaderType () const
QString getFileName ()
 load Shader


Protected Member Functions

void conf ()
bool castShader ()
 false for success, true for failure

int getErrorPos (std::string s)
 highlight the error text


Protected Attributes

QMultiLineEdit * _mle
glift::ProgShaderSP _shader
 this should always exist

glift::FragProgARBSP _fpshader
 these depend on the shader loaded

glift::VertexProgARBSP _vpshader
const QGLContext * _ctx
ErrTxtWin_errw
int _stype


Member Enumeration Documentation

enum PShaderTxt::SUPPORTED_SHADERS
 

Enumeration values:
NOT_LOADED 
UNKNOWN 
ARB_FP 
ARB_VP 
SHADER_LAST 

Definition at line 42 of file PShaderTxt.h.


Constructor & Destructor Documentation

PShaderTxt::PShaderTxt const QGLContext *  ctx,
QWidget *  parent,
const char *  name = 0,
WFlags  wf = 0
 

Definition at line 33 of file PShaderTxt.cpp.

References _errw, _mle, and name.

PShaderTxt::PShaderTxt const QGLContext *  ctx,
glift::ProgShaderSP  s,
QWidget *  parent,
const char *  name = 0,
WFlags  wf = 0
 

PShaderTxt::~PShaderTxt  )  [virtual]
 

Definition at line 53 of file PShaderTxt.cpp.


Member Function Documentation

bool PShaderTxt::castShader  )  [protected]
 

false for success, true for failure

fragment program ARB

vertex program ARB

catch all, don't know what to do??

Definition at line 456 of file PShaderTxt.cpp.

References _fpshader, _shader, _stype, _vpshader, ARB_FP, ARB_VP, gutz::SmartPtr< ProgShader >::getPtr(), and gutz::SmartPtr< ProgShader >::isNull().

Referenced by loadShader(), loadShaderFromFile(), and loadShaderFromText().

void PShaderTxt::closeShader const QString &  lastPath  )  [slot]
 

close shader

Definition at line 438 of file PShaderTxt.cpp.

References _mle, loadShader(), and saveShader().

Referenced by PShaderWin::closeShader().

void PShaderTxt::conf  )  [protected]
 

int PShaderTxt::getErrorPos std::string  s  )  [protected]
 

highlight the error text

arb style error position at a specific character

Definition at line 489 of file PShaderTxt.cpp.

References ARB_ERR_CHAR(), s, and string.

Referenced by loadShader(), loadShaderFromFile(), and loadShaderFromText().

QString PShaderTxt::getFileName  ) 
 

load Shader

Definition at line 61 of file PShaderTxt.cpp.

References _fpshader, _shader, _stype, ARB_FP, ARB_VP, and gutz::SmartPtr< ProgShader >::isNull().

Referenced by PShaderWin::addShader(), PShaderWin::openShader(), PShaderWin::saveShader(), and PShaderWin::saveShaderAs().

int PShaderTxt::getShaderType  )  const [inline]
 

Definition at line 49 of file PShaderTxt.h.

References _stype.

Referenced by PShaderWin::addShader(), PShaderWin::newARBFP(), PShaderWin::newARBVP(), and PShaderWin::openShader().

void PShaderTxt::initAFP glift::FragProgARBSP  fp  )  [signal]
 

void PShaderTxt::initAVP glift::VertexProgARBSP  vp  )  [signal]
 

void PShaderTxt::loadShader glift::ProgShaderSP  shader  )  [slot]
 

load shader, from glift shader

set the text for editing

Definition at line 149 of file PShaderTxt.cpp.

References _fpshader, _mle, _shader, _stype, _vpshader, ARB_FP, ARB_VP, castShader(), gutz::SmartPtr< ProgShader >::isNull(), loadShader(), and NOT_LOADED.

void PShaderTxt::loadShader  )  [slot]
 

load Shader

for capturing errors

do the right thing for each type

save off old error stream

capture init errors

load the changed shader

return the default error stream

handle any errors

launch error, if there is one

be nice and mark where it happened

save off old error stream

capture init errors

launch error, if there is one

make the gl context current for loading might be dangerous

Definition at line 91 of file PShaderTxt.cpp.

References _ctx, _errw, _fpshader, _mle, _stype, _vpshader, ARB_FP, ARB_VP, getErrorPos(), ErrTxtWin::markSelection(), ErrTxtWin::maybeError(), and string.

Referenced by PShaderWin::addShader(), closeShader(), PShaderWin::loadShader(), loadShader(), saveShader(), and saveShaderAs().

void PShaderTxt::loadShaderFromFile const QString &  fname  )  [slot]
 

load Shader from file

check the context to see if we can do anything

make the gl context current for loading

capture error stream...

generate shader using glift shader factory function

launch error if there is one

mark where it happened

figure out what kind of shader it was

set the text for editing

Definition at line 187 of file PShaderTxt.cpp.

References _ctx, _errw, _fpshader, _mle, _shader, _stype, _vpshader, ARB_FP, ARB_VP, castShader(), getErrorPos(), glift::getProgShaderFromFile(), gutz::SmartPtr< ProgShader >::isNull(), ErrTxtWin::launchError(), ErrTxtWin::markSelection(), and NOT_LOADED.

Referenced by PShaderWin::openShader().

void PShaderTxt::loadShaderFromText const QString &  text  )  [slot]
 

load Shader from text

make the gl context current for loading

capture error stream...

generate shader using glift shader factory function

launch error if there is one

mark where it happened

figure out what kind of shader it was

setup the text editor

Definition at line 244 of file PShaderTxt.cpp.

References _ctx, _errw, _mle, _shader, _stype, castShader(), getErrorPos(), glift::getProgShaderFromText(), gutz::SmartPtr< ProgShader >::isNull(), ErrTxtWin::launchError(), ErrTxtWin::markSelection(), and NOT_LOADED.

Referenced by PShaderWin::newARBFP(), and PShaderWin::newARBVP().

void PShaderTxt::saveShader const QString &  lastPath  )  [slot]
 

save shader

nothing to save?

do we have a name?

use it's given name

nothing to save?

do we have a name?

Definition at line 288 of file PShaderTxt.cpp.

References _errw, _fpshader, _mle, _stype, _vpshader, ARB_FP, ARB_VP, gutz::SmartPtr< VertexProgARB >::isNull(), gutz::SmartPtr< FragProgARB >::isNull(), ErrTxtWin::launchError(), loadShader(), and s.

Referenced by closeShader(), and PShaderWin::saveShader().

void PShaderTxt::saveShaderAs const QString &  lastPath  )  [slot]
 

save shader as

Definition at line 391 of file PShaderTxt.cpp.

References _errw, _fpshader, _mle, _stype, _vpshader, ARB_FP, ARB_VP, gutz::SmartPtr< VertexProgARB >::isNull(), gutz::SmartPtr< FragProgARB >::isNull(), ErrTxtWin::launchError(), loadShader(), and s.

Referenced by PShaderWin::saveShaderAs().


Member Data Documentation

const QGLContext* PShaderTxt::_ctx [protected]
 

Definition at line 83 of file PShaderTxt.h.

Referenced by loadShader(), loadShaderFromFile(), and loadShaderFromText().

ErrTxtWin* PShaderTxt::_errw [protected]
 

Definition at line 85 of file PShaderTxt.h.

Referenced by loadShader(), loadShaderFromFile(), loadShaderFromText(), PShaderTxt(), saveShader(), and saveShaderAs().

glift::FragProgARBSP PShaderTxt::_fpshader [protected]
 

these depend on the shader loaded

Definition at line 80 of file PShaderTxt.h.

Referenced by castShader(), getFileName(), loadShader(), loadShaderFromFile(), saveShader(), and saveShaderAs().

QMultiLineEdit* PShaderTxt::_mle [protected]
 

Definition at line 75 of file PShaderTxt.h.

Referenced by closeShader(), loadShader(), loadShaderFromFile(), loadShaderFromText(), PShaderTxt(), saveShader(), and saveShaderAs().

glift::ProgShaderSP PShaderTxt::_shader [protected]
 

this should always exist

Definition at line 78 of file PShaderTxt.h.

Referenced by castShader(), getFileName(), loadShader(), loadShaderFromFile(), and loadShaderFromText().

int PShaderTxt::_stype [protected]
 

Definition at line 87 of file PShaderTxt.h.

Referenced by castShader(), getFileName(), getShaderType(), loadShader(), loadShaderFromFile(), loadShaderFromText(), saveShader(), and saveShaderAs().

glift::VertexProgARBSP PShaderTxt::_vpshader [protected]
 

Definition at line 81 of file PShaderTxt.h.

Referenced by castShader(), loadShader(), loadShaderFromFile(), saveShader(), and saveShaderAs().


The documentation for this class was generated from the following files:
Send questions, comments, and bug reports to:
jmk