Last change
on this file since 2861 was
2833,
checked in by ldelgass, 12 years ago
|
Formatting and fix loadVertexProgram in NvShader?
|
-
Property svn:eol-style set to
native
|
File size:
963 bytes
|
Line | |
---|
1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
2 | #include <stdio.h> |
---|
3 | |
---|
4 | #include "global.h" |
---|
5 | #include "NvShader.h" |
---|
6 | |
---|
7 | CGcontext g_context = 0; |
---|
8 | |
---|
9 | void NvInitCG() |
---|
10 | { |
---|
11 | g_context = cgCreateContext(); |
---|
12 | } |
---|
13 | |
---|
14 | NvShader::NvShader(): |
---|
15 | _cgVP(0), |
---|
16 | _cgFP(0) |
---|
17 | { |
---|
18 | } |
---|
19 | |
---|
20 | NvShader::~NvShader() |
---|
21 | { |
---|
22 | resetPrograms(); |
---|
23 | } |
---|
24 | |
---|
25 | void NvShader::loadVertexProgram(const char *fileName, const char *entryPoint) |
---|
26 | { |
---|
27 | resetPrograms(); |
---|
28 | |
---|
29 | _cgVP = LoadCgSourceProgram(g_context, fileName, CG_PROFILE_VP30, entryPoint); |
---|
30 | } |
---|
31 | |
---|
32 | void NvShader::loadFragmentProgram(const char *fileName, const char *entryPoint) |
---|
33 | { |
---|
34 | _cgFP = LoadCgSourceProgram(g_context, fileName, CG_PROFILE_FP30, entryPoint); |
---|
35 | } |
---|
36 | |
---|
37 | void NvShader::resetPrograms() |
---|
38 | { |
---|
39 | if (_cgVP > 0) { |
---|
40 | cgDestroyProgram(_cgVP); |
---|
41 | } |
---|
42 | |
---|
43 | if (_cgFP > 0) { |
---|
44 | cgDestroyProgram(_cgFP); |
---|
45 | } |
---|
46 | } |
---|
47 | |
---|
48 | void NvShader::setErrorCallback(NvCgCallbackFunction callback) |
---|
49 | { |
---|
50 | TRACE("NvShader callback\n"); |
---|
51 | cgSetErrorCallback(callback); |
---|
52 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.