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

Last change on this file since 2837 was 2836, checked in by ldelgass, 12 years ago

More cleanups, remove NEW_FLOW_ENGINE define flag

  • 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 <Cg/cg.h>
6
7#include "Texture2D.h"
8#include "TransferFunction.h"
9#include "NvShader.h"
10
11class NvColorTableShader : public NvShader
12{
13public:
14    NvColorTableShader();
15
16    ~NvColorTableShader();
17
18    void bind(Texture2D *plane, TransferFunction *tf);
19
20    void unbind();
21
22private :
23    void init();
24
25    CGparameter _dataParam;
26    CGparameter _tfParam;
27    CGparameter _renderParam;
28};
29
30inline void NvColorTableShader::bind(Texture2D *plane, TransferFunction *tf)
31{
32    cgGLSetTextureParameter(_dataParam, plane->id);
33    cgGLSetTextureParameter(_tfParam, tf->id());
34    cgGLEnableTextureParameter(_dataParam);
35    cgGLEnableTextureParameter(_tfParam);
36    cgGLSetParameter4f(_renderParam, 0., 0., 0., 0.);
37
38    cgGLBindProgram(_cgFP);
39    cgGLEnableProfile(CG_PROFILE_FP30);
40}
41
42inline void NvColorTableShader::unbind()
43{
44    cgGLDisableProfile(CG_PROFILE_FP30);
45    cgGLDisableTextureParameter(_dataParam);
46    cgGLDisableTextureParameter(_tfParam);
47}
48
49#endif
Note: See TracBrowser for help on using the repository browser.