diff options
author | Erwin Coumans <blender@erwincoumans.com> | 2006-01-11 16:31:45 +0300 |
---|---|---|
committer | Erwin Coumans <blender@erwincoumans.com> | 2006-01-11 16:31:45 +0300 |
commit | fbc977e48ca210cd232971bc766ae8f23110de68 (patch) | |
tree | e0d2578146b8422b82a5aa42f94becbcc8287ffa /source/gameengine/Ketsji | |
parent | 8c205be66fc9b1a077f1eb65ab5d68c4b43d3a95 (diff) |
attempt to avoid nameclashes (although it is already in a namespace) -> extension names renamed from glXXX to blXXX.
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r-- | source/gameengine/Ketsji/BL_Shader.cpp | 166 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_BlenderMaterial.cpp | 26 |
2 files changed, 96 insertions, 96 deletions
diff --git a/source/gameengine/Ketsji/BL_Shader.cpp b/source/gameengine/Ketsji/BL_Shader.cpp index 7e0b6df3a3a..369fc58fc50 100644 --- a/source/gameengine/Ketsji/BL_Shader.cpp +++ b/source/gameengine/Ketsji/BL_Shader.cpp @@ -67,15 +67,15 @@ BL_Shader::~BL_Shader() { #ifdef GL_ARB_shader_objects if( mShader ) { - glDeleteObjectARB(mShader); + bgl::blDeleteObjectARB(mShader); mShader = 0; } if( mFrag ) { - glDeleteObjectARB(mFrag); + bgl::blDeleteObjectARB(mFrag); mFrag = 0; } if( mVert ) { - glDeleteObjectARB(mVert); + bgl::blDeleteObjectARB(mVert); mVert = 0; } @@ -83,7 +83,7 @@ BL_Shader::~BL_Shader() fragProg = 0; mOk = 0; - glUseProgramObjectARB(0); + bgl::blUseProgramObjectARB(0); #endif//GL_ARB_shader_objects } @@ -101,56 +101,56 @@ bool BL_Shader::LinkProgram() } // create our objects - unsigned int tmpVert = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB); - unsigned int tmpFrag = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB); - unsigned int tmpProg = glCreateProgramObjectARB(); + unsigned int tmpVert = bgl::blCreateShaderObjectARB(GL_VERTEX_SHADER_ARB); + unsigned int tmpFrag = bgl::blCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB); + unsigned int tmpProg = bgl::blCreateProgramObjectARB(); if(!tmpVert || !tmpFrag || !tmpProg){ - glDeleteObjectARB(tmpVert); - glDeleteObjectARB(tmpFrag); - glDeleteObjectARB(tmpProg); + bgl::blDeleteObjectARB(tmpVert); + bgl::blDeleteObjectARB(tmpFrag); + bgl::blDeleteObjectARB(tmpProg); return false; } // set/compile vertex shader - glShaderSourceARB(tmpVert, 1, (const char**)&vertProg, 0); - glCompileShaderARB(tmpVert); - glGetObjectParameterivARB(tmpVert, GL_OBJECT_INFO_LOG_LENGTH_ARB, &vertlen); + bgl::blShaderSourceARB(tmpVert, 1, (const char**)&vertProg, 0); + bgl::blCompileShaderARB(tmpVert); + bgl::blGetObjectParameterivARB(tmpVert, GL_OBJECT_INFO_LOG_LENGTH_ARB, &vertlen); if( vertlen > 0 && !PrintInfo(vertlen,tmpVert, "Vertex Shader") ){ spit("Vertex shader failed"); - glDeleteObjectARB(tmpVert); - glDeleteObjectARB(tmpFrag); - glDeleteObjectARB(tmpProg); + bgl::blDeleteObjectARB(tmpVert); + bgl::blDeleteObjectARB(tmpFrag); + bgl::blDeleteObjectARB(tmpProg); mOk = 0; return false; } // set/compile fragment shader - glShaderSourceARB(tmpFrag, 1,(const char**)&fragProg, 0); - glCompileShaderARB(tmpFrag); - glGetObjectParameterivARB(tmpFrag, GL_OBJECT_INFO_LOG_LENGTH_ARB, &fraglen); + bgl::blShaderSourceARB(tmpFrag, 1,(const char**)&fragProg, 0); + bgl::blCompileShaderARB(tmpFrag); + bgl::blGetObjectParameterivARB(tmpFrag, GL_OBJECT_INFO_LOG_LENGTH_ARB, &fraglen); if(fraglen >0 && !PrintInfo(fraglen,tmpFrag, "Fragment Shader") ){ spit("Fragment shader failed"); - glDeleteObjectARB(tmpVert); - glDeleteObjectARB(tmpFrag); - glDeleteObjectARB(tmpProg); + bgl::blDeleteObjectARB(tmpVert); + bgl::blDeleteObjectARB(tmpFrag); + bgl::blDeleteObjectARB(tmpProg); mOk = 0; return false; } // set compiled vert/frag shader & link - glAttachObjectARB(tmpProg, tmpVert); - glAttachObjectARB(tmpProg, tmpFrag); - glLinkProgramARB(tmpProg); + bgl::blAttachObjectARB(tmpProg, tmpVert); + bgl::blAttachObjectARB(tmpProg, tmpFrag); + bgl::blLinkProgramARB(tmpProg); - glGetObjectParameterivARB(tmpProg, GL_OBJECT_INFO_LOG_LENGTH_ARB, &proglen); + bgl::blGetObjectParameterivARB(tmpProg, GL_OBJECT_INFO_LOG_LENGTH_ARB, &proglen); if(proglen > 0){ PrintInfo(proglen,tmpProg, "GLSL Shader"); } else{ spit("Program failed"); - glDeleteObjectARB(tmpVert); - glDeleteObjectARB(tmpFrag); - glDeleteObjectARB(tmpProg); + bgl::blDeleteObjectARB(tmpVert); + bgl::blDeleteObjectARB(tmpFrag); + bgl::blDeleteObjectARB(tmpProg); mOk = 0; return false; } @@ -175,7 +175,7 @@ bool BL_Shader::PrintInfo(int len, unsigned int handle, const char *type) spit("BL_Shader::PrintInfo() MEM_mallocN failed"); return false; } - glGetInfoLogARB(handle, len, &numchars, log); + bgl::blGetInfoLogARB(handle, len, &numchars, log); if(numchars >0){ spit(type); @@ -332,14 +332,14 @@ KX_PYMETHODDEF_DOC( BL_Shader, setSource," setSource(vertexProgram, fragmentProg vertProg = v; fragProg = f; if( LinkProgram() ) { - glUseProgramObjectARB( mShader ); + bgl::blUseProgramObjectARB( mShader ); mUse = apply!=0; Py_Return; } vertProg = 0; fragProg = 0; mUse = 0; - glUseProgramObjectARB( 0 ); + bgl::blUseProgramObjectARB( 0 ); PyErr_Format(PyExc_ValueError, "GLSL Error"); } return NULL; @@ -352,9 +352,9 @@ KX_PYMETHODDEF_DOC( BL_Shader, setSource," setSource(vertexProgram, fragmentProg KX_PYMETHODDEF_DOC( BL_Shader, delSource, "delSource( )" ) { #ifdef GL_ARB_shader_objects - glDeleteObjectARB(mShader); - glDeleteObjectARB(mFrag); - glDeleteObjectARB(mVert); + bgl::blDeleteObjectARB(mShader); + bgl::blDeleteObjectARB(mFrag); + bgl::blDeleteObjectARB(mVert); mShader = 0; mFrag = 0; mVert = 0; @@ -362,7 +362,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, delSource, "delSource( )" ) fragProg = 0; mOk = 0; mUse = 0; - glUseProgramObjectARB(0); + bgl::blUseProgramObjectARB(0); #endif Py_Return; @@ -395,8 +395,8 @@ KX_PYMETHODDEF_DOC( BL_Shader, validate, "validate()") } int stat = 0; - glValidateProgramARB(mShader); - glGetObjectParameterivARB(mShader, GL_OBJECT_VALIDATE_STATUS_ARB, &stat); + bgl::blValidateProgramARB(mShader); + bgl::blGetObjectParameterivARB(mShader, GL_OBJECT_VALIDATE_STATUS_ARB, &stat); return PyInt_FromLong((stat!=0)); #else @@ -417,7 +417,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setSampler, "setSampler(name, index)" ) PyErr_Format(PyExc_ValueError, "invalid shader object"); return NULL; } - int loc= glGetUniformLocationARB(mShader, uniform); + int loc= bgl::blGetUniformLocationARB(mShader, uniform); if( loc==-1 ) { spit("Invalid uniform value: " << uniform << "."); @@ -463,15 +463,15 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform1f, "setUniform1f(name, fx)" ) PyErr_Format(PyExc_ValueError, "invalid shader object"); return NULL; } - int loc= glGetUniformLocationARB(mShader, uniform); + int loc= bgl::blGetUniformLocationARB(mShader, uniform); if( loc==-1 ) { spit("Invalid uniform value: " << uniform << "."); Py_Return; }else { - glUseProgramObjectARB( mShader ); - glUniform1fARB( loc, value ); + bgl::blUseProgramObjectARB( mShader ); + bgl::blUniform1fARB( loc, value ); Py_Return; } @@ -495,15 +495,15 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform2f , "setUniform2f(name, fx, fy)") PyErr_Format(PyExc_ValueError, "invalid shader object"); return NULL; } - int loc= glGetUniformLocationARB(mShader , uniform); + int loc= bgl::blGetUniformLocationARB(mShader , uniform); if( loc==-1 ) { spit("Invalid uniform value: " << uniform << "."); Py_Return; }else { - glUseProgramObjectARB( mShader ); - glUniform2fARB(loc, array[0],array[1] ); + bgl::blUseProgramObjectARB( mShader ); + bgl::blUniform2fARB(loc, array[0],array[1] ); Py_Return; } @@ -527,15 +527,15 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform3f, "setUniform3f(name, fx,fy,fz) ") PyErr_Format(PyExc_ValueError, "invalid shader object"); return NULL; } - int loc= glGetUniformLocationARB(mShader , uniform); + int loc= bgl::blGetUniformLocationARB(mShader , uniform); if( loc==-1 ) { spit("Invalid uniform value: " << uniform << "."); Py_Return; }else { - glUseProgramObjectARB(mShader); - glUniform3fARB(loc, array[0],array[1],array[2]); + bgl::blUseProgramObjectARB(mShader); + bgl::blUniform3fARB(loc, array[0],array[1],array[2]); Py_Return; } @@ -559,15 +559,15 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform4f, "setUniform4f(name, fx,fy,fz, fw) " PyErr_Format(PyExc_ValueError, "invalid shader object"); return NULL; } - int loc= glGetUniformLocationARB(mShader , uniform); + int loc= bgl::blGetUniformLocationARB(mShader , uniform); if( loc==-1 ) { spit("Invalid uniform value: " << uniform << "."); Py_Return; }else { - glUseProgramObjectARB(mShader); - glUniform4fARB(loc, array[0],array[1],array[2], array[3]); + bgl::blUseProgramObjectARB(mShader); + bgl::blUniform4fARB(loc, array[0],array[1],array[2], array[3]); Py_Return; } } @@ -590,15 +590,15 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform1i, "setUniform1i(name, ix)" ) PyErr_Format(PyExc_ValueError, "invalid shader object"); return NULL; } - int loc= glGetUniformLocationARB(mShader, uniform); + int loc= bgl::blGetUniformLocationARB(mShader, uniform); if( loc==-1 ) { spit("Invalid uniform value: " << uniform << "."); Py_Return; }else { - glUseProgramObjectARB( mShader ); - glUniform1iARB( loc, value ); + bgl::blUseProgramObjectARB( mShader ); + bgl::blUniform1iARB( loc, value ); Py_Return; } } @@ -621,15 +621,15 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform2i , "setUniform2i(name, ix, iy)") PyErr_Format(PyExc_ValueError, "invalid shader object"); return NULL; } - int loc= glGetUniformLocationARB(mShader , uniform); + int loc= bgl::blGetUniformLocationARB(mShader , uniform); if( loc==-1 ) { spit("Invalid uniform value: " << uniform << "."); Py_Return; }else { - glUseProgramObjectARB( mShader ); - glUniform2iARB(loc, array[0],array[1] ); + bgl::blUseProgramObjectARB( mShader ); + bgl::blUniform2iARB(loc, array[0],array[1] ); Py_Return; } } @@ -652,15 +652,15 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform3i, "setUniform3i(name, ix,iy,iz) ") PyErr_Format(PyExc_ValueError, "invalid shader object"); return NULL; } - int loc= glGetUniformLocationARB(mShader , uniform); + int loc= bgl::blGetUniformLocationARB(mShader , uniform); if( loc==-1 ) { spit("Invalid uniform value: " << uniform << "."); Py_Return; }else { - glUseProgramObjectARB(mShader); - glUniform3iARB(loc, array[0],array[1],array[2]); + bgl::blUseProgramObjectARB(mShader); + bgl::blUniform3iARB(loc, array[0],array[1],array[2]); Py_Return; } } @@ -682,15 +682,15 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform4i, "setUniform4i(name, ix,iy,iz, iw) " PyErr_Format(PyExc_ValueError, "invalid shader object"); return NULL; } - int loc= glGetUniformLocationARB(mShader , uniform); + int loc= bgl::blGetUniformLocationARB(mShader , uniform); if( loc==-1 ) { spit("Invalid uniform value: " << uniform << "."); Py_Return; }else { - glUseProgramObjectARB(mShader); - glUniform4iARB(loc, array[0],array[1],array[2], array[3]); + bgl::blUseProgramObjectARB(mShader); + bgl::blUniform4iARB(loc, array[0],array[1],array[2], array[3]); Py_Return; } } @@ -714,7 +714,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformfv , "setUniformfv( float (list2 or lis PyErr_Format(PyExc_ValueError, "invalid shader object"); return NULL; } - int loc= glGetUniformLocationARB(mShader , uniform); + int loc= bgl::blGetUniformLocationARB(mShader , uniform); if( loc==-1 ) { spit("Invalid uniform value: " << uniform << "."); @@ -735,20 +735,20 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformfv , "setUniformfv( float (list2 or lis { case 2: { - glUseProgramObjectARB(mShader); - glUniform2fARB(loc, array_data[0],array_data[1]); + bgl::blUseProgramObjectARB(mShader); + bgl::blUniform2fARB(loc, array_data[0],array_data[1]); Py_Return; } break; case 3: { - glUseProgramObjectARB(mShader); - glUniform3fARB(loc, array_data[0],array_data[1], array_data[2]); + bgl::blUseProgramObjectARB(mShader); + bgl::blUniform3fARB(loc, array_data[0],array_data[1], array_data[2]); Py_Return; }break; case 4: { - glUseProgramObjectARB(mShader); - glUniform4fARB(loc, array_data[0],array_data[1], array_data[2], array_data[3]); + bgl::blUseProgramObjectARB(mShader); + bgl::blUniform4fARB(loc, array_data[0],array_data[1], array_data[2], array_data[3]); Py_Return; }break; default: @@ -781,7 +781,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformiv, "setUniformiv( int (list2 or list3 PyErr_Format(PyExc_ValueError, "invalid shader object"); return NULL; } - int loc= glGetUniformLocationARB(mShader , uniform); + int loc= bgl::blGetUniformLocationARB(mShader , uniform); if( loc==-1 ) { spit("Invalid uniform value: " << uniform << "."); @@ -802,20 +802,20 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformiv, "setUniformiv( int (list2 or list3 { case 2: { - glUseProgramObjectARB(mShader); - glUniform2iARB(loc, array_data[0],array_data[1]); + bgl::blUseProgramObjectARB(mShader); + bgl::blUniform2iARB(loc, array_data[0],array_data[1]); Py_Return; } break; case 3: { - glUseProgramObjectARB(mShader); - glUniform3iARB(loc, array_data[0],array_data[1], array_data[2]); + bgl::blUseProgramObjectARB(mShader); + bgl::blUniform3iARB(loc, array_data[0],array_data[1], array_data[2]); Py_Return; }break; case 4: { - glUseProgramObjectARB(mShader); - glUniform4iARB(loc, array_data[0],array_data[1], array_data[2], array_data[3]); + bgl::blUseProgramObjectARB(mShader); + bgl::blUniform4iARB(loc, array_data[0],array_data[1], array_data[2], array_data[3]); Py_Return; }break; default: @@ -855,7 +855,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix4, PyErr_Format(PyExc_ValueError, "invalid shader object"); return NULL; } - int loc= glGetUniformLocationARB(mShader , uniform); + int loc= bgl::blGetUniformLocationARB(mShader , uniform); if( loc==-1 ) { spit("Invalid uniform value: " << uniform << "."); @@ -868,8 +868,8 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix4, if (PyMatTo(matrix, mat)) { mat.getValue(matr); - glUseProgramObjectARB(mShader); - glUniformMatrix4fvARB(loc, 1, (transp!=0)?GL_TRUE:GL_FALSE, matr); + bgl::blUseProgramObjectARB(mShader); + bgl::blUniformMatrix4fvARB(loc, 1, (transp!=0)?GL_TRUE:GL_FALSE, matr); Py_Return; } } @@ -902,7 +902,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix3, PyErr_Format(PyExc_ValueError, "invalid shader object"); return NULL; } - int loc= glGetUniformLocationARB(mShader , uniform); + int loc= bgl::blGetUniformLocationARB(mShader , uniform); if( loc==-1 ) { spit("Invalid uniform value: " << uniform << "."); @@ -915,8 +915,8 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix3, if (PyMatTo(matrix, mat)) { mat.getValue(matr); - glUseProgramObjectARB(mShader); - glUniformMatrix3fvARB(loc, 1, (transp!=0)?GL_TRUE:GL_FALSE, matr); + bgl::blUseProgramObjectARB(mShader); + bgl::blUniformMatrix3fvARB(loc, 1, (transp!=0)?GL_TRUE:GL_FALSE, matr); Py_Return; } } diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp index ebf040d3c5d..5a41328f489 100644 --- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp +++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp @@ -139,7 +139,7 @@ void KX_BlenderMaterial::OnConstruction() int i; for(i=0; i<mMaterial->num_enabled; i++) { - glActiveTextureARB(GL_TEXTURE0_ARB+i); + bgl::blActiveTextureARB(GL_TEXTURE0_ARB+i); #ifdef GL_ARB_texture_cube_map if( mMaterial->mapping[i].mapping & USEENV ) { if(!RAS_EXT_support._ARB_texture_cube_map) { @@ -180,14 +180,14 @@ void KX_BlenderMaterial::OnExit() if( RAS_EXT_support._ARB_shader_objects && mShader ) { //note, the shader here is allocated, per unique material //and this function is called per face - glUseProgramObjectARB(0); + bgl::blUseProgramObjectARB(0); delete mShader; mShader = 0; } #endif //GL_ARB_shader_objects for(int i=0; i<mMaterial->num_enabled; i++) { - glActiveTextureARB(GL_TEXTURE0_ARB+i); + bgl::blActiveTextureARB(GL_TEXTURE0_ARB+i); mTextures[i].DeleteTex(); @@ -213,7 +213,7 @@ void KX_BlenderMaterial::OnExit() gTextureDict = 0; }*/ - glActiveTextureARB(GL_TEXTURE0_ARB); + bgl::blActiveTextureARB(GL_TEXTURE0_ARB); #ifdef GL_ARB_texture_cube_map if(RAS_EXT_support._ARB_texture_cube_map) @@ -238,7 +238,7 @@ void KX_BlenderMaterial::DisableTexData() #ifdef GL_ARB_multitexture int i=(MAXTEX>=bgl::max_texture_units?bgl::max_texture_units:MAXTEX)-1; for(; i>=0; i--) { - glActiveTextureARB(GL_TEXTURE0_ARB+i); + bgl::blActiveTextureARB(GL_TEXTURE0_ARB+i); glMatrixMode(GL_TEXTURE); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); @@ -268,13 +268,13 @@ void KX_BlenderMaterial::setShaderData( bool enable ) int i; if( !enable || !mShader->Ok() ) { // frame cleanup. - glUseProgramObjectARB( 0 ); + bgl::blUseProgramObjectARB( 0 ); DisableTexData(); return; } DisableTexData(); - glUseProgramObjectARB( mShader->GetProg() ); + bgl::blUseProgramObjectARB( mShader->GetProg() ); // for each enabled unit for(i=0; i<mMaterial->num_enabled; i++) { @@ -282,7 +282,7 @@ void KX_BlenderMaterial::setShaderData( bool enable ) const uSampler *samp = mShader->getSampler(i); if( samp->loc == -1 || samp->glTexture == 0 ) continue; - glActiveTextureARB(GL_TEXTURE0_ARB+i); + bgl::blActiveTextureARB(GL_TEXTURE0_ARB+i); #ifdef GL_ARB_texture_cube_map if( mMaterial->mapping[i].mapping &USEENV ) { @@ -297,7 +297,7 @@ void KX_BlenderMaterial::setShaderData( bool enable ) } #endif//GL_ARB_texture_cube_map // use a sampler - glUniform1iARB(samp->loc, i ); + bgl::blUniform1iARB(samp->loc, i ); } glDisable(GL_BLEND); @@ -314,7 +314,7 @@ void KX_BlenderMaterial::setTexData( bool enable ) #ifdef GL_ARB_shader_objects if(RAS_EXT_support._ARB_shader_objects) { // switch back to fixed func - glUseProgramObjectARB( 0 ); + bgl::blUseProgramObjectARB( 0 ); } #endif//GL_ARB_shader_objects @@ -336,7 +336,7 @@ void KX_BlenderMaterial::setTexData( bool enable ) // no material connected to the object if( mTextures[0] ) { if( !mTextures[0].Ok() ) return; - glActiveTextureARB(GL_TEXTURE0_ARB); + bgl::blActiveTextureARB(GL_TEXTURE0_ARB); glBindTexture( GL_TEXTURE_2D, mTextures[0] ); glEnable(GL_TEXTURE_2D); setTextureEnvironment( -1 ); // modulate @@ -352,7 +352,7 @@ void KX_BlenderMaterial::setTexData( bool enable ) for(i=0; (i<mMaterial->num_enabled); i++) { if( !mTextures[i].Ok() ) continue; - glActiveTextureARB(GL_TEXTURE0_ARB+i); + bgl::blActiveTextureARB(GL_TEXTURE0_ARB+i); #ifdef GL_ARB_texture_cube_map // use environment maps @@ -548,7 +548,7 @@ KX_BlenderMaterial::Activate( return dopass; } else { - glUseProgramObjectARB( 0 ); + bgl::blUseProgramObjectARB( 0 ); mPass = 0; dopass = false; return dopass; |