Last change
on this file since 828 was
776,
checked in by vrinside, 17 years ago
|
Add 3D surface plot and grid rendering
|
File size:
1.5 KB
|
Line | |
---|
1 | #ifndef __NV_SHADER_H__ |
---|
2 | #define __NV_SHADER_H__ |
---|
3 | |
---|
4 | #include <Cg/cg.h> |
---|
5 | #include <Cg/cgGL.h> |
---|
6 | |
---|
7 | class NvShader { |
---|
8 | protected : |
---|
9 | CGprogram _cgVP; |
---|
10 | CGprogram _cgFP; |
---|
11 | |
---|
12 | public : |
---|
13 | NvShader(); |
---|
14 | |
---|
15 | public : |
---|
16 | virtual ~NvShader(); |
---|
17 | |
---|
18 | protected : |
---|
19 | void resetPrograms(); |
---|
20 | public : |
---|
21 | /** |
---|
22 | * @brief create a Cg vertex program and load it |
---|
23 | * @param fileName the name of Cg program file |
---|
24 | * @param entryPoint a entry point of the Cg program |
---|
25 | */ |
---|
26 | void loadVertexProgram(const char* fileName, const char* entryPoint); |
---|
27 | |
---|
28 | /** |
---|
29 | * @brief create a Cg fragment program and load it |
---|
30 | * @param fileName the name of Cg program file |
---|
31 | * @param entryPoint a entry point of the Cg program |
---|
32 | */ |
---|
33 | void loadFragmentProgram(const char* fileName, const char* entryPoint); |
---|
34 | |
---|
35 | CGparameter getNamedParameterFromFP(const char* paramName); |
---|
36 | CGparameter getNamedParameterFromVP(const char* paramName); |
---|
37 | |
---|
38 | CGprogram getVP() const; |
---|
39 | CGprogram getFP() const; |
---|
40 | }; |
---|
41 | |
---|
42 | extern CGcontext g_context; |
---|
43 | |
---|
44 | inline CGparameter NvShader::getNamedParameterFromFP(const char* paramName) |
---|
45 | { |
---|
46 | if (_cgFP) |
---|
47 | { |
---|
48 | return cgGetNamedParameter(_cgFP, paramName); |
---|
49 | } |
---|
50 | |
---|
51 | return 0; |
---|
52 | } |
---|
53 | |
---|
54 | inline CGparameter NvShader::getNamedParameterFromVP(const char* paramName) |
---|
55 | { |
---|
56 | if (_cgVP) |
---|
57 | { |
---|
58 | return cgGetNamedParameter(_cgVP, paramName); |
---|
59 | } |
---|
60 | |
---|
61 | return 0; |
---|
62 | } |
---|
63 | |
---|
64 | inline CGprogram NvShader::getVP() const |
---|
65 | { |
---|
66 | return _cgVP; |
---|
67 | } |
---|
68 | |
---|
69 | inline CGprogram NvShader::getFP() const |
---|
70 | { |
---|
71 | return _cgFP; |
---|
72 | } |
---|
73 | |
---|
74 | #endif // |
---|
75 | |
---|
Note: See
TracBrowser
for help on using the repository browser.