aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8/source/Irrlicht/COpenGLSLMaterialRenderer.cpp
diff options
context:
space:
mode:
authorDavid Walter Seikel2013-01-13 18:54:10 +1000
committerDavid Walter Seikel2013-01-13 18:54:10 +1000
commit959831f4ef5a3e797f576c3de08cd65032c997ad (patch)
treee7351908be5995f0b325b2ebeaa02d5a34b82583 /libraries/irrlicht-1.8/source/Irrlicht/COpenGLSLMaterialRenderer.cpp
parentAdd info about changes to Irrlicht. (diff)
downloadSledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.zip
SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.gz
SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.bz2
SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.xz
Remove damned ancient DOS line endings from Irrlicht. Hopefully I did not go overboard.
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/COpenGLSLMaterialRenderer.cpp')
-rw-r--r--libraries/irrlicht-1.8/source/Irrlicht/COpenGLSLMaterialRenderer.cpp1404
1 files changed, 702 insertions, 702 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/COpenGLSLMaterialRenderer.cpp b/libraries/irrlicht-1.8/source/Irrlicht/COpenGLSLMaterialRenderer.cpp
index 6964c18..e6980c9 100644
--- a/libraries/irrlicht-1.8/source/Irrlicht/COpenGLSLMaterialRenderer.cpp
+++ b/libraries/irrlicht-1.8/source/Irrlicht/COpenGLSLMaterialRenderer.cpp
@@ -1,702 +1,702 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt 1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine". 2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h 3// For conditions of distribution and use, see copyright notice in irrlicht.h
4 4
5// This file was originally written by William Finlayson. I (Nikolaus 5// This file was originally written by William Finlayson. I (Nikolaus
6// Gebhardt) did some minor modifications and changes to it and integrated it 6// Gebhardt) did some minor modifications and changes to it and integrated it
7// into Irrlicht. Thanks a lot to William for his work on this and that he gave 7// into Irrlicht. Thanks a lot to William for his work on this and that he gave
8// me his permission to add it into Irrlicht using the zlib license. 8// me his permission to add it into Irrlicht using the zlib license.
9 9
10// After Irrlicht 0.12, Michael Zoech did some improvements to this renderer, I 10// After Irrlicht 0.12, Michael Zoech did some improvements to this renderer, I
11// merged this into Irrlicht 0.14, thanks to him for his work. 11// merged this into Irrlicht 0.14, thanks to him for his work.
12 12
13#include "IrrCompileConfig.h" 13#include "IrrCompileConfig.h"
14#ifdef _IRR_COMPILE_WITH_OPENGL_ 14#ifdef _IRR_COMPILE_WITH_OPENGL_
15 15
16#include "COpenGLSLMaterialRenderer.h" 16#include "COpenGLSLMaterialRenderer.h"
17#include "IGPUProgrammingServices.h" 17#include "IGPUProgrammingServices.h"
18#include "IShaderConstantSetCallBack.h" 18#include "IShaderConstantSetCallBack.h"
19#include "IMaterialRendererServices.h" 19#include "IMaterialRendererServices.h"
20#include "IVideoDriver.h" 20#include "IVideoDriver.h"
21#include "os.h" 21#include "os.h"
22#include "COpenGLDriver.h" 22#include "COpenGLDriver.h"
23 23
24namespace irr 24namespace irr
25{ 25{
26namespace video 26namespace video
27{ 27{
28 28
29 29
30//! Constructor 30//! Constructor
31COpenGLSLMaterialRenderer::COpenGLSLMaterialRenderer(video::COpenGLDriver* driver, 31COpenGLSLMaterialRenderer::COpenGLSLMaterialRenderer(video::COpenGLDriver* driver,
32 s32& outMaterialTypeNr, const c8* vertexShaderProgram, 32 s32& outMaterialTypeNr, const c8* vertexShaderProgram,
33 const c8* vertexShaderEntryPointName, 33 const c8* vertexShaderEntryPointName,
34 E_VERTEX_SHADER_TYPE vsCompileTarget, 34 E_VERTEX_SHADER_TYPE vsCompileTarget,
35 const c8* pixelShaderProgram, 35 const c8* pixelShaderProgram,
36 const c8* pixelShaderEntryPointName, 36 const c8* pixelShaderEntryPointName,
37 E_PIXEL_SHADER_TYPE psCompileTarget, 37 E_PIXEL_SHADER_TYPE psCompileTarget,
38 const c8* geometryShaderProgram, 38 const c8* geometryShaderProgram,
39 const c8* geometryShaderEntryPointName, 39 const c8* geometryShaderEntryPointName,
40 E_GEOMETRY_SHADER_TYPE gsCompileTarget, 40 E_GEOMETRY_SHADER_TYPE gsCompileTarget,
41 scene::E_PRIMITIVE_TYPE inType, scene::E_PRIMITIVE_TYPE outType, 41 scene::E_PRIMITIVE_TYPE inType, scene::E_PRIMITIVE_TYPE outType,
42 u32 verticesOut, 42 u32 verticesOut,
43 IShaderConstantSetCallBack* callback, 43 IShaderConstantSetCallBack* callback,
44 video::IMaterialRenderer* baseMaterial, 44 video::IMaterialRenderer* baseMaterial,
45 s32 userData) 45 s32 userData)
46 : Driver(driver), CallBack(callback), BaseMaterial(baseMaterial), 46 : Driver(driver), CallBack(callback), BaseMaterial(baseMaterial),
47 Program(0), Program2(0), UserData(userData) 47 Program(0), Program2(0), UserData(userData)
48{ 48{
49 #ifdef _DEBUG 49 #ifdef _DEBUG
50 setDebugName("COpenGLSLMaterialRenderer"); 50 setDebugName("COpenGLSLMaterialRenderer");
51 #endif 51 #endif
52 52
53 //entry points must always be main, and the compile target isn't selectable 53 //entry points must always be main, and the compile target isn't selectable
54 //it is fine to ignore what has been asked for, as the compiler should spot anything wrong 54 //it is fine to ignore what has been asked for, as the compiler should spot anything wrong
55 //just check that GLSL is available 55 //just check that GLSL is available
56 56
57 if (BaseMaterial) 57 if (BaseMaterial)
58 BaseMaterial->grab(); 58 BaseMaterial->grab();
59 59
60 if (CallBack) 60 if (CallBack)
61 CallBack->grab(); 61 CallBack->grab();
62 62
63 if (!Driver->queryFeature(EVDF_ARB_GLSL)) 63 if (!Driver->queryFeature(EVDF_ARB_GLSL))
64 return; 64 return;
65 65
66 init(outMaterialTypeNr, vertexShaderProgram, pixelShaderProgram, geometryShaderProgram); 66 init(outMaterialTypeNr, vertexShaderProgram, pixelShaderProgram, geometryShaderProgram);
67} 67}
68 68
69 69
70//! constructor only for use by derived classes who want to 70//! constructor only for use by derived classes who want to
71//! create a fall back material for example. 71//! create a fall back material for example.
72COpenGLSLMaterialRenderer::COpenGLSLMaterialRenderer(COpenGLDriver* driver, 72COpenGLSLMaterialRenderer::COpenGLSLMaterialRenderer(COpenGLDriver* driver,
73 IShaderConstantSetCallBack* callback, 73 IShaderConstantSetCallBack* callback,
74 IMaterialRenderer* baseMaterial, s32 userData) 74 IMaterialRenderer* baseMaterial, s32 userData)
75: Driver(driver), CallBack(callback), BaseMaterial(baseMaterial), 75: Driver(driver), CallBack(callback), BaseMaterial(baseMaterial),
76 Program(0), Program2(0), UserData(userData) 76 Program(0), Program2(0), UserData(userData)
77{ 77{
78 if (BaseMaterial) 78 if (BaseMaterial)
79 BaseMaterial->grab(); 79 BaseMaterial->grab();
80 80
81 if (CallBack) 81 if (CallBack)
82 CallBack->grab(); 82 CallBack->grab();
83} 83}
84 84
85 85
86//! Destructor 86//! Destructor
87COpenGLSLMaterialRenderer::~COpenGLSLMaterialRenderer() 87COpenGLSLMaterialRenderer::~COpenGLSLMaterialRenderer()
88{ 88{
89 if (CallBack) 89 if (CallBack)
90 CallBack->drop(); 90 CallBack->drop();
91 91
92 if (Program) 92 if (Program)
93 { 93 {
94 GLhandleARB shaders[8]; 94 GLhandleARB shaders[8];
95 GLint count; 95 GLint count;
96 Driver->extGlGetAttachedObjects(Program, 8, &count, shaders); 96 Driver->extGlGetAttachedObjects(Program, 8, &count, shaders);
97 // avoid bugs in some drivers, which return larger numbers 97 // avoid bugs in some drivers, which return larger numbers
98 count=core::min_(count,8); 98 count=core::min_(count,8);
99 for (GLint i=0; i<count; ++i) 99 for (GLint i=0; i<count; ++i)
100 Driver->extGlDeleteObject(shaders[i]); 100 Driver->extGlDeleteObject(shaders[i]);
101 Driver->extGlDeleteObject(Program); 101 Driver->extGlDeleteObject(Program);
102 Program = 0; 102 Program = 0;
103 } 103 }
104 104
105 if (Program2) 105 if (Program2)
106 { 106 {
107 GLuint shaders[8]; 107 GLuint shaders[8];
108 GLint count; 108 GLint count;
109 Driver->extGlGetAttachedShaders(Program2, 8, &count, shaders); 109 Driver->extGlGetAttachedShaders(Program2, 8, &count, shaders);
110 // avoid bugs in some drivers, which return larger numbers 110 // avoid bugs in some drivers, which return larger numbers
111 count=core::min_(count,8); 111 count=core::min_(count,8);
112 for (GLint i=0; i<count; ++i) 112 for (GLint i=0; i<count; ++i)
113 Driver->extGlDeleteShader(shaders[i]); 113 Driver->extGlDeleteShader(shaders[i]);
114 Driver->extGlDeleteProgram(Program2); 114 Driver->extGlDeleteProgram(Program2);
115 Program2 = 0; 115 Program2 = 0;
116 } 116 }
117 117
118 UniformInfo.clear(); 118 UniformInfo.clear();
119 119
120 if (BaseMaterial) 120 if (BaseMaterial)
121 BaseMaterial->drop(); 121 BaseMaterial->drop();
122} 122}
123 123
124 124
125void COpenGLSLMaterialRenderer::init(s32& outMaterialTypeNr, 125void COpenGLSLMaterialRenderer::init(s32& outMaterialTypeNr,
126 const c8* vertexShaderProgram, 126 const c8* vertexShaderProgram,
127 const c8* pixelShaderProgram, 127 const c8* pixelShaderProgram,
128 const c8* geometryShaderProgram, 128 const c8* geometryShaderProgram,
129 scene::E_PRIMITIVE_TYPE inType, scene::E_PRIMITIVE_TYPE outType, 129 scene::E_PRIMITIVE_TYPE inType, scene::E_PRIMITIVE_TYPE outType,
130 u32 verticesOut) 130 u32 verticesOut)
131{ 131{
132 outMaterialTypeNr = -1; 132 outMaterialTypeNr = -1;
133 133
134 if (!createProgram()) 134 if (!createProgram())
135 return; 135 return;
136 136
137#if defined(GL_ARB_vertex_shader) && defined (GL_ARB_fragment_shader) 137#if defined(GL_ARB_vertex_shader) && defined (GL_ARB_fragment_shader)
138 if (vertexShaderProgram) 138 if (vertexShaderProgram)
139 if (!createShader(GL_VERTEX_SHADER_ARB, vertexShaderProgram)) 139 if (!createShader(GL_VERTEX_SHADER_ARB, vertexShaderProgram))
140 return; 140 return;
141 141
142 if (pixelShaderProgram) 142 if (pixelShaderProgram)
143 if (!createShader(GL_FRAGMENT_SHADER_ARB, pixelShaderProgram)) 143 if (!createShader(GL_FRAGMENT_SHADER_ARB, pixelShaderProgram))
144 return; 144 return;
145#endif 145#endif
146 146
147#if defined(GL_ARB_geometry_shader4) || defined(GL_EXT_geometry_shader4) || defined(GL_NV_geometry_program4) || defined(GL_NV_geometry_shader4) 147#if defined(GL_ARB_geometry_shader4) || defined(GL_EXT_geometry_shader4) || defined(GL_NV_geometry_program4) || defined(GL_NV_geometry_shader4)
148 if (geometryShaderProgram && Driver->queryFeature(EVDF_GEOMETRY_SHADER)) 148 if (geometryShaderProgram && Driver->queryFeature(EVDF_GEOMETRY_SHADER))
149 { 149 {
150 if (!createShader(GL_GEOMETRY_SHADER_EXT, geometryShaderProgram)) 150 if (!createShader(GL_GEOMETRY_SHADER_EXT, geometryShaderProgram))
151 return; 151 return;
152#if defined(GL_ARB_geometry_shader4) || defined(GL_EXT_geometry_shader4) || defined(GL_NV_geometry_shader4) 152#if defined(GL_ARB_geometry_shader4) || defined(GL_EXT_geometry_shader4) || defined(GL_NV_geometry_shader4)
153 if (Program2) 153 if (Program2)
154 { 154 {
155 Driver->extGlProgramParameteri((GLhandleARB)Program2, GL_GEOMETRY_INPUT_TYPE_EXT, Driver->primitiveTypeToGL(inType)); 155 Driver->extGlProgramParameteri((GLhandleARB)Program2, GL_GEOMETRY_INPUT_TYPE_EXT, Driver->primitiveTypeToGL(inType));
156 Driver->extGlProgramParameteri((GLhandleARB)Program2, GL_GEOMETRY_OUTPUT_TYPE_EXT, Driver->primitiveTypeToGL(outType)); 156 Driver->extGlProgramParameteri((GLhandleARB)Program2, GL_GEOMETRY_OUTPUT_TYPE_EXT, Driver->primitiveTypeToGL(outType));
157 if (verticesOut==0) 157 if (verticesOut==0)
158 Driver->extGlProgramParameteri((GLhandleARB)Program2, GL_GEOMETRY_VERTICES_OUT_EXT, Driver->MaxGeometryVerticesOut); 158 Driver->extGlProgramParameteri((GLhandleARB)Program2, GL_GEOMETRY_VERTICES_OUT_EXT, Driver->MaxGeometryVerticesOut);
159 else 159 else
160 Driver->extGlProgramParameteri((GLhandleARB)Program2, GL_GEOMETRY_VERTICES_OUT_EXT, core::min_(verticesOut, Driver->MaxGeometryVerticesOut)); 160 Driver->extGlProgramParameteri((GLhandleARB)Program2, GL_GEOMETRY_VERTICES_OUT_EXT, core::min_(verticesOut, Driver->MaxGeometryVerticesOut));
161 } 161 }
162 else 162 else
163 { 163 {
164 Driver->extGlProgramParameteri(Program, GL_GEOMETRY_INPUT_TYPE_EXT, Driver->primitiveTypeToGL(inType)); 164 Driver->extGlProgramParameteri(Program, GL_GEOMETRY_INPUT_TYPE_EXT, Driver->primitiveTypeToGL(inType));
165 Driver->extGlProgramParameteri(Program, GL_GEOMETRY_OUTPUT_TYPE_EXT, Driver->primitiveTypeToGL(outType)); 165 Driver->extGlProgramParameteri(Program, GL_GEOMETRY_OUTPUT_TYPE_EXT, Driver->primitiveTypeToGL(outType));
166 if (verticesOut==0) 166 if (verticesOut==0)
167 Driver->extGlProgramParameteri(Program, GL_GEOMETRY_VERTICES_OUT_EXT, Driver->MaxGeometryVerticesOut); 167 Driver->extGlProgramParameteri(Program, GL_GEOMETRY_VERTICES_OUT_EXT, Driver->MaxGeometryVerticesOut);
168 else 168 else
169 Driver->extGlProgramParameteri(Program, GL_GEOMETRY_VERTICES_OUT_EXT, core::min_(verticesOut, Driver->MaxGeometryVerticesOut)); 169 Driver->extGlProgramParameteri(Program, GL_GEOMETRY_VERTICES_OUT_EXT, core::min_(verticesOut, Driver->MaxGeometryVerticesOut));
170 } 170 }
171#elif defined(GL_NV_geometry_program4) 171#elif defined(GL_NV_geometry_program4)
172 if (verticesOut==0) 172 if (verticesOut==0)
173 Driver->extGlProgramVertexLimit(GL_GEOMETRY_PROGRAM_NV, Driver->MaxGeometryVerticesOut); 173 Driver->extGlProgramVertexLimit(GL_GEOMETRY_PROGRAM_NV, Driver->MaxGeometryVerticesOut);
174 else 174 else
175 Driver->extGlProgramVertexLimit(GL_GEOMETRY_PROGRAM_NV, core::min_(verticesOut, Driver->MaxGeometryVerticesOut)); 175 Driver->extGlProgramVertexLimit(GL_GEOMETRY_PROGRAM_NV, core::min_(verticesOut, Driver->MaxGeometryVerticesOut));
176#endif 176#endif
177 } 177 }
178#endif 178#endif
179 179
180 if (!linkProgram()) 180 if (!linkProgram())
181 return; 181 return;
182 182
183 // register myself as new material 183 // register myself as new material
184 outMaterialTypeNr = Driver->addMaterialRenderer(this); 184 outMaterialTypeNr = Driver->addMaterialRenderer(this);
185} 185}
186 186
187 187
188bool COpenGLSLMaterialRenderer::OnRender(IMaterialRendererServices* service, 188bool COpenGLSLMaterialRenderer::OnRender(IMaterialRendererServices* service,
189 E_VERTEX_TYPE vtxtype) 189 E_VERTEX_TYPE vtxtype)
190{ 190{
191 // call callback to set shader constants 191 // call callback to set shader constants
192 if (CallBack && (Program||Program2)) 192 if (CallBack && (Program||Program2))
193 CallBack->OnSetConstants(this, UserData); 193 CallBack->OnSetConstants(this, UserData);
194 194
195 return true; 195 return true;
196} 196}
197 197
198 198
199void COpenGLSLMaterialRenderer::OnSetMaterial(const video::SMaterial& material, 199void COpenGLSLMaterialRenderer::OnSetMaterial(const video::SMaterial& material,
200 const video::SMaterial& lastMaterial, 200 const video::SMaterial& lastMaterial,
201 bool resetAllRenderstates, 201 bool resetAllRenderstates,
202 video::IMaterialRendererServices* services) 202 video::IMaterialRendererServices* services)
203{ 203{
204 if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates) 204 if (material.MaterialType != lastMaterial.MaterialType || resetAllRenderstates)
205 { 205 {
206 if (Program2) 206 if (Program2)
207 Driver->extGlUseProgram(Program2); 207 Driver->extGlUseProgram(Program2);
208 else if (Program) 208 else if (Program)
209 Driver->extGlUseProgramObject(Program); 209 Driver->extGlUseProgramObject(Program);
210 210
211 if (BaseMaterial) 211 if (BaseMaterial)
212 BaseMaterial->OnSetMaterial(material, material, true, this); 212 BaseMaterial->OnSetMaterial(material, material, true, this);
213 } 213 }
214 214
215 //let callback know used material 215 //let callback know used material
216 if (CallBack) 216 if (CallBack)
217 CallBack->OnSetMaterial(material); 217 CallBack->OnSetMaterial(material);
218 218
219 for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i) 219 for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)
220 Driver->setActiveTexture(i, material.getTexture(i)); 220 Driver->setActiveTexture(i, material.getTexture(i));
221 Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); 221 Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
222} 222}
223 223
224 224
225void COpenGLSLMaterialRenderer::OnUnsetMaterial() 225void COpenGLSLMaterialRenderer::OnUnsetMaterial()
226{ 226{
227 if (Program) 227 if (Program)
228 Driver->extGlUseProgramObject(0); 228 Driver->extGlUseProgramObject(0);
229 if (Program2) 229 if (Program2)
230 Driver->extGlUseProgram(0); 230 Driver->extGlUseProgram(0);
231 231
232 if (BaseMaterial) 232 if (BaseMaterial)
233 BaseMaterial->OnUnsetMaterial(); 233 BaseMaterial->OnUnsetMaterial();
234} 234}
235 235
236 236
237//! Returns if the material is transparent. 237//! Returns if the material is transparent.
238bool COpenGLSLMaterialRenderer::isTransparent() const 238bool COpenGLSLMaterialRenderer::isTransparent() const
239{ 239{
240 return BaseMaterial ? BaseMaterial->isTransparent() : false; 240 return BaseMaterial ? BaseMaterial->isTransparent() : false;
241} 241}
242 242
243 243
244bool COpenGLSLMaterialRenderer::createProgram() 244bool COpenGLSLMaterialRenderer::createProgram()
245{ 245{
246 if (Driver->Version>=200) 246 if (Driver->Version>=200)
247 Program2 = Driver->extGlCreateProgram(); 247 Program2 = Driver->extGlCreateProgram();
248 else 248 else
249 Program = Driver->extGlCreateProgramObject(); 249 Program = Driver->extGlCreateProgramObject();
250 return true; 250 return true;
251} 251}
252 252
253 253
254bool COpenGLSLMaterialRenderer::createShader(GLenum shaderType, const char* shader) 254bool COpenGLSLMaterialRenderer::createShader(GLenum shaderType, const char* shader)
255{ 255{
256 if (Program2) 256 if (Program2)
257 { 257 {
258 GLuint shaderHandle = Driver->extGlCreateShader(shaderType); 258 GLuint shaderHandle = Driver->extGlCreateShader(shaderType);
259 Driver->extGlShaderSource(shaderHandle, 1, &shader, NULL); 259 Driver->extGlShaderSource(shaderHandle, 1, &shader, NULL);
260 Driver->extGlCompileShader(shaderHandle); 260 Driver->extGlCompileShader(shaderHandle);
261 261
262 GLint status = 0; 262 GLint status = 0;
263 263
264#ifdef GL_VERSION_2_0 264#ifdef GL_VERSION_2_0
265 Driver->extGlGetShaderiv(shaderHandle, GL_COMPILE_STATUS, &status); 265 Driver->extGlGetShaderiv(shaderHandle, GL_COMPILE_STATUS, &status);
266#endif 266#endif
267 267
268 if (status != GL_TRUE) 268 if (status != GL_TRUE)
269 { 269 {
270 os::Printer::log("GLSL shader failed to compile", ELL_ERROR); 270 os::Printer::log("GLSL shader failed to compile", ELL_ERROR);
271 // check error message and log it 271 // check error message and log it
272 GLint maxLength=0; 272 GLint maxLength=0;
273 GLint length; 273 GLint length;
274#ifdef GL_VERSION_2_0 274#ifdef GL_VERSION_2_0
275 Driver->extGlGetShaderiv(shaderHandle, GL_INFO_LOG_LENGTH, 275 Driver->extGlGetShaderiv(shaderHandle, GL_INFO_LOG_LENGTH,
276 &maxLength); 276 &maxLength);
277#endif 277#endif
278 if (maxLength) 278 if (maxLength)
279 { 279 {
280 GLchar *infoLog = new GLchar[maxLength]; 280 GLchar *infoLog = new GLchar[maxLength];
281 Driver->extGlGetShaderInfoLog(shaderHandle, maxLength, &length, infoLog); 281 Driver->extGlGetShaderInfoLog(shaderHandle, maxLength, &length, infoLog);
282 os::Printer::log(reinterpret_cast<const c8*>(infoLog), ELL_ERROR); 282 os::Printer::log(reinterpret_cast<const c8*>(infoLog), ELL_ERROR);
283 delete [] infoLog; 283 delete [] infoLog;
284 } 284 }
285 285
286 return false; 286 return false;
287 } 287 }
288 288
289 Driver->extGlAttachShader(Program2, shaderHandle); 289 Driver->extGlAttachShader(Program2, shaderHandle);
290 } 290 }
291 else 291 else
292 { 292 {
293 GLhandleARB shaderHandle = Driver->extGlCreateShaderObject(shaderType); 293 GLhandleARB shaderHandle = Driver->extGlCreateShaderObject(shaderType);
294 294
295 Driver->extGlShaderSourceARB(shaderHandle, 1, &shader, NULL); 295 Driver->extGlShaderSourceARB(shaderHandle, 1, &shader, NULL);
296 Driver->extGlCompileShaderARB(shaderHandle); 296 Driver->extGlCompileShaderARB(shaderHandle);
297 297
298 GLint status = 0; 298 GLint status = 0;
299 299
300#ifdef GL_ARB_shader_objects 300#ifdef GL_ARB_shader_objects
301 Driver->extGlGetObjectParameteriv(shaderHandle, GL_OBJECT_COMPILE_STATUS_ARB, &status); 301 Driver->extGlGetObjectParameteriv(shaderHandle, GL_OBJECT_COMPILE_STATUS_ARB, &status);
302#endif 302#endif
303 303
304 if (!status) 304 if (!status)
305 { 305 {
306 os::Printer::log("GLSL shader failed to compile", ELL_ERROR); 306 os::Printer::log("GLSL shader failed to compile", ELL_ERROR);
307 // check error message and log it 307 // check error message and log it
308 GLint maxLength=0; 308 GLint maxLength=0;
309 GLsizei length; 309 GLsizei length;
310#ifdef GL_ARB_shader_objects 310#ifdef GL_ARB_shader_objects
311 Driver->extGlGetObjectParameteriv(shaderHandle, 311 Driver->extGlGetObjectParameteriv(shaderHandle,
312 GL_OBJECT_INFO_LOG_LENGTH_ARB, &maxLength); 312 GL_OBJECT_INFO_LOG_LENGTH_ARB, &maxLength);
313#endif 313#endif
314 if (maxLength) 314 if (maxLength)
315 { 315 {
316 GLcharARB *infoLog = new GLcharARB[maxLength]; 316 GLcharARB *infoLog = new GLcharARB[maxLength];
317 Driver->extGlGetInfoLog(shaderHandle, maxLength, &length, infoLog); 317 Driver->extGlGetInfoLog(shaderHandle, maxLength, &length, infoLog);
318 os::Printer::log(reinterpret_cast<const c8*>(infoLog), ELL_ERROR); 318 os::Printer::log(reinterpret_cast<const c8*>(infoLog), ELL_ERROR);
319 delete [] infoLog; 319 delete [] infoLog;
320 } 320 }
321 321
322 return false; 322 return false;
323 } 323 }
324 324
325 Driver->extGlAttachObject(Program, shaderHandle); 325 Driver->extGlAttachObject(Program, shaderHandle);
326 } 326 }
327 return true; 327 return true;
328} 328}
329 329
330 330
331bool COpenGLSLMaterialRenderer::linkProgram() 331bool COpenGLSLMaterialRenderer::linkProgram()
332{ 332{
333 if (Program2) 333 if (Program2)
334 { 334 {
335 Driver->extGlLinkProgram(Program2); 335 Driver->extGlLinkProgram(Program2);
336 336
337 GLint status = 0; 337 GLint status = 0;
338 338
339#ifdef GL_VERSION_2_0 339#ifdef GL_VERSION_2_0
340 Driver->extGlGetProgramiv(Program2, GL_LINK_STATUS, &status); 340 Driver->extGlGetProgramiv(Program2, GL_LINK_STATUS, &status);
341#endif 341#endif
342 342
343 if (!status) 343 if (!status)
344 { 344 {
345 os::Printer::log("GLSL shader program failed to link", ELL_ERROR); 345 os::Printer::log("GLSL shader program failed to link", ELL_ERROR);
346 // check error message and log it 346 // check error message and log it
347 GLint maxLength=0; 347 GLint maxLength=0;
348 GLsizei length; 348 GLsizei length;
349#ifdef GL_VERSION_2_0 349#ifdef GL_VERSION_2_0
350 Driver->extGlGetProgramiv(Program2, GL_INFO_LOG_LENGTH, &maxLength); 350 Driver->extGlGetProgramiv(Program2, GL_INFO_LOG_LENGTH, &maxLength);
351#endif 351#endif
352 if (maxLength) 352 if (maxLength)
353 { 353 {
354 GLchar *infoLog = new GLchar[maxLength]; 354 GLchar *infoLog = new GLchar[maxLength];
355 Driver->extGlGetProgramInfoLog(Program2, maxLength, &length, infoLog); 355 Driver->extGlGetProgramInfoLog(Program2, maxLength, &length, infoLog);
356 os::Printer::log(reinterpret_cast<const c8*>(infoLog), ELL_ERROR); 356 os::Printer::log(reinterpret_cast<const c8*>(infoLog), ELL_ERROR);
357 delete [] infoLog; 357 delete [] infoLog;
358 } 358 }
359 359
360 return false; 360 return false;
361 } 361 }
362 362
363 // get uniforms information 363 // get uniforms information
364 364
365 GLint num = 0; 365 GLint num = 0;
366#ifdef GL_VERSION_2_0 366#ifdef GL_VERSION_2_0
367 Driver->extGlGetProgramiv(Program2, GL_ACTIVE_UNIFORMS, &num); 367 Driver->extGlGetProgramiv(Program2, GL_ACTIVE_UNIFORMS, &num);
368#endif 368#endif
369 369
370 if (num == 0) 370 if (num == 0)
371 { 371 {
372 // no uniforms 372 // no uniforms
373 return true; 373 return true;
374 } 374 }
375 375
376 GLint maxlen = 0; 376 GLint maxlen = 0;
377#ifdef GL_VERSION_2_0 377#ifdef GL_VERSION_2_0
378 Driver->extGlGetProgramiv(Program2, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxlen); 378 Driver->extGlGetProgramiv(Program2, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxlen);
379#endif 379#endif
380 380
381 if (maxlen == 0) 381 if (maxlen == 0)
382 { 382 {
383 os::Printer::log("GLSL: failed to retrieve uniform information", ELL_ERROR); 383 os::Printer::log("GLSL: failed to retrieve uniform information", ELL_ERROR);
384 return false; 384 return false;
385 } 385 }
386 386
387 // seems that some implementations use an extra null terminator 387 // seems that some implementations use an extra null terminator
388 ++maxlen; 388 ++maxlen;
389 c8 *buf = new c8[maxlen]; 389 c8 *buf = new c8[maxlen];
390 390
391 UniformInfo.clear(); 391 UniformInfo.clear();
392 UniformInfo.reallocate(num); 392 UniformInfo.reallocate(num);
393 393
394 for (GLint i=0; i < num; ++i) 394 for (GLint i=0; i < num; ++i)
395 { 395 {
396 SUniformInfo ui; 396 SUniformInfo ui;
397 memset(buf, 0, maxlen); 397 memset(buf, 0, maxlen);
398 398
399 GLint size; 399 GLint size;
400 Driver->extGlGetActiveUniform(Program2, i, maxlen, 0, &size, &ui.type, reinterpret_cast<GLchar*>(buf)); 400 Driver->extGlGetActiveUniform(Program2, i, maxlen, 0, &size, &ui.type, reinterpret_cast<GLchar*>(buf));
401 ui.name = buf; 401 ui.name = buf;
402 402
403 UniformInfo.push_back(ui); 403 UniformInfo.push_back(ui);
404 } 404 }
405 405
406 delete [] buf; 406 delete [] buf;
407 } 407 }
408 else 408 else
409 { 409 {
410 Driver->extGlLinkProgramARB(Program); 410 Driver->extGlLinkProgramARB(Program);
411 411
412 GLint status = 0; 412 GLint status = 0;
413 413
414#ifdef GL_ARB_shader_objects 414#ifdef GL_ARB_shader_objects
415 Driver->extGlGetObjectParameteriv(Program, GL_OBJECT_LINK_STATUS_ARB, &status); 415 Driver->extGlGetObjectParameteriv(Program, GL_OBJECT_LINK_STATUS_ARB, &status);
416#endif 416#endif
417 417
418 if (!status) 418 if (!status)
419 { 419 {
420 os::Printer::log("GLSL shader program failed to link", ELL_ERROR); 420 os::Printer::log("GLSL shader program failed to link", ELL_ERROR);
421 // check error message and log it 421 // check error message and log it
422 GLint maxLength=0; 422 GLint maxLength=0;
423 GLsizei length; 423 GLsizei length;
424#ifdef GL_ARB_shader_objects 424#ifdef GL_ARB_shader_objects
425 Driver->extGlGetObjectParameteriv(Program, 425 Driver->extGlGetObjectParameteriv(Program,
426 GL_OBJECT_INFO_LOG_LENGTH_ARB, &maxLength); 426 GL_OBJECT_INFO_LOG_LENGTH_ARB, &maxLength);
427#endif 427#endif
428 if (maxLength) 428 if (maxLength)
429 { 429 {
430 GLcharARB *infoLog = new GLcharARB[maxLength]; 430 GLcharARB *infoLog = new GLcharARB[maxLength];
431 Driver->extGlGetInfoLog(Program, maxLength, &length, infoLog); 431 Driver->extGlGetInfoLog(Program, maxLength, &length, infoLog);
432 os::Printer::log(reinterpret_cast<const c8*>(infoLog), ELL_ERROR); 432 os::Printer::log(reinterpret_cast<const c8*>(infoLog), ELL_ERROR);
433 delete [] infoLog; 433 delete [] infoLog;
434 } 434 }
435 435
436 return false; 436 return false;
437 } 437 }
438 438
439 // get uniforms information 439 // get uniforms information
440 440
441 GLint num = 0; 441 GLint num = 0;
442 #ifdef GL_ARB_shader_objects 442 #ifdef GL_ARB_shader_objects
443 Driver->extGlGetObjectParameteriv(Program, GL_OBJECT_ACTIVE_UNIFORMS_ARB, &num); 443 Driver->extGlGetObjectParameteriv(Program, GL_OBJECT_ACTIVE_UNIFORMS_ARB, &num);
444 #endif 444 #endif
445 445
446 if (num == 0) 446 if (num == 0)
447 { 447 {
448 // no uniforms 448 // no uniforms
449 return true; 449 return true;
450 } 450 }
451 451
452 GLint maxlen = 0; 452 GLint maxlen = 0;
453 #ifdef GL_ARB_shader_objects 453 #ifdef GL_ARB_shader_objects
454 Driver->extGlGetObjectParameteriv(Program, GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB, &maxlen); 454 Driver->extGlGetObjectParameteriv(Program, GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB, &maxlen);
455 #endif 455 #endif
456 456
457 if (maxlen == 0) 457 if (maxlen == 0)
458 { 458 {
459 os::Printer::log("GLSL: failed to retrieve uniform information", ELL_ERROR); 459 os::Printer::log("GLSL: failed to retrieve uniform information", ELL_ERROR);
460 return false; 460 return false;
461 } 461 }
462 462
463 // seems that some implementations use an extra null terminator 463 // seems that some implementations use an extra null terminator
464 ++maxlen; 464 ++maxlen;
465 c8 *buf = new c8[maxlen]; 465 c8 *buf = new c8[maxlen];
466 466
467 UniformInfo.clear(); 467 UniformInfo.clear();
468 UniformInfo.reallocate(num); 468 UniformInfo.reallocate(num);
469 469
470 for (int i=0; i < num; ++i) 470 for (int i=0; i < num; ++i)
471 { 471 {
472 SUniformInfo ui; 472 SUniformInfo ui;
473 memset(buf, 0, maxlen); 473 memset(buf, 0, maxlen);
474 474
475 GLint size; 475 GLint size;
476 Driver->extGlGetActiveUniformARB(Program, i, maxlen, 0, &size, &ui.type, reinterpret_cast<GLcharARB*>(buf)); 476 Driver->extGlGetActiveUniformARB(Program, i, maxlen, 0, &size, &ui.type, reinterpret_cast<GLcharARB*>(buf));
477 ui.name = buf; 477 ui.name = buf;
478 478
479 UniformInfo.push_back(ui); 479 UniformInfo.push_back(ui);
480 } 480 }
481 481
482 delete [] buf; 482 delete [] buf;
483 } 483 }
484 484
485 return true; 485 return true;
486} 486}
487 487
488 488
489void COpenGLSLMaterialRenderer::setBasicRenderStates(const SMaterial& material, 489void COpenGLSLMaterialRenderer::setBasicRenderStates(const SMaterial& material,
490 const SMaterial& lastMaterial, 490 const SMaterial& lastMaterial,
491 bool resetAllRenderstates) 491 bool resetAllRenderstates)
492{ 492{
493 // forward 493 // forward
494 Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates); 494 Driver->setBasicRenderStates(material, lastMaterial, resetAllRenderstates);
495} 495}
496 496
497 497
498bool COpenGLSLMaterialRenderer::setVertexShaderConstant(const c8* name, const f32* floats, int count) 498bool COpenGLSLMaterialRenderer::setVertexShaderConstant(const c8* name, const f32* floats, int count)
499{ 499{
500 return setPixelShaderConstant(name, floats, count); 500 return setPixelShaderConstant(name, floats, count);
501} 501}
502 502
503bool COpenGLSLMaterialRenderer::setVertexShaderConstant(const c8* name, const bool* bools, int count) 503bool COpenGLSLMaterialRenderer::setVertexShaderConstant(const c8* name, const bool* bools, int count)
504{ 504{
505 return setPixelShaderConstant(name, bools, count); 505 return setPixelShaderConstant(name, bools, count);
506} 506}
507 507
508bool COpenGLSLMaterialRenderer::setVertexShaderConstant(const c8* name, const s32* ints, int count) 508bool COpenGLSLMaterialRenderer::setVertexShaderConstant(const c8* name, const s32* ints, int count)
509{ 509{
510 return setPixelShaderConstant(name, ints, count); 510 return setPixelShaderConstant(name, ints, count);
511} 511}
512 512
513void COpenGLSLMaterialRenderer::setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount) 513void COpenGLSLMaterialRenderer::setVertexShaderConstant(const f32* data, s32 startRegister, s32 constantAmount)
514{ 514{
515 os::Printer::log("Cannot set constant, please use high level shader call instead.", ELL_WARNING); 515 os::Printer::log("Cannot set constant, please use high level shader call instead.", ELL_WARNING);
516} 516}
517 517
518bool COpenGLSLMaterialRenderer::setPixelShaderConstant(const c8* name, const f32* floats, int count) 518bool COpenGLSLMaterialRenderer::setPixelShaderConstant(const c8* name, const f32* floats, int count)
519{ 519{
520 u32 i; 520 u32 i;
521 const u32 num = UniformInfo.size(); 521 const u32 num = UniformInfo.size();
522 522
523 for (i=0; i < num; ++i) 523 for (i=0; i < num; ++i)
524 { 524 {
525 if (UniformInfo[i].name == name) 525 if (UniformInfo[i].name == name)
526 break; 526 break;
527 } 527 }
528 528
529 if (i == num) 529 if (i == num)
530 return false; 530 return false;
531 531
532#if defined(GL_VERSION_2_0)||defined(GL_ARB_shader_objects) 532#if defined(GL_VERSION_2_0)||defined(GL_ARB_shader_objects)
533 GLint Location=0; 533 GLint Location=0;
534 if (Program2) 534 if (Program2)
535 Location=Driver->extGlGetUniformLocation(Program2,name); 535 Location=Driver->extGlGetUniformLocation(Program2,name);
536 else 536 else
537 Location=Driver->extGlGetUniformLocationARB(Program,name); 537 Location=Driver->extGlGetUniformLocationARB(Program,name);
538 538
539 bool status = true; 539 bool status = true;
540 540
541 switch (UniformInfo[i].type) 541 switch (UniformInfo[i].type)
542 { 542 {
543 case GL_FLOAT: 543 case GL_FLOAT:
544 Driver->extGlUniform1fv(Location, count, floats); 544 Driver->extGlUniform1fv(Location, count, floats);
545 break; 545 break;
546 case GL_FLOAT_VEC2: 546 case GL_FLOAT_VEC2:
547 Driver->extGlUniform2fv(Location, count/2, floats); 547 Driver->extGlUniform2fv(Location, count/2, floats);
548 break; 548 break;
549 case GL_FLOAT_VEC3: 549 case GL_FLOAT_VEC3:
550 Driver->extGlUniform3fv(Location, count/3, floats); 550 Driver->extGlUniform3fv(Location, count/3, floats);
551 break; 551 break;
552 case GL_FLOAT_VEC4: 552 case GL_FLOAT_VEC4:
553 Driver->extGlUniform4fv(Location, count/4, floats); 553 Driver->extGlUniform4fv(Location, count/4, floats);
554 break; 554 break;
555 case GL_FLOAT_MAT2: 555 case GL_FLOAT_MAT2:
556 Driver->extGlUniformMatrix2fv(Location, count/4, false, floats); 556 Driver->extGlUniformMatrix2fv(Location, count/4, false, floats);
557 break; 557 break;
558 case GL_FLOAT_MAT3: 558 case GL_FLOAT_MAT3:
559 Driver->extGlUniformMatrix3fv(Location, count/9, false, floats); 559 Driver->extGlUniformMatrix3fv(Location, count/9, false, floats);
560 break; 560 break;
561 case GL_FLOAT_MAT4: 561 case GL_FLOAT_MAT4:
562 Driver->extGlUniformMatrix4fv(Location, count/16, false, floats); 562 Driver->extGlUniformMatrix4fv(Location, count/16, false, floats);
563 break; 563 break;
564 case GL_SAMPLER_1D: 564 case GL_SAMPLER_1D:
565 case GL_SAMPLER_2D: 565 case GL_SAMPLER_2D:
566 case GL_SAMPLER_3D: 566 case GL_SAMPLER_3D:
567 case GL_SAMPLER_CUBE: 567 case GL_SAMPLER_CUBE:
568 case GL_SAMPLER_1D_SHADOW: 568 case GL_SAMPLER_1D_SHADOW:
569 case GL_SAMPLER_2D_SHADOW: 569 case GL_SAMPLER_2D_SHADOW:
570 { 570 {
571 const GLint id = static_cast<GLint>(*floats); 571 const GLint id = static_cast<GLint>(*floats);
572 Driver->extGlUniform1iv(Location, 1, &id); 572 Driver->extGlUniform1iv(Location, 1, &id);
573 } 573 }
574 break; 574 break;
575 default: 575 default:
576 status = false; 576 status = false;
577 break; 577 break;
578 } 578 }
579 return status; 579 return status;
580#else 580#else
581 return false; 581 return false;
582#endif 582#endif
583} 583}
584 584
585bool COpenGLSLMaterialRenderer::setPixelShaderConstant(const c8* name, const bool* bools, int count) 585bool COpenGLSLMaterialRenderer::setPixelShaderConstant(const c8* name, const bool* bools, int count)
586{ 586{
587 u32 i; 587 u32 i;
588 const u32 num = UniformInfo.size(); 588 const u32 num = UniformInfo.size();
589 589
590 for (i=0; i < num; ++i) 590 for (i=0; i < num; ++i)
591 { 591 {
592 if (UniformInfo[i].name == name) 592 if (UniformInfo[i].name == name)
593 break; 593 break;
594 } 594 }
595 595
596 if (i == num) 596 if (i == num)
597 return false; 597 return false;
598 598
599#if defined(GL_VERSION_2_0)||defined(GL_ARB_shader_objects) 599#if defined(GL_VERSION_2_0)||defined(GL_ARB_shader_objects)
600 GLint Location=0; 600 GLint Location=0;
601 if (Program2) 601 if (Program2)
602 Location=Driver->extGlGetUniformLocation(Program2,name); 602 Location=Driver->extGlGetUniformLocation(Program2,name);
603 else 603 else
604 Location=Driver->extGlGetUniformLocationARB(Program,name); 604 Location=Driver->extGlGetUniformLocationARB(Program,name);
605 605
606 bool status = true; 606 bool status = true;
607 607
608 switch (UniformInfo[i].type) 608 switch (UniformInfo[i].type)
609 { 609 {
610 case GL_BOOL: 610 case GL_BOOL:
611 Driver->extGlUniform1iv(Location, count, (GLint*)bools); 611 Driver->extGlUniform1iv(Location, count, (GLint*)bools);
612 break; 612 break;
613 case GL_BOOL_VEC2: 613 case GL_BOOL_VEC2:
614 Driver->extGlUniform2iv(Location, count/2, (GLint*)bools); 614 Driver->extGlUniform2iv(Location, count/2, (GLint*)bools);
615 break; 615 break;
616 case GL_BOOL_VEC3: 616 case GL_BOOL_VEC3:
617 Driver->extGlUniform3iv(Location, count/3, (GLint*)bools); 617 Driver->extGlUniform3iv(Location, count/3, (GLint*)bools);
618 break; 618 break;
619 case GL_BOOL_VEC4: 619 case GL_BOOL_VEC4:
620 Driver->extGlUniform4iv(Location, count/4, (GLint*)bools); 620 Driver->extGlUniform4iv(Location, count/4, (GLint*)bools);
621 break; 621 break;
622 default: 622 default:
623 status = false; 623 status = false;
624 break; 624 break;
625 } 625 }
626 return status; 626 return status;
627#else 627#else
628 return false; 628 return false;
629#endif 629#endif
630} 630}
631 631
632bool COpenGLSLMaterialRenderer::setPixelShaderConstant(const c8* name, const s32* ints, int count) 632bool COpenGLSLMaterialRenderer::setPixelShaderConstant(const c8* name, const s32* ints, int count)
633{ 633{
634 u32 i; 634 u32 i;
635 const u32 num = UniformInfo.size(); 635 const u32 num = UniformInfo.size();
636 636
637 for (i=0; i < num; ++i) 637 for (i=0; i < num; ++i)
638 { 638 {
639 if (UniformInfo[i].name == name) 639 if (UniformInfo[i].name == name)
640 break; 640 break;
641 } 641 }
642 642
643 if (i == num) 643 if (i == num)
644 return false; 644 return false;
645 645
646#if defined(GL_VERSION_2_0)||defined(GL_ARB_shader_objects) 646#if defined(GL_VERSION_2_0)||defined(GL_ARB_shader_objects)
647 GLint Location=0; 647 GLint Location=0;
648 if (Program2) 648 if (Program2)
649 Location=Driver->extGlGetUniformLocation(Program2,name); 649 Location=Driver->extGlGetUniformLocation(Program2,name);
650 else 650 else
651 Location=Driver->extGlGetUniformLocationARB(Program,name); 651 Location=Driver->extGlGetUniformLocationARB(Program,name);
652 652
653 bool status = true; 653 bool status = true;
654 654
655 switch (UniformInfo[i].type) 655 switch (UniformInfo[i].type)
656 { 656 {
657 case GL_INT: 657 case GL_INT:
658 Driver->extGlUniform1iv(Location, count, ints); 658 Driver->extGlUniform1iv(Location, count, ints);
659 break; 659 break;
660 case GL_INT_VEC2: 660 case GL_INT_VEC2:
661 Driver->extGlUniform2iv(Location, count/2, ints); 661 Driver->extGlUniform2iv(Location, count/2, ints);
662 break; 662 break;
663 case GL_INT_VEC3: 663 case GL_INT_VEC3:
664 Driver->extGlUniform3iv(Location, count/3, ints); 664 Driver->extGlUniform3iv(Location, count/3, ints);
665 break; 665 break;
666 case GL_INT_VEC4: 666 case GL_INT_VEC4:
667 Driver->extGlUniform4iv(Location, count/4, ints); 667 Driver->extGlUniform4iv(Location, count/4, ints);
668 break; 668 break;
669 case GL_SAMPLER_1D: 669 case GL_SAMPLER_1D:
670 case GL_SAMPLER_2D: 670 case GL_SAMPLER_2D:
671 case GL_SAMPLER_3D: 671 case GL_SAMPLER_3D:
672 case GL_SAMPLER_CUBE: 672 case GL_SAMPLER_CUBE:
673 case GL_SAMPLER_1D_SHADOW: 673 case GL_SAMPLER_1D_SHADOW:
674 case GL_SAMPLER_2D_SHADOW: 674 case GL_SAMPLER_2D_SHADOW:
675 Driver->extGlUniform1iv(Location, 1, ints); 675 Driver->extGlUniform1iv(Location, 1, ints);
676 break; 676 break;
677 default: 677 default:
678 status = false; 678 status = false;
679 break; 679 break;
680 } 680 }
681 return status; 681 return status;
682#else 682#else
683 return false; 683 return false;
684#endif 684#endif
685} 685}
686 686
687void COpenGLSLMaterialRenderer::setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount) 687void COpenGLSLMaterialRenderer::setPixelShaderConstant(const f32* data, s32 startRegister, s32 constantAmount)
688{ 688{
689 os::Printer::log("Cannot set constant, use high level shader call.", ELL_WARNING); 689 os::Printer::log("Cannot set constant, use high level shader call.", ELL_WARNING);
690} 690}
691 691
692IVideoDriver* COpenGLSLMaterialRenderer::getVideoDriver() 692IVideoDriver* COpenGLSLMaterialRenderer::getVideoDriver()
693{ 693{
694 return Driver; 694 return Driver;
695} 695}
696 696
697} // end namespace video 697} // end namespace video
698} // end namespace irr 698} // end namespace irr
699 699
700 700
701#endif 701#endif
702 702