165 |
#endif |
#endif |
166 |
}; |
}; |
167 |
|
|
168 |
|
/** Load an OpenGL program into the driver. |
169 |
|
* Target type (GL_NV_VERTEX_PROGRAM, ...) and loading method |
170 |
|
* (LoadProgramNV, ProgramStringARB, ...) is determined from the |
171 |
|
* "!!..." program header. |
172 |
|
*/ |
173 |
|
bool loadProgram(GLuint id, const string source); |
174 |
|
|
175 |
|
bool loadARBProg(GLuint TARGET, GLuint id, const string source); |
176 |
|
|
177 |
void compileNVProg(GLuint TARGET, GLuint id, const string source); |
bool loadNVProg(GLuint TARGET, GLuint id, const string source); |
178 |
|
|
179 |
/** An instance of an NVIDIA program loaded into the driver. |
/** An instance of an NVIDIA program loaded into the driver. |
180 |
* The NVProg objects are immutable with value semantics. |
* The NVProg objects are immutable with value semantics. |
202 |
protected: |
protected: |
203 |
void compile() { |
void compile() { |
204 |
progid = shared_ptr<NVProgID>(new NVProgID); |
progid = shared_ptr<NVProgID>(new NVProgID); |
205 |
compileNVProg(TARGET, progid->name, source); |
loadNVProg(TARGET, progid->name, source); |
206 |
} |
} |
207 |
string source; |
string source; |
208 |
shared_ptr<NVProgID> progid; |
shared_ptr<NVProgID> progid; |
209 |
}; |
}; |
210 |
|
|
211 |
|
|
212 |
#ifdef GL_VERTEX_PROGRAM_NV |
#ifdef GL_NV_vertex_program |
213 |
typedef NVProg<GL_VERTEX_PROGRAM_NV> VertexProgram; |
typedef NVProg<GL_VERTEX_PROGRAM_NV> VertexProgram; |
214 |
typedef NVProg<GL_VERTEX_STATE_PROGRAM_NV> VertexStateProgram; |
typedef NVProg<GL_VERTEX_STATE_PROGRAM_NV> VertexStateProgram; |
215 |
#endif |
#endif |
216 |
#ifdef GL_FRAGMENT_PROGRAM_NV |
#ifdef GL_NV_fragment_program |
217 |
typedef NVProg<GL_FRAGMENT_PROGRAM_NV> FragmentProgram; |
typedef NVProg<GL_FRAGMENT_PROGRAM_NV> FragmentProgram; |
218 |
#endif |
#endif |
219 |
|
|
|
|
|
|
/* Just a simple container for Extender Calls |
|
|
* -SecondaryColorEXT |
|
|
* -GL_EXT_blend_color |
|
|
*/ |
|
|
class ExtCalls { |
|
|
private: |
|
|
// < function name, proc address> |
|
|
map<string, void (*)()> list_address; |
|
|
|
|
|
// <OpenGL call name, function name> |
|
|
map<string, string> list_names; |
|
|
|
|
|
private: |
|
|
void add(string call_name, string func_name) { |
|
|
list_names[call_name] = func_name; |
|
|
} |
|
|
|
|
|
public: |
|
|
ExtCalls() { |
|
|
// EXT_secondary_color |
|
|
add("SecondaryColorEXT", "glSecondaryColor3dEXT"); |
|
|
|
|
|
// GL_EXT_blend_color |
|
|
add("BlendColorEXT","glBlendColorEXT"); |
|
|
} |
|
|
|
|
|
void (* getAddress(string call_name))() { |
|
|
|
|
|
string func_name = list_names[call_name]; |
|
|
if (func_name == "") return NULL; |
|
|
|
|
|
void (* addr)() = list_address[func_name]; |
|
|
if (addr == NULL) { |
|
|
addr = Os::getExtendedProcAddress(func_name.c_str()); |
|
|
list_address[func_name] = addr; |
|
|
} |
|
|
return addr; |
|
|
} |
|
|
}; |
|
220 |
} |
} |
221 |
|
|
222 |
#endif // GZZ CALLGL HXX |
#endif // GZZ CALLGL HXX |