Last change
on this file since 2833 was
2833,
checked in by ldelgass, 12 years ago
|
Formatting and fix loadVertexProgram in NvShader?
|
-
Property svn:eol-style set to
native
|
File size:
1.4 KB
|
Line | |
---|
1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
2 | #ifndef NV_SHADER_H |
---|
3 | #define NV_SHADER_H |
---|
4 | |
---|
5 | #include <Cg/cg.h> |
---|
6 | #include <Cg/cgGL.h> |
---|
7 | |
---|
8 | typedef void NvCgCallbackFunction(void); |
---|
9 | |
---|
10 | extern CGcontext g_context; |
---|
11 | |
---|
12 | class NvShader |
---|
13 | { |
---|
14 | public: |
---|
15 | NvShader(); |
---|
16 | |
---|
17 | virtual ~NvShader(); |
---|
18 | |
---|
19 | /** |
---|
20 | * @brief create a Cg vertex program and load it |
---|
21 | * @param fileName the name of Cg program file |
---|
22 | * @param entryPoint a entry point of the Cg program |
---|
23 | */ |
---|
24 | void loadVertexProgram(const char *fileName, const char *entryPoint); |
---|
25 | |
---|
26 | /** |
---|
27 | * @brief create a Cg fragment program and load it |
---|
28 | * @param fileName the name of Cg program file |
---|
29 | * @param entryPoint a entry point of the Cg program |
---|
30 | */ |
---|
31 | void loadFragmentProgram(const char *fileName, const char *entryPoint); |
---|
32 | |
---|
33 | CGparameter getNamedParameterFromFP(const char *paramName) |
---|
34 | { |
---|
35 | if (_cgFP) { |
---|
36 | return cgGetNamedParameter(_cgFP, paramName); |
---|
37 | } |
---|
38 | |
---|
39 | return 0; |
---|
40 | } |
---|
41 | |
---|
42 | CGparameter getNamedParameterFromVP(const char *paramName) |
---|
43 | { |
---|
44 | if (_cgVP) { |
---|
45 | return cgGetNamedParameter(_cgVP, paramName); |
---|
46 | } |
---|
47 | |
---|
48 | return 0; |
---|
49 | } |
---|
50 | |
---|
51 | CGprogram getVP() const |
---|
52 | { |
---|
53 | return _cgVP; |
---|
54 | } |
---|
55 | |
---|
56 | CGprogram getFP() const |
---|
57 | { |
---|
58 | return _cgFP; |
---|
59 | } |
---|
60 | |
---|
61 | static void setErrorCallback(NvCgCallbackFunction callback); |
---|
62 | |
---|
63 | protected: |
---|
64 | CGprogram _cgVP; |
---|
65 | CGprogram _cgFP; |
---|
66 | |
---|
67 | void resetPrograms(); |
---|
68 | }; |
---|
69 | |
---|
70 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.