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 | |
---|
8 | class NvColorTableShader : public NvShader { |
---|
9 | CGparameter _dataParam; |
---|
10 | CGparameter _tfParam; |
---|
11 | CGparameter _renderParam; |
---|
12 | |
---|
13 | public : |
---|
14 | NvColorTableShader(); |
---|
15 | ~NvColorTableShader(); |
---|
16 | |
---|
17 | private : |
---|
18 | void init(); |
---|
19 | public : |
---|
20 | void bind(Texture2D* plane, TransferFunction* tf); |
---|
21 | void unbind(); |
---|
22 | }; |
---|
23 | |
---|
24 | inline 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 | |
---|
36 | inline 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.