source: trunk/packages/vizservers/nanovis/NvColorTableShader.h @ 2825

Last change on this file since 2825 was 2798, checked in by ldelgass, 13 years ago

Add emacs mode magic line in preparation for indentation cleanup

  • Property svn:eol-style set to native
File size: 1.1 KB
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2#ifndef __NV_COLORTABLE_SHADER_H__
3#define __NV_COLORTABLE_SHADER_H__
4
5#include "Texture2D.h"
6#include "TransferFunction.h"
7#include "NvShader.h"
8
9class NvColorTableShader : public NvShader {
10    CGparameter _dataParam;
11    CGparameter _tfParam;
12    CGparameter _renderParam;
13
14public :
15    NvColorTableShader();
16    ~NvColorTableShader();
17
18private :
19    void init();
20public :
21    void bind(Texture2D* plane, TransferFunction* tf);
22    void unbind();
23};
24
25inline void NvColorTableShader::bind(Texture2D* plane, TransferFunction* tf)
26{
27    cgGLSetTextureParameter(_dataParam, plane->id);
28    cgGLSetTextureParameter(_tfParam, tf->id());
29    cgGLEnableTextureParameter(_dataParam);
30    cgGLEnableTextureParameter(_tfParam);
31    cgGLSetParameter4f(_renderParam, 0., 0., 0., 0.);
32
33    cgGLBindProgram(_cgFP);
34    cgGLEnableProfile(CG_PROFILE_FP30);
35}
36
37inline void NvColorTableShader::unbind()
38{
39    cgGLDisableProfile(CG_PROFILE_FP30);
40    cgGLDisableTextureParameter(_dataParam);
41    cgGLDisableTextureParameter(_tfParam);
42}
43
44#endif
Note: See TracBrowser for help on using the repository browser.