~hikiko/nux/arb-srgba-shader

« back to all changes in this revision

Viewing changes to NuxGraphics/GLShader2.cpp

  • Committer: Neil Jagdish Patel
  • Date: 2010-09-02 03:28:11 UTC
  • Revision ID: neil.patel@canonical.com-20100902032811-i2m18tfb6pkasnvt
Remove Win EOL chars

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 */
21
21
 
22
22
 
23
 
#include "NuxCore/NKernel.h"
24
 
#include "GLResource.h"
25
 
#include "GLShader.h"
26
 
#include "GLDeviceObjects.h"
27
 
 
28
 
NAMESPACE_BEGIN_OGL
29
 
// //----------------------------------------------------------------------------- 
30
 
// bool IOpenGLShaderProgram::SetUniform1f(char* varname, GLfloat v0)
31
 
// {
32
 
//     //if (!useGLSL) return false; // GLSL not available
33
 
//     //if (!_noshader) return true;
34
 
// 
35
 
//     GLint loc = GetUniformLocationARB(varname);
36
 
//     if (loc==-1) return false;  // can't find variable
37
 
// 
38
 
//     glUniform1fARB(loc, v0);
39
 
// 
40
 
//     return true;
41
 
// }
42
 
// bool IOpenGLShaderProgram::SetUniform1f(GLint loc, GLfloat v0)
43
 
// {
44
 
//     //if (!useGLSL) return false; // GLSL not available
45
 
//     //if (!_noshader) return true;
46
 
// 
47
 
//     if (loc==-1) return false;  // can't find variable
48
 
//     glUniform1fARB(loc, v0);
49
 
//     return true;
50
 
// }
51
 
// 
52
 
// //----------------------------------------------------------------------------- 
53
 
// 
54
 
// bool IOpenGLShaderProgram::SetUniform2f(char* varname, GLfloat v0, GLfloat v1)
55
 
// {
56
 
//     //if (!useGLSL) return false; // GLSL not available
57
 
//     //if (!_noshader) return true;
58
 
// 
59
 
//     GLint loc = GetUniformLocationARB(varname);
60
 
//     if (loc==-1) return false;  // can't find variable
61
 
// 
62
 
//     glUniform2fARB(loc, v0, v1);
63
 
// 
64
 
//     return true;
65
 
// }
66
 
// bool IOpenGLShaderProgram::SetUniform2f(GLint loc, GLfloat v0, GLfloat v1)
67
 
// {
68
 
//     //if (!useGLSL) return false; // GLSL not available
69
 
//     //if (!_noshader) return true;
70
 
// 
71
 
//     if (loc==-1) return false;  // can't find variable
72
 
//     glUniform2fARB(loc, v0, v1);
73
 
//     return true;
74
 
// }
75
 
// //----------------------------------------------------------------------------- 
76
 
// 
77
 
// bool IOpenGLShaderProgram::SetUniform3f(char* varname, GLfloat v0, GLfloat v1, GLfloat v2)
78
 
// {
79
 
//     //if (!useGLSL) return false; // GLSL not available
80
 
//     //if (!_noshader) return true;
81
 
// 
82
 
//     GLint loc = GetUniformLocationARB(varname);
83
 
//     if (loc==-1) return false;  // can't find variable
84
 
// 
85
 
//     glUniform3fARB(loc, v0, v1, v2);
86
 
// 
87
 
//     return true;
88
 
// }
89
 
// bool IOpenGLShaderProgram::SetUniform3f(GLint loc, GLfloat v0, GLfloat v1, GLfloat v2)
90
 
// {
91
 
//     //if (!useGLSL) return false; // GLSL not available
92
 
//     //if (!_noshader) return true;
93
 
// 
94
 
//     if (loc==-1) return false;  // can't find variable
95
 
// 
96
 
//     glUniform3fARB(loc, v0, v1, v2);
97
 
// 
98
 
//     return true;
99
 
// }
100
 
// //----------------------------------------------------------------------------- 
101
 
// 
102
 
// bool IOpenGLShaderProgram::SetUniform4f(char* varname, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
103
 
// {
104
 
//     //if (!useGLSL) return false; // GLSL not available
105
 
//     //if (!_noshader) return true;
106
 
// 
107
 
//     GLint loc = GetUniformLocationARB(varname);
108
 
//     if (loc==-1) return false;  // can't find variable
109
 
// 
110
 
//     glUniform4fARB(loc, v0, v1, v2, v3);
111
 
// 
112
 
//     return true;
113
 
// }
114
 
// bool IOpenGLShaderProgram::SetUniform4f(GLint loc, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
115
 
// {
116
 
//     //if (!useGLSL) return false; // GLSL not available
117
 
//     //if (!_noshader) return true;
118
 
// 
119
 
//     if (loc==-1) return false;  // can't find variable
120
 
// 
121
 
//     glUniform4fARB(loc, v0, v1, v2, v3);
122
 
// 
123
 
//     return true;
124
 
// }
125
 
// //----------------------------------------------------------------------------- 
126
 
// 
127
 
// bool IOpenGLShaderProgram::SetUniform1i(char* varname, GLint v0)
128
 
// { 
129
 
//     //if (!useGLSL) return false; // GLSL not available
130
 
//     //if (!_noshader) return true;
131
 
// 
132
 
//     GLint loc = GetUniformLocationARB(varname);
133
 
//     if (loc==-1) return false;  // can't find variable
134
 
// 
135
 
//     glUniform1iARB(loc, v0);
136
 
// 
137
 
//     return true;
138
 
// }
139
 
// bool IOpenGLShaderProgram::SetUniform1i(GLint loc, GLint v0)
140
 
// { 
141
 
//     //if (!useGLSL) return false; // GLSL not available
142
 
//     //if (!_noshader) return true;
143
 
// 
144
 
//     if (loc==-1) return false;  // can't find variable
145
 
// 
146
 
//     glUniform1iARB(loc, v0);
147
 
// 
148
 
//     return true;
149
 
// }
150
 
// 
151
 
// bool IOpenGLShaderProgram::SetUniform2i(char* varname, GLint v0, GLint v1)
152
 
// {
153
 
//     //    if (!useGLSL) return false; // GLSL not available
154
 
//     //    if (!_noshader) return true;
155
 
// 
156
 
//     GLint loc = GetUniformLocationARB(varname);
157
 
//     if (loc==-1) return false;  // can't find variable
158
 
// 
159
 
//     glUniform2iARB(loc, v0, v1);
160
 
// 
161
 
// 
162
 
//     return true;
163
 
// }
164
 
// bool IOpenGLShaderProgram::SetUniform2i(GLint loc, GLint v0, GLint v1)
165
 
// {
166
 
//     //    if (!useGLSL) return false; // GLSL not available
167
 
//     //    if (!_noshader) return true;
168
 
// 
169
 
//     if (loc==-1) return false;  // can't find variable
170
 
// 
171
 
//     glUniform2iARB(loc, v0, v1);
172
 
// 
173
 
// 
174
 
//     return true;
175
 
// }
176
 
// //----------------------------------------------------------------------------- 
177
 
// 
178
 
// bool IOpenGLShaderProgram::SetUniform3i(char* varname, GLint v0, GLint v1, GLint v2)
179
 
// {
180
 
//     //    if (!useGLSL) return false; // GLSL not available
181
 
//     //    if (!_noshader) return true;
182
 
// 
183
 
//     GLint loc = GetUniformLocationARB(varname);
184
 
//     if (loc==-1) return false;  // can't find variable
185
 
// 
186
 
//     glUniform3iARB(loc, v0, v1, v2);
187
 
// 
188
 
//     return true;
189
 
// }
190
 
// bool IOpenGLShaderProgram::SetUniform3i(GLint loc, GLint v0, GLint v1, GLint v2)
191
 
// {
192
 
//     //    if (!useGLSL) return false; // GLSL not available
193
 
//     //    if (!_noshader) return true;
194
 
// 
195
 
//     if (loc==-1) return false;  // can't find variable
196
 
// 
197
 
//     glUniform3iARB(loc, v0, v1, v2);
198
 
// 
199
 
//     return true;
200
 
// }
201
 
// 
202
 
// bool IOpenGLShaderProgram::SetUniform4i(char* varname, GLint v0, GLint v1, GLint v2, GLint v3)
203
 
// {
204
 
//     //    if (!useGLSL) return false; // GLSL not available
205
 
//     //    if (!_noshader) return true;
206
 
// 
207
 
//     GLint loc = GetUniformLocationARB(varname);
208
 
//     if (loc==-1) return false;  // can't find variable
209
 
// 
210
 
//     glUniform4iARB(loc, v0, v1, v2, v3);
211
 
// 
212
 
//     return true;
213
 
// }
214
 
// bool IOpenGLShaderProgram::SetUniform4i(GLint loc, GLint v0, GLint v1, GLint v2, GLint v3)
215
 
// {
216
 
//     //    if (!useGLSL) return false; // GLSL not available
217
 
//     //    if (!_noshader) return true;
218
 
// 
219
 
//     if (loc==-1) return false;  // can't find variable
220
 
// 
221
 
//     glUniform4iARB(loc, v0, v1, v2, v3);
222
 
// 
223
 
//     return true;
224
 
// }
225
 
// //----------------------------------------------------------------------------- 
226
 
// 
227
 
// bool IOpenGLShaderProgram::SetUniform1fv(char* varname, GLsizei count, GLfloat *value)
228
 
// {
229
 
//     //    if (!useGLSL) return false; // GLSL not available
230
 
//     //    if (!_noshader) return true;
231
 
// 
232
 
//     GLint loc = GetUniformLocationARB(varname);
233
 
//     if (loc==-1) return false;  // can't find variable
234
 
// 
235
 
//     glUniform1fvARB(loc, count, value);
236
 
// 
237
 
//     return true;
238
 
// }
239
 
// bool IOpenGLShaderProgram::SetUniform1fv(GLint loc, GLsizei count, GLfloat *value)
240
 
// {
241
 
//     //    if (!useGLSL) return false; // GLSL not available
242
 
//     //    if (!_noshader) return true;
243
 
// 
244
 
//     if (loc==-1) return false;  // can't find variable
245
 
// 
246
 
//     glUniform1fvARB(loc, count, value);
247
 
// 
248
 
//     return true;
249
 
// }
250
 
// 
251
 
// bool IOpenGLShaderProgram::SetUniform2fv(char* varname, GLsizei count, GLfloat *value)
252
 
// {
253
 
//     //    if (!useGLSL) return false; // GLSL not available
254
 
//     //    if (!_noshader) return true;
255
 
// 
256
 
//     GLint loc = GetUniformLocationARB(varname);
257
 
//     if (loc==-1) return false;  // can't find variable
258
 
// 
259
 
//     glUniform2fvARB(loc, count, value);
260
 
// 
261
 
//     return true;
262
 
// }
263
 
// bool IOpenGLShaderProgram::SetUniform2fv(GLint loc, GLsizei count, GLfloat *value)
264
 
// {
265
 
//     //    if (!useGLSL) return false; // GLSL not available
266
 
//     //    if (!_noshader) return true;
267
 
// 
268
 
//     if (loc==-1) return false;  // can't find variable
269
 
// 
270
 
//     glUniform2fvARB(loc, count, value);
271
 
// 
272
 
//     return true;
273
 
// }
274
 
// //----------------------------------------------------------------------------- 
275
 
// 
276
 
// bool IOpenGLShaderProgram::SetUniform3fv(char* varname, GLsizei count, GLfloat *value)
277
 
// {
278
 
//     //    if (!useGLSL) return false; // GLSL not available
279
 
//     //    if (!_noshader) return true;
280
 
// 
281
 
//     GLint loc = GetUniformLocationARB(varname);
282
 
//     if (loc==-1) return false;  // can't find variable
283
 
// 
284
 
//     glUniform3fvARB(loc, count, value);
285
 
// 
286
 
//     return true;
287
 
// }
288
 
// bool IOpenGLShaderProgram::SetUniform3fv(GLint loc, GLsizei count, GLfloat *value)
289
 
// {
290
 
//     //    if (!useGLSL) return false; // GLSL not available
291
 
//     //    if (!_noshader) return true;
292
 
// 
293
 
//     if (loc==-1) return false;  // can't find variable
294
 
// 
295
 
//     glUniform3fvARB(loc, count, value);
296
 
// 
297
 
//     return true;
298
 
// }
299
 
// //----------------------------------------------------------------------------- 
300
 
// 
301
 
// bool IOpenGLShaderProgram::SetUniform4fv(char* varname, GLsizei count, GLfloat *value)
302
 
// {
303
 
//     //    if (!useGLSL) return false; // GLSL not available
304
 
//     //    if (!_noshader) return true;
305
 
// 
306
 
//     GLint loc = GetUniformLocationARB(varname);
307
 
//     if (loc==-1) return false;  // can't find variable
308
 
// 
309
 
//     glUniform4fvARB(loc, count, value);
310
 
// 
311
 
//     return true;
312
 
// }
313
 
// bool IOpenGLShaderProgram::SetUniform4fv(GLint loc, GLsizei count, GLfloat *value)
314
 
// {
315
 
//     //    if (!useGLSL) return false; // GLSL not available
316
 
//     //    if (!_noshader) return true;
317
 
// 
318
 
//     if (loc==-1) return false;  // can't find variable
319
 
// 
320
 
//     glUniform4fvARB(loc, count, value);
321
 
// 
322
 
//     return true;
323
 
// }
324
 
// //----------------------------------------------------------------------------- 
325
 
// 
326
 
// bool IOpenGLShaderProgram::SetUniform1iv(char* varname, GLsizei count, GLint *value)
327
 
// {
328
 
//     //    if (!useGLSL) return false; // GLSL not available
329
 
//     //    if (!_noshader) return true;
330
 
// 
331
 
//     GLint loc = GetUniformLocationARB(varname);
332
 
//     if (loc==-1) return false;  // can't find variable
333
 
// 
334
 
//     glUniform1ivARB(loc, count, value);
335
 
// 
336
 
//     return true;
337
 
// }
338
 
// bool IOpenGLShaderProgram::SetUniform1iv(GLint loc, GLsizei count, GLint *value)
339
 
// {
340
 
//     //    if (!useGLSL) return false; // GLSL not available
341
 
//     //    if (!_noshader) return true;
342
 
// 
343
 
//     if (loc==-1) return false;  // can't find variable
344
 
// 
345
 
//     glUniform1ivARB(loc, count, value);
346
 
// 
347
 
//     return true;
348
 
// }
349
 
// //----------------------------------------------------------------------------- 
350
 
// 
351
 
// bool IOpenGLShaderProgram::SetUniform2iv(char* varname, GLsizei count, GLint *value)
352
 
// {
353
 
//     //    if (!useGLSL) return false; // GLSL not available
354
 
//     //    if (!_noshader) return true;
355
 
// 
356
 
//     GLint loc = GetUniformLocationARB(varname);
357
 
//     if (loc==-1) return false;  // can't find variable
358
 
// 
359
 
//     glUniform2ivARB(loc, count, value);
360
 
// 
361
 
//     return true;
362
 
// }
363
 
// bool IOpenGLShaderProgram::SetUniform2iv(GLint loc, GLsizei count, GLint *value)
364
 
// {
365
 
//     //    if (!useGLSL) return false; // GLSL not available
366
 
//     //    if (!_noshader) return true;
367
 
// 
368
 
//     if (loc==-1) return false;  // can't find variable
369
 
// 
370
 
//     glUniform2ivARB(loc, count, value);
371
 
// 
372
 
//     return true;
373
 
// }
374
 
// //----------------------------------------------------------------------------- 
375
 
// 
376
 
// bool IOpenGLShaderProgram::SetUniform3iv(char* varname, GLsizei count, GLint *value)
377
 
// {
378
 
//     //    if (!useGLSL) return false; // GLSL not available
379
 
//     //    if (!_noshader) return true;
380
 
// 
381
 
//     GLint loc = GetUniformLocationARB(varname);
382
 
//     if (loc==-1) return false;  // can't find variable
383
 
// 
384
 
//     glUniform3ivARB(loc, count, value);
385
 
// 
386
 
//     return true;
387
 
// }
388
 
// bool IOpenGLShaderProgram::SetUniform3iv(GLint loc, GLsizei count, GLint *value)
389
 
// {
390
 
//     //    if (!useGLSL) return false; // GLSL not available
391
 
//     //    if (!_noshader) return true;
392
 
// 
393
 
//     if (loc==-1) return false;  // can't find variable
394
 
// 
395
 
//     glUniform3ivARB(loc, count, value);
396
 
// 
397
 
//     return true;
398
 
// }
399
 
// //----------------------------------------------------------------------------- 
400
 
// 
401
 
// bool IOpenGLShaderProgram::SetUniform4iv(char* varname, GLsizei count, GLint *value)
402
 
// {
403
 
//     //    if (!useGLSL) return false; // GLSL not available
404
 
//     //    if (!_noshader) return true;
405
 
// 
406
 
//     GLint loc = GetUniformLocationARB(varname);
407
 
//     if (loc==-1) return false;  // can't find variable
408
 
// 
409
 
//     glUniform4ivARB(loc, count, value);
410
 
// 
411
 
//     return true;
412
 
// }
413
 
// bool IOpenGLShaderProgram::SetUniform4iv(GLint loc, GLsizei count, GLint *value)
414
 
// {
415
 
//     //    if (!useGLSL) return false; // GLSL not available
416
 
//     //    if (!_noshader) return true;
417
 
// 
418
 
//     if (loc==-1) return false;  // can't find variable
419
 
// 
420
 
//     glUniform4ivARB(loc, count, value);
421
 
// 
422
 
//     return true;
423
 
// }
424
 
// //----------------------------------------------------------------------------- 
425
 
// 
426
 
// bool IOpenGLShaderProgram::SetUniformMatrix2fv(char* varname, GLsizei count, GLboolean transpose, GLfloat *value)
427
 
// {
428
 
//     //    if (!useGLSL) return false; // GLSL not available
429
 
//     //    if (!_noshader) return true;
430
 
// 
431
 
//     GLint loc = GetUniformLocationARB(varname);
432
 
//     if (loc==-1) return false;  // can't find variable
433
 
// 
434
 
//     glUniformMatrix2fvARB(loc, count, transpose, value);
435
 
// 
436
 
//     return true;
437
 
// }
438
 
// bool IOpenGLShaderProgram::SetUniformLocMatrix2fv(GLint loc, GLsizei count, GLboolean transpose, GLfloat *value)
439
 
// {
440
 
//     //    if (!useGLSL) return false; // GLSL not available
441
 
//     //    if (!_noshader) return true;
442
 
// 
443
 
//     if (loc==-1) return false;  // can't find variable
444
 
// 
445
 
//     glUniformMatrix2fvARB(loc, count, transpose, value);
446
 
// 
447
 
//     return true;
448
 
// }
449
 
// //----------------------------------------------------------------------------- 
450
 
// 
451
 
// bool IOpenGLShaderProgram::SetUniformMatrix3fv(char* varname, GLsizei count, GLboolean transpose, GLfloat *value)
452
 
// {
453
 
//     //    if (!useGLSL) return false; // GLSL not available
454
 
//     //    if (!_noshader) return true;
455
 
// 
456
 
//     GLint loc = GetUniformLocationARB(varname);
457
 
//     if (loc==-1) return false;  // can't find variable
458
 
// 
459
 
//     glUniformMatrix3fvARB(loc, count, transpose, value);
460
 
// 
461
 
//     return true;
462
 
// }
463
 
// bool IOpenGLShaderProgram::SetUniformLocMatrix3fv(GLint loc, GLsizei count, GLboolean transpose, GLfloat *value)
464
 
// {
465
 
//     //    if (!useGLSL) return false; // GLSL not available
466
 
//     //    if (!_noshader) return true;
467
 
// 
468
 
//     if (loc==-1) return false;  // can't find variable
469
 
// 
470
 
//     glUniformMatrix3fvARB(loc, count, transpose, value);
471
 
// 
472
 
//     return true;
473
 
// }
474
 
// //----------------------------------------------------------------------------- 
475
 
// 
476
 
// bool IOpenGLShaderProgram::SetUniformMatrix4fv(char* varname, GLsizei count, GLboolean transpose, GLfloat *value)
477
 
// {
478
 
//     //    if (!useGLSL) return false; // GLSL not available
479
 
//     //    if (!_noshader) return true;
480
 
// 
481
 
//     GLint loc = GetUniformLocationARB(varname);
482
 
//     if (loc==-1) return false;  // can't find variable
483
 
// 
484
 
//     glUniformMatrix4fvARB(loc, count, transpose, value);
485
 
// 
486
 
//     return true;
487
 
// }
488
 
// bool IOpenGLShaderProgram::SetUniformLocMatrix4fv(GLint loc, GLsizei count, GLboolean transpose, GLfloat *value)
489
 
// {
490
 
//     //    if (!useGLSL) return false; // GLSL not available
491
 
//     //    if (!_noshader) return true;
492
 
// 
493
 
//     if (loc==-1) return false;  // can't find variable
494
 
// 
495
 
//     glUniformMatrix4fvARB(loc, count, transpose, value);
496
 
// 
497
 
//     return true;
498
 
// }
499
 
// 
500
 
// //----------------------------------------------------------------------------- 
501
 
// 
502
 
// void IOpenGLShaderProgram::GetUniformfv(char* name, GLfloat* values)
503
 
// {
504
 
//     //     if (!useGLSL) return;
505
 
//     GLint loc;
506
 
// 
507
 
//     loc = glGetUniformLocationARB(_OpenGLID, name);
508
 
//     if (loc == -1) 
509
 
//     {
510
 
//         std::cout << "Error: can't find uniform variable \"" << name << "\"\n";
511
 
//     }
512
 
//     glGetUniformfvARB(_OpenGLID, loc, values);
513
 
// }
514
 
// 
515
 
// //----------------------------------------------------------------------------- 
516
 
// 
517
 
// void IOpenGLShaderProgram::GetUniformiv(char* name, GLint* values)
518
 
// {
519
 
//     //if (!useGLSL) return;
520
 
//     GLint loc;
521
 
//     loc = glGetUniformLocationARB(_OpenGLID, name);
522
 
//     if (loc == -1) 
523
 
//     {
524
 
//         std::cout << "Error: can't find uniform variable \"" << name << "\"\n";
525
 
//     }
526
 
//     glGetUniformivARB(_OpenGLID, loc, values);
527
 
// }
528
 
// //----------------------------------------------------------------------------- 
529
 
// 
530
 
// int IOpenGLShaderProgram::GetUniformLocationARB(const GLcharARB* name)
531
 
// {
532
 
//     GLint loc;
533
 
//     loc = glGetUniformLocationARB(_OpenGLID, name);
534
 
//     return loc;
535
 
// }
536
 
// 
537
 
// //----------------------------------------------------------------------------- 
538
 
// void IOpenGLShaderProgram::GetActiveUniformARB(
539
 
//     GLuint index,
540
 
//     GLsizei maxLength,
541
 
//     GLsizei *length,
542
 
//     GLint *size,
543
 
//     GLenum *type,
544
 
//     GLcharARB *name)
545
 
// {
546
 
// 
547
 
//     glGetActiveUniformARB(_OpenGLID,
548
 
//         index,
549
 
//         maxLength,
550
 
//         length,
551
 
//         size,
552
 
//         type,
553
 
//         name);
554
 
//     CHECKGL_MSG(glGetActiveUniformARB);
555
 
// }
556
 
// 
557
 
// //----------------------------------------------------------------------------- 
558
 
// 
559
 
// void IOpenGLShaderProgram::GetObjectParameterfvARB(GLenum pname,
560
 
//                                                    GLfloat *params)
561
 
// {
562
 
//     glGetObjectParameterfvARB(_OpenGLID,
563
 
//         pname,
564
 
//         params);
565
 
//     CHECKGL_MSG(glGetObjectParameterfvARB);
566
 
// }
567
 
// 
568
 
// //----------------------------------------------------------------------------- 
569
 
// 
570
 
// BOOL IOpenGLShaderProgram::SetSampler(char* name, int texture_unit)
571
 
// {
572
 
//     GLint loc = GetUniformLocationARB(name);
573
 
//     if (loc==-1) return false;  // can't find variable
574
 
// 
575
 
//     glUniform1iARB(loc, texture_unit);
576
 
//     return true;
577
 
// }
578
 
// 
579
 
NAMESPACE_END_OGL
 
23
#include "NuxCore/NKernel.h"
 
24
#include "GLResource.h"
 
25
#include "GLShader.h"
 
26
#include "GLDeviceObjects.h"
 
27
 
 
28
NAMESPACE_BEGIN_OGL
 
29
// //----------------------------------------------------------------------------- 
 
30
// bool IOpenGLShaderProgram::SetUniform1f(char* varname, GLfloat v0)
 
31
// {
 
32
//     //if (!useGLSL) return false; // GLSL not available
 
33
//     //if (!_noshader) return true;
 
34
// 
 
35
//     GLint loc = GetUniformLocationARB(varname);
 
36
//     if (loc==-1) return false;  // can't find variable
 
37
// 
 
38
//     glUniform1fARB(loc, v0);
 
39
// 
 
40
//     return true;
 
41
// }
 
42
// bool IOpenGLShaderProgram::SetUniform1f(GLint loc, GLfloat v0)
 
43
// {
 
44
//     //if (!useGLSL) return false; // GLSL not available
 
45
//     //if (!_noshader) return true;
 
46
// 
 
47
//     if (loc==-1) return false;  // can't find variable
 
48
//     glUniform1fARB(loc, v0);
 
49
//     return true;
 
50
// }
 
51
// 
 
52
// //----------------------------------------------------------------------------- 
 
53
// 
 
54
// bool IOpenGLShaderProgram::SetUniform2f(char* varname, GLfloat v0, GLfloat v1)
 
55
// {
 
56
//     //if (!useGLSL) return false; // GLSL not available
 
57
//     //if (!_noshader) return true;
 
58
// 
 
59
//     GLint loc = GetUniformLocationARB(varname);
 
60
//     if (loc==-1) return false;  // can't find variable
 
61
// 
 
62
//     glUniform2fARB(loc, v0, v1);
 
63
// 
 
64
//     return true;
 
65
// }
 
66
// bool IOpenGLShaderProgram::SetUniform2f(GLint loc, GLfloat v0, GLfloat v1)
 
67
// {
 
68
//     //if (!useGLSL) return false; // GLSL not available
 
69
//     //if (!_noshader) return true;
 
70
// 
 
71
//     if (loc==-1) return false;  // can't find variable
 
72
//     glUniform2fARB(loc, v0, v1);
 
73
//     return true;
 
74
// }
 
75
// //----------------------------------------------------------------------------- 
 
76
// 
 
77
// bool IOpenGLShaderProgram::SetUniform3f(char* varname, GLfloat v0, GLfloat v1, GLfloat v2)
 
78
// {
 
79
//     //if (!useGLSL) return false; // GLSL not available
 
80
//     //if (!_noshader) return true;
 
81
// 
 
82
//     GLint loc = GetUniformLocationARB(varname);
 
83
//     if (loc==-1) return false;  // can't find variable
 
84
// 
 
85
//     glUniform3fARB(loc, v0, v1, v2);
 
86
// 
 
87
//     return true;
 
88
// }
 
89
// bool IOpenGLShaderProgram::SetUniform3f(GLint loc, GLfloat v0, GLfloat v1, GLfloat v2)
 
90
// {
 
91
//     //if (!useGLSL) return false; // GLSL not available
 
92
//     //if (!_noshader) return true;
 
93
// 
 
94
//     if (loc==-1) return false;  // can't find variable
 
95
// 
 
96
//     glUniform3fARB(loc, v0, v1, v2);
 
97
// 
 
98
//     return true;
 
99
// }
 
100
// //----------------------------------------------------------------------------- 
 
101
// 
 
102
// bool IOpenGLShaderProgram::SetUniform4f(char* varname, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
 
103
// {
 
104
//     //if (!useGLSL) return false; // GLSL not available
 
105
//     //if (!_noshader) return true;
 
106
// 
 
107
//     GLint loc = GetUniformLocationARB(varname);
 
108
//     if (loc==-1) return false;  // can't find variable
 
109
// 
 
110
//     glUniform4fARB(loc, v0, v1, v2, v3);
 
111
// 
 
112
//     return true;
 
113
// }
 
114
// bool IOpenGLShaderProgram::SetUniform4f(GLint loc, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
 
115
// {
 
116
//     //if (!useGLSL) return false; // GLSL not available
 
117
//     //if (!_noshader) return true;
 
118
// 
 
119
//     if (loc==-1) return false;  // can't find variable
 
120
// 
 
121
//     glUniform4fARB(loc, v0, v1, v2, v3);
 
122
// 
 
123
//     return true;
 
124
// }
 
125
// //----------------------------------------------------------------------------- 
 
126
// 
 
127
// bool IOpenGLShaderProgram::SetUniform1i(char* varname, GLint v0)
 
128
// { 
 
129
//     //if (!useGLSL) return false; // GLSL not available
 
130
//     //if (!_noshader) return true;
 
131
// 
 
132
//     GLint loc = GetUniformLocationARB(varname);
 
133
//     if (loc==-1) return false;  // can't find variable
 
134
// 
 
135
//     glUniform1iARB(loc, v0);
 
136
// 
 
137
//     return true;
 
138
// }
 
139
// bool IOpenGLShaderProgram::SetUniform1i(GLint loc, GLint v0)
 
140
// { 
 
141
//     //if (!useGLSL) return false; // GLSL not available
 
142
//     //if (!_noshader) return true;
 
143
// 
 
144
//     if (loc==-1) return false;  // can't find variable
 
145
// 
 
146
//     glUniform1iARB(loc, v0);
 
147
// 
 
148
//     return true;
 
149
// }
 
150
// 
 
151
// bool IOpenGLShaderProgram::SetUniform2i(char* varname, GLint v0, GLint v1)
 
152
// {
 
153
//     //    if (!useGLSL) return false; // GLSL not available
 
154
//     //    if (!_noshader) return true;
 
155
// 
 
156
//     GLint loc = GetUniformLocationARB(varname);
 
157
//     if (loc==-1) return false;  // can't find variable
 
158
// 
 
159
//     glUniform2iARB(loc, v0, v1);
 
160
// 
 
161
// 
 
162
//     return true;
 
163
// }
 
164
// bool IOpenGLShaderProgram::SetUniform2i(GLint loc, GLint v0, GLint v1)
 
165
// {
 
166
//     //    if (!useGLSL) return false; // GLSL not available
 
167
//     //    if (!_noshader) return true;
 
168
// 
 
169
//     if (loc==-1) return false;  // can't find variable
 
170
// 
 
171
//     glUniform2iARB(loc, v0, v1);
 
172
// 
 
173
// 
 
174
//     return true;
 
175
// }
 
176
// //----------------------------------------------------------------------------- 
 
177
// 
 
178
// bool IOpenGLShaderProgram::SetUniform3i(char* varname, GLint v0, GLint v1, GLint v2)
 
179
// {
 
180
//     //    if (!useGLSL) return false; // GLSL not available
 
181
//     //    if (!_noshader) return true;
 
182
// 
 
183
//     GLint loc = GetUniformLocationARB(varname);
 
184
//     if (loc==-1) return false;  // can't find variable
 
185
// 
 
186
//     glUniform3iARB(loc, v0, v1, v2);
 
187
// 
 
188
//     return true;
 
189
// }
 
190
// bool IOpenGLShaderProgram::SetUniform3i(GLint loc, GLint v0, GLint v1, GLint v2)
 
191
// {
 
192
//     //    if (!useGLSL) return false; // GLSL not available
 
193
//     //    if (!_noshader) return true;
 
194
// 
 
195
//     if (loc==-1) return false;  // can't find variable
 
196
// 
 
197
//     glUniform3iARB(loc, v0, v1, v2);
 
198
// 
 
199
//     return true;
 
200
// }
 
201
// 
 
202
// bool IOpenGLShaderProgram::SetUniform4i(char* varname, GLint v0, GLint v1, GLint v2, GLint v3)
 
203
// {
 
204
//     //    if (!useGLSL) return false; // GLSL not available
 
205
//     //    if (!_noshader) return true;
 
206
// 
 
207
//     GLint loc = GetUniformLocationARB(varname);
 
208
//     if (loc==-1) return false;  // can't find variable
 
209
// 
 
210
//     glUniform4iARB(loc, v0, v1, v2, v3);
 
211
// 
 
212
//     return true;
 
213
// }
 
214
// bool IOpenGLShaderProgram::SetUniform4i(GLint loc, GLint v0, GLint v1, GLint v2, GLint v3)
 
215
// {
 
216
//     //    if (!useGLSL) return false; // GLSL not available
 
217
//     //    if (!_noshader) return true;
 
218
// 
 
219
//     if (loc==-1) return false;  // can't find variable
 
220
// 
 
221
//     glUniform4iARB(loc, v0, v1, v2, v3);
 
222
// 
 
223
//     return true;
 
224
// }
 
225
// //----------------------------------------------------------------------------- 
 
226
// 
 
227
// bool IOpenGLShaderProgram::SetUniform1fv(char* varname, GLsizei count, GLfloat *value)
 
228
// {
 
229
//     //    if (!useGLSL) return false; // GLSL not available
 
230
//     //    if (!_noshader) return true;
 
231
// 
 
232
//     GLint loc = GetUniformLocationARB(varname);
 
233
//     if (loc==-1) return false;  // can't find variable
 
234
// 
 
235
//     glUniform1fvARB(loc, count, value);
 
236
// 
 
237
//     return true;
 
238
// }
 
239
// bool IOpenGLShaderProgram::SetUniform1fv(GLint loc, GLsizei count, GLfloat *value)
 
240
// {
 
241
//     //    if (!useGLSL) return false; // GLSL not available
 
242
//     //    if (!_noshader) return true;
 
243
// 
 
244
//     if (loc==-1) return false;  // can't find variable
 
245
// 
 
246
//     glUniform1fvARB(loc, count, value);
 
247
// 
 
248
//     return true;
 
249
// }
 
250
// 
 
251
// bool IOpenGLShaderProgram::SetUniform2fv(char* varname, GLsizei count, GLfloat *value)
 
252
// {
 
253
//     //    if (!useGLSL) return false; // GLSL not available
 
254
//     //    if (!_noshader) return true;
 
255
// 
 
256
//     GLint loc = GetUniformLocationARB(varname);
 
257
//     if (loc==-1) return false;  // can't find variable
 
258
// 
 
259
//     glUniform2fvARB(loc, count, value);
 
260
// 
 
261
//     return true;
 
262
// }
 
263
// bool IOpenGLShaderProgram::SetUniform2fv(GLint loc, GLsizei count, GLfloat *value)
 
264
// {
 
265
//     //    if (!useGLSL) return false; // GLSL not available
 
266
//     //    if (!_noshader) return true;
 
267
// 
 
268
//     if (loc==-1) return false;  // can't find variable
 
269
// 
 
270
//     glUniform2fvARB(loc, count, value);
 
271
// 
 
272
//     return true;
 
273
// }
 
274
// //----------------------------------------------------------------------------- 
 
275
// 
 
276
// bool IOpenGLShaderProgram::SetUniform3fv(char* varname, GLsizei count, GLfloat *value)
 
277
// {
 
278
//     //    if (!useGLSL) return false; // GLSL not available
 
279
//     //    if (!_noshader) return true;
 
280
// 
 
281
//     GLint loc = GetUniformLocationARB(varname);
 
282
//     if (loc==-1) return false;  // can't find variable
 
283
// 
 
284
//     glUniform3fvARB(loc, count, value);
 
285
// 
 
286
//     return true;
 
287
// }
 
288
// bool IOpenGLShaderProgram::SetUniform3fv(GLint loc, GLsizei count, GLfloat *value)
 
289
// {
 
290
//     //    if (!useGLSL) return false; // GLSL not available
 
291
//     //    if (!_noshader) return true;
 
292
// 
 
293
//     if (loc==-1) return false;  // can't find variable
 
294
// 
 
295
//     glUniform3fvARB(loc, count, value);
 
296
// 
 
297
//     return true;
 
298
// }
 
299
// //----------------------------------------------------------------------------- 
 
300
// 
 
301
// bool IOpenGLShaderProgram::SetUniform4fv(char* varname, GLsizei count, GLfloat *value)
 
302
// {
 
303
//     //    if (!useGLSL) return false; // GLSL not available
 
304
//     //    if (!_noshader) return true;
 
305
// 
 
306
//     GLint loc = GetUniformLocationARB(varname);
 
307
//     if (loc==-1) return false;  // can't find variable
 
308
// 
 
309
//     glUniform4fvARB(loc, count, value);
 
310
// 
 
311
//     return true;
 
312
// }
 
313
// bool IOpenGLShaderProgram::SetUniform4fv(GLint loc, GLsizei count, GLfloat *value)
 
314
// {
 
315
//     //    if (!useGLSL) return false; // GLSL not available
 
316
//     //    if (!_noshader) return true;
 
317
// 
 
318
//     if (loc==-1) return false;  // can't find variable
 
319
// 
 
320
//     glUniform4fvARB(loc, count, value);
 
321
// 
 
322
//     return true;
 
323
// }
 
324
// //----------------------------------------------------------------------------- 
 
325
// 
 
326
// bool IOpenGLShaderProgram::SetUniform1iv(char* varname, GLsizei count, GLint *value)
 
327
// {
 
328
//     //    if (!useGLSL) return false; // GLSL not available
 
329
//     //    if (!_noshader) return true;
 
330
// 
 
331
//     GLint loc = GetUniformLocationARB(varname);
 
332
//     if (loc==-1) return false;  // can't find variable
 
333
// 
 
334
//     glUniform1ivARB(loc, count, value);
 
335
// 
 
336
//     return true;
 
337
// }
 
338
// bool IOpenGLShaderProgram::SetUniform1iv(GLint loc, GLsizei count, GLint *value)
 
339
// {
 
340
//     //    if (!useGLSL) return false; // GLSL not available
 
341
//     //    if (!_noshader) return true;
 
342
// 
 
343
//     if (loc==-1) return false;  // can't find variable
 
344
// 
 
345
//     glUniform1ivARB(loc, count, value);
 
346
// 
 
347
//     return true;
 
348
// }
 
349
// //----------------------------------------------------------------------------- 
 
350
// 
 
351
// bool IOpenGLShaderProgram::SetUniform2iv(char* varname, GLsizei count, GLint *value)
 
352
// {
 
353
//     //    if (!useGLSL) return false; // GLSL not available
 
354
//     //    if (!_noshader) return true;
 
355
// 
 
356
//     GLint loc = GetUniformLocationARB(varname);
 
357
//     if (loc==-1) return false;  // can't find variable
 
358
// 
 
359
//     glUniform2ivARB(loc, count, value);
 
360
// 
 
361
//     return true;
 
362
// }
 
363
// bool IOpenGLShaderProgram::SetUniform2iv(GLint loc, GLsizei count, GLint *value)
 
364
// {
 
365
//     //    if (!useGLSL) return false; // GLSL not available
 
366
//     //    if (!_noshader) return true;
 
367
// 
 
368
//     if (loc==-1) return false;  // can't find variable
 
369
// 
 
370
//     glUniform2ivARB(loc, count, value);
 
371
// 
 
372
//     return true;
 
373
// }
 
374
// //----------------------------------------------------------------------------- 
 
375
// 
 
376
// bool IOpenGLShaderProgram::SetUniform3iv(char* varname, GLsizei count, GLint *value)
 
377
// {
 
378
//     //    if (!useGLSL) return false; // GLSL not available
 
379
//     //    if (!_noshader) return true;
 
380
// 
 
381
//     GLint loc = GetUniformLocationARB(varname);
 
382
//     if (loc==-1) return false;  // can't find variable
 
383
// 
 
384
//     glUniform3ivARB(loc, count, value);
 
385
// 
 
386
//     return true;
 
387
// }
 
388
// bool IOpenGLShaderProgram::SetUniform3iv(GLint loc, GLsizei count, GLint *value)
 
389
// {
 
390
//     //    if (!useGLSL) return false; // GLSL not available
 
391
//     //    if (!_noshader) return true;
 
392
// 
 
393
//     if (loc==-1) return false;  // can't find variable
 
394
// 
 
395
//     glUniform3ivARB(loc, count, value);
 
396
// 
 
397
//     return true;
 
398
// }
 
399
// //----------------------------------------------------------------------------- 
 
400
// 
 
401
// bool IOpenGLShaderProgram::SetUniform4iv(char* varname, GLsizei count, GLint *value)
 
402
// {
 
403
//     //    if (!useGLSL) return false; // GLSL not available
 
404
//     //    if (!_noshader) return true;
 
405
// 
 
406
//     GLint loc = GetUniformLocationARB(varname);
 
407
//     if (loc==-1) return false;  // can't find variable
 
408
// 
 
409
//     glUniform4ivARB(loc, count, value);
 
410
// 
 
411
//     return true;
 
412
// }
 
413
// bool IOpenGLShaderProgram::SetUniform4iv(GLint loc, GLsizei count, GLint *value)
 
414
// {
 
415
//     //    if (!useGLSL) return false; // GLSL not available
 
416
//     //    if (!_noshader) return true;
 
417
// 
 
418
//     if (loc==-1) return false;  // can't find variable
 
419
// 
 
420
//     glUniform4ivARB(loc, count, value);
 
421
// 
 
422
//     return true;
 
423
// }
 
424
// //----------------------------------------------------------------------------- 
 
425
// 
 
426
// bool IOpenGLShaderProgram::SetUniformMatrix2fv(char* varname, GLsizei count, GLboolean transpose, GLfloat *value)
 
427
// {
 
428
//     //    if (!useGLSL) return false; // GLSL not available
 
429
//     //    if (!_noshader) return true;
 
430
// 
 
431
//     GLint loc = GetUniformLocationARB(varname);
 
432
//     if (loc==-1) return false;  // can't find variable
 
433
// 
 
434
//     glUniformMatrix2fvARB(loc, count, transpose, value);
 
435
// 
 
436
//     return true;
 
437
// }
 
438
// bool IOpenGLShaderProgram::SetUniformLocMatrix2fv(GLint loc, GLsizei count, GLboolean transpose, GLfloat *value)
 
439
// {
 
440
//     //    if (!useGLSL) return false; // GLSL not available
 
441
//     //    if (!_noshader) return true;
 
442
// 
 
443
//     if (loc==-1) return false;  // can't find variable
 
444
// 
 
445
//     glUniformMatrix2fvARB(loc, count, transpose, value);
 
446
// 
 
447
//     return true;
 
448
// }
 
449
// //----------------------------------------------------------------------------- 
 
450
// 
 
451
// bool IOpenGLShaderProgram::SetUniformMatrix3fv(char* varname, GLsizei count, GLboolean transpose, GLfloat *value)
 
452
// {
 
453
//     //    if (!useGLSL) return false; // GLSL not available
 
454
//     //    if (!_noshader) return true;
 
455
// 
 
456
//     GLint loc = GetUniformLocationARB(varname);
 
457
//     if (loc==-1) return false;  // can't find variable
 
458
// 
 
459
//     glUniformMatrix3fvARB(loc, count, transpose, value);
 
460
// 
 
461
//     return true;
 
462
// }
 
463
// bool IOpenGLShaderProgram::SetUniformLocMatrix3fv(GLint loc, GLsizei count, GLboolean transpose, GLfloat *value)
 
464
// {
 
465
//     //    if (!useGLSL) return false; // GLSL not available
 
466
//     //    if (!_noshader) return true;
 
467
// 
 
468
//     if (loc==-1) return false;  // can't find variable
 
469
// 
 
470
//     glUniformMatrix3fvARB(loc, count, transpose, value);
 
471
// 
 
472
//     return true;
 
473
// }
 
474
// //----------------------------------------------------------------------------- 
 
475
// 
 
476
// bool IOpenGLShaderProgram::SetUniformMatrix4fv(char* varname, GLsizei count, GLboolean transpose, GLfloat *value)
 
477
// {
 
478
//     //    if (!useGLSL) return false; // GLSL not available
 
479
//     //    if (!_noshader) return true;
 
480
// 
 
481
//     GLint loc = GetUniformLocationARB(varname);
 
482
//     if (loc==-1) return false;  // can't find variable
 
483
// 
 
484
//     glUniformMatrix4fvARB(loc, count, transpose, value);
 
485
// 
 
486
//     return true;
 
487
// }
 
488
// bool IOpenGLShaderProgram::SetUniformLocMatrix4fv(GLint loc, GLsizei count, GLboolean transpose, GLfloat *value)
 
489
// {
 
490
//     //    if (!useGLSL) return false; // GLSL not available
 
491
//     //    if (!_noshader) return true;
 
492
// 
 
493
//     if (loc==-1) return false;  // can't find variable
 
494
// 
 
495
//     glUniformMatrix4fvARB(loc, count, transpose, value);
 
496
// 
 
497
//     return true;
 
498
// }
 
499
// 
 
500
// //----------------------------------------------------------------------------- 
 
501
// 
 
502
// void IOpenGLShaderProgram::GetUniformfv(char* name, GLfloat* values)
 
503
// {
 
504
//     //     if (!useGLSL) return;
 
505
//     GLint loc;
 
506
// 
 
507
//     loc = glGetUniformLocationARB(_OpenGLID, name);
 
508
//     if (loc == -1) 
 
509
//     {
 
510
//         std::cout << "Error: can't find uniform variable \"" << name << "\"\n";
 
511
//     }
 
512
//     glGetUniformfvARB(_OpenGLID, loc, values);
 
513
// }
 
514
// 
 
515
// //----------------------------------------------------------------------------- 
 
516
// 
 
517
// void IOpenGLShaderProgram::GetUniformiv(char* name, GLint* values)
 
518
// {
 
519
//     //if (!useGLSL) return;
 
520
//     GLint loc;
 
521
//     loc = glGetUniformLocationARB(_OpenGLID, name);
 
522
//     if (loc == -1) 
 
523
//     {
 
524
//         std::cout << "Error: can't find uniform variable \"" << name << "\"\n";
 
525
//     }
 
526
//     glGetUniformivARB(_OpenGLID, loc, values);
 
527
// }
 
528
// //----------------------------------------------------------------------------- 
 
529
// 
 
530
// int IOpenGLShaderProgram::GetUniformLocationARB(const GLcharARB* name)
 
531
// {
 
532
//     GLint loc;
 
533
//     loc = glGetUniformLocationARB(_OpenGLID, name);
 
534
//     return loc;
 
535
// }
 
536
// 
 
537
// //----------------------------------------------------------------------------- 
 
538
// void IOpenGLShaderProgram::GetActiveUniformARB(
 
539
//     GLuint index,
 
540
//     GLsizei maxLength,
 
541
//     GLsizei *length,
 
542
//     GLint *size,
 
543
//     GLenum *type,
 
544
//     GLcharARB *name)
 
545
// {
 
546
// 
 
547
//     glGetActiveUniformARB(_OpenGLID,
 
548
//         index,
 
549
//         maxLength,
 
550
//         length,
 
551
//         size,
 
552
//         type,
 
553
//         name);
 
554
//     CHECKGL_MSG(glGetActiveUniformARB);
 
555
// }
 
556
// 
 
557
// //----------------------------------------------------------------------------- 
 
558
// 
 
559
// void IOpenGLShaderProgram::GetObjectParameterfvARB(GLenum pname,
 
560
//                                                    GLfloat *params)
 
561
// {
 
562
//     glGetObjectParameterfvARB(_OpenGLID,
 
563
//         pname,
 
564
//         params);
 
565
//     CHECKGL_MSG(glGetObjectParameterfvARB);
 
566
// }
 
567
// 
 
568
// //----------------------------------------------------------------------------- 
 
569
// 
 
570
// BOOL IOpenGLShaderProgram::SetSampler(char* name, int texture_unit)
 
571
// {
 
572
//     GLint loc = GetUniformLocationARB(name);
 
573
//     if (loc==-1) return false;  // can't find variable
 
574
// 
 
575
//     glUniform1iARB(loc, texture_unit);
 
576
//     return true;
 
577
// }
 
578
// 
 
579
NAMESPACE_END_OGL