source: trunk/gui/vizservers/nanovis/NvColorTableShader.h @ 723

Last change on this file since 723 was 580, checked in by vrinside, 17 years ago
File size: 1.0 KB
Line 
1#ifndef __NV_COLORTABLE_SHADER_H__
2#define __NV_COLORTABLE_SHADER_H__
3
4#include "Texture2D.h"
5#include "TransferFunction.h"
6#include "NvShader.h"
7
8class NvColorTableShader : public NvShader {
9    CGparameter _dataParam;
10    CGparameter _tfParam;
11    CGparameter _renderParam;
12
13public :
14    NvColorTableShader();
15    ~NvColorTableShader();
16
17private :
18    void init();
19public :
20    void bind(Texture2D* plane, TransferFunction* tf);
21    void unbind();
22};
23
24inline void NvColorTableShader::bind(Texture2D* plane, TransferFunction* tf)
25{
26    cgGLSetTextureParameter(_dataParam, plane->id);
27    cgGLSetTextureParameter(_tfParam, tf->id);
28    cgGLEnableTextureParameter(_dataParam);
29    cgGLEnableTextureParameter(_tfParam);
30    cgGLSetParameter4f(_renderParam, 0., 0., 0., 0.);
31
32    cgGLBindProgram(_cgFP);
33    cgGLEnableProfile(CG_PROFILE_FP30);
34}
35
36inline void NvColorTableShader::unbind()
37{
38    cgGLDisableProfile(CG_PROFILE_FP30);
39    cgGLDisableTextureParameter(_dataParam);
40    cgGLDisableTextureParameter(_tfParam);
41}
42
43#endif
Note: See TracBrowser for help on using the repository browser.