void RasterizerOpenGL::SyncTevSources(unsigned stage_index, const Pica::Regs::TevStageConfig& config) { GLint color_srcs[3] = { (GLint)config.color_source1.Value(), (GLint)config.color_source2.Value(), (GLint)config.color_source3.Value() }; GLint alpha_srcs[3] = { (GLint)config.alpha_source1.Value(), (GLint)config.alpha_source2.Value(), (GLint)config.alpha_source3.Value() }; glUniform3iv(uniform_tev_cfgs[stage_index].color_sources, 1, color_srcs); glUniform3iv(uniform_tev_cfgs[stage_index].alpha_sources, 1, alpha_srcs); }
void RasterizerOpenGL::SyncTevModifiers(unsigned stage_index, const Pica::Regs::TevStageConfig& config) { GLint color_mods[3] = { (GLint)config.color_modifier1.Value(), (GLint)config.color_modifier2.Value(), (GLint)config.color_modifier3.Value() }; GLint alpha_mods[3] = { (GLint)config.alpha_modifier1.Value(), (GLint)config.alpha_modifier2.Value(), (GLint)config.alpha_modifier3.Value() }; glUniform3iv(uniform_tev_cfgs[stage_index].color_modifiers, 1, color_mods); glUniform3iv(uniform_tev_cfgs[stage_index].alpha_modifiers, 1, alpha_mods); }
inline bool CShader::setArray<CVector3i>( const std::string & pName, int count, const CVector3i * v) const { const GLint iP= getParamLocation(pName); if (iP < 0) return false; glUniform3iv(iP, static_cast<const GLint>(count), (const GLint*)(v));CHECK_GLERROR(""); return true; }
/** bind uniform array of int-scalars/vectors */ void FragmentProgram::BindInt(string parameterName, vector<vector<int> > intvectors) { if (intvectors.size() == 0) return; int vectorsize = intvectors.at(0).size(); if (vectorsize < 1 || vectorsize > 4) throw PPEResourceException("GLSL doesn't have a ivecX type, with the supplied X!"); // create a C array of all the intvector-values (to be supplied to OpenGL) GLint* intarray = new GLint[vectorsize * intvectors.size()]; for (unsigned int i=0; i<intvectors.size(); i++) { vector<int> intvector = intvectors.at(i); if (intvector.size() != vectorsize) throw PPEResourceException("all vectors in an array must have the same size!"); for (unsigned int j=0; j<vectorsize; j++) intarray[i*vectorsize + j] = intvector.at(j); } GuardedBind(); // get input parameter handle by name GLint paramID = glGetUniformLocation(programID, parameterName.c_str()); if (paramID == -1) logger.error << "uniform \"" << parameterName << "\" does not exist" << logger.end; // set value of variable (type: float, float2, float3, float4) if (vectorsize==1) glUniform1iv(paramID, intvectors.size(), intarray); // see: http://www.thescripts.com/forum/thread394740.html if (vectorsize==2) glUniform2iv(paramID, intvectors.size(), intarray); // see: http://developer.3dlabs.com/documents/glmanpages/glUniform.htm if (vectorsize==3) glUniform3iv(paramID, intvectors.size(), intarray); if (vectorsize==4) glUniform4iv(paramID, intvectors.size(), intarray); GuardedUnbind(); delete intarray; }
SceneIntersection::SceneIntersection() { gameFBO = CSoundEditor::GetGame()->FBO;; computeShader = Manager::GetShader()->GetShader("SceneIntersection"); if (!computeShader) { return; } sphere_size = computeShader->GetUniformLocation("sphere_size"); plane_direction = computeShader->GetUniformLocation("plane_direction"); computeShader->OnLoad([this]() { sphere_size = computeShader->GetUniformLocation("sphere_size"); plane_direction = computeShader->GetUniformLocation("plane_direction"); auto offset_loc = computeShader->GetUniformLocation("colorID_step"); auto ecodeSize = Manager::GetColor()->GetChannelsEncodeSize(); glUniform3iv(offset_loc, 1, glm::value_ptr(ecodeSize)); }); computeShader->Reload(); sphereRadius = 0; auto rezolution = gameFBO->GetResolution(); visualization = new Texture(); visualization->Create2DTexture((unsigned char*)nullptr, rezolution.x, rezolution.y, 1); Manager::GetTextureDebugger()->SetChannelIndex(3, 1, visualization); ssbo = new SSBO<glm::ivec4>(2048); }
void Uniform3iv( const GLint Location, const GLsizei Count, const GLint* const Value) { glUniform3iv(Location, Count, Value); }
void cogl_program_uniform_int (int uniform_no, int size, int count, const int *value) { _COGL_GET_CONTEXT (ctx, NO_RETVAL); switch (size) { case 1: glUniform1iv (uniform_no, count, value); break; case 2: glUniform2iv (uniform_no, count, value); break; case 3: glUniform3iv (uniform_no, count, value); break; case 4: glUniform4iv (uniform_no, count, value); break; default: g_warning ("%s called with invalid size parameter", G_STRFUNC); } }
void Shader::setUniform3Array(const char* varname, const int* input, const int count) { GLint loc = getLocation(varname, &locations); CHECK_SHADER_VAR(loc,varname); glUniform3iv(loc,count,input); assert (glGetError() == GL_NO_ERROR); }
inline void Program::Uniform(GLint location, GLsizei count, const glm::ivec3 *value) { GL_ASSERT(m_id > 0); GL_ASSERT(location >= 0); glUniform3iv(location, count, glm::value_ptr(*value)); }
void program_object::set_uniform(const_actives_map_iterator it, const GLint* value) { const actives& u = it->second; ASSERT_LOG(value != NULL, "set_uniform(): value is NULL"); switch(u.type) { case GL_INT: case GL_BOOL: case GL_SAMPLER_2D: case GL_SAMPLER_CUBE: glUniform1i(u.location, *value); break; case GL_INT_VEC2: case GL_BOOL_VEC2: glUniform2i(u.location, value[0], value[1]); break; case GL_INT_VEC3: case GL_BOOL_VEC3: glUniform3iv(u.location, u.num_elements, value); break; case GL_INT_VEC4: case GL_BOOL_VEC4: glUniform4iv(u.location, u.num_elements, value); break; default: ASSERT_LOG(false, "Unhandled uniform type: " << it->second.type); } }
void OGLESRenderEngine::Uniform3iv(GLint location, GLsizei count, GLint const * value) { bool dirty = false; KLAYGE_AUTO(iter_p, uniformi_cache_.find(cur_program_)); if (iter_p == uniformi_cache_.end()) { dirty = true; iter_p = uniformi_cache_.insert(std::make_pair(cur_program_, std::map<GLint, int4>())).first; } for (GLsizei i = 0; i < count; ++ i) { KLAYGE_AUTO(iter_v, iter_p->second.find(location + i)); if (iter_v == iter_p->second.end()) { dirty = true; iter_p->second.insert(std::make_pair(location, int4(value[i * 3 + 0], value[i * 3 + 1], value[i * 3 + 2], 0))); } else { if ((iter_v->second.x() != value[i * 3 + 0]) || (iter_v->second.y() != value[i * 3 + 1]) || (iter_v->second.z() != value[i * 3 + 2])) { dirty = true; iter_v->second.x() = value[i * 3 + 0]; iter_v->second.y() = value[i * 3 + 1]; iter_v->second.z() = value[i * 3 + 2]; } } } if (dirty) { glUniform3iv(location, count, value); } }
static bool glsl_set_shader_int_vector(ALLEGRO_SHADER *shader, const char *name, int num_components, int *i, int num_elems) { ALLEGRO_SHADER_GLSL_S *gl_shader = (ALLEGRO_SHADER_GLSL_S *)shader; GLint handle; handle = glGetUniformLocation(gl_shader->program_object, name); if (handle < 0) { ALLEGRO_WARN("No uniform variable '%s' in shader program\n", name); return false; } switch (num_components) { case 1: glUniform1iv(handle, num_elems, i); break; case 2: glUniform2iv(handle, num_elems, i); break; case 3: glUniform3iv(handle, num_elems, i); break; case 4: glUniform4iv(handle, num_elems, i); break; default: ASSERT(false); break; } return check_gl_error(name); }
/** * Sets an uniform vector parameter. * \warning uses glGetError(); * \param name - name of the parameter * \param i - an int vector containing up to 4 elements. * \return void * \author <a href="mailto:[email protected]">Jens Schneider</a> * \date Aug.2004 */ void GLSLProgram::SetUniformVector(const char *name,const int *i) const { assert(m_bEnabled); CheckGLError(); GLenum iType; GLint iLocation; try { iLocation = get_uniform_vector(name, m_hProgram, &iType); } catch(tuvok::GLError gl) { T_ERROR("Error (%d) obtaining uniform %s in '%s' or '%s'.", gl.errno(), name, m_sVS.c_str(), m_sFS.c_str()); return; } switch (iType) { case GL_INT: case GL_SAMPLER_1D: case GL_SAMPLER_2D: case GL_SAMPLER_3D: case GL_SAMPLER_CUBE: case GL_SAMPLER_1D_SHADOW: case GL_SAMPLER_2D_SHADOW: case GL_SAMPLER_2D_RECT_ARB: case GL_SAMPLER_2D_RECT_SHADOW_ARB: glUniform1i(iLocation,i[0]); break; case GL_INT_VEC2: glUniform2iv(iLocation,1,(const GLint*)i); break; case GL_INT_VEC3: glUniform3iv(iLocation,1,(const GLint*)i); break; case GL_INT_VEC4: glUniform4iv(iLocation,1,(const GLint*)i); break; #ifdef GLSL_ALLOW_IMPLICIT_CASTS case GL_BOOL: glUniform1iv(iLocation,1,(const GLint*)i); break; case GL_BOOL_VEC2: glUniform2iv(iLocation,1,(const GLint*)i); break; case GL_BOOL_VEC3: glUniform3iv(iLocation,1,(const GLint*)i); break; case GL_BOOL_VEC4: glUniform4iv(iLocation,1,(const GLint*)i); break; case GL_FLOAT: glUniform1f(iLocation,float(i[0])); break; case GL_FLOAT_VEC2: glUniform2f(iLocation,float(i[0]),float(i[1])); break; case GL_FLOAT_VEC3: glUniform3f(iLocation,float(i[0]),float(i[1]),float(i[2])); break; case GL_FLOAT_VEC4: glUniform4f(iLocation,float(i[0]),float(i[1]),float(i[2]),float(i[3])); break; #endif default: T_ERROR("Unknown type (%d) for %s.", iType, name); break; } #ifdef GLSL_DEBUG CheckGLError("SetUniformVector(%s,int*)",name); #endif }
void GFXGLShader::setConstantsFromBuffer(GFXGLShaderConstBuffer* buffer) { for(Vector<GFXGLShaderConstHandle*>::iterator i = mValidHandles.begin(); i != mValidHandles.end(); ++i) { GFXGLShaderConstHandle* handle = *i; AssertFatal(handle, "GFXGLShader::setConstantsFromBuffer - Null handle"); if(handle->mInstancingConstant) continue; // Don't set if the value has not be changed. if(dMemcmp(mConstBuffer + handle->mOffset, buffer->mBuffer + handle->mOffset, handle->getSize()) == 0) continue; // Copy new value into our const buffer and set in GL. dMemcpy(mConstBuffer + handle->mOffset, buffer->mBuffer + handle->mOffset, handle->getSize()); switch(handle->mDesc.constType) { case GFXSCT_Float: glUniform1fv(handle->mLocation, handle->mDesc.arraySize, (GLfloat*)(mConstBuffer + handle->mOffset)); break; case GFXSCT_Float2: glUniform2fv(handle->mLocation, handle->mDesc.arraySize, (GLfloat*)(mConstBuffer + handle->mOffset)); break; case GFXSCT_Float3: glUniform3fv(handle->mLocation, handle->mDesc.arraySize, (GLfloat*)(mConstBuffer + handle->mOffset)); break; case GFXSCT_Float4: glUniform4fv(handle->mLocation, handle->mDesc.arraySize, (GLfloat*)(mConstBuffer + handle->mOffset)); break; case GFXSCT_Int: case GFXSCT_Sampler: case GFXSCT_SamplerCube: glUniform1iv(handle->mLocation, handle->mDesc.arraySize, (GLint*)(mConstBuffer + handle->mOffset)); break; case GFXSCT_Int2: glUniform2iv(handle->mLocation, handle->mDesc.arraySize, (GLint*)(mConstBuffer + handle->mOffset)); break; case GFXSCT_Int3: glUniform3iv(handle->mLocation, handle->mDesc.arraySize, (GLint*)(mConstBuffer + handle->mOffset)); break; case GFXSCT_Int4: glUniform4iv(handle->mLocation, handle->mDesc.arraySize, (GLint*)(mConstBuffer + handle->mOffset)); break; case GFXSCT_Float2x2: glUniformMatrix2fv(handle->mLocation, handle->mDesc.arraySize, true, (GLfloat*)(mConstBuffer + handle->mOffset)); break; case GFXSCT_Float3x3: glUniformMatrix3fv(handle->mLocation, handle->mDesc.arraySize, true, (GLfloat*)(mConstBuffer + handle->mOffset)); break; case GFXSCT_Float4x4: glUniformMatrix4fv(handle->mLocation, handle->mDesc.arraySize, true, (GLfloat*)(mConstBuffer + handle->mOffset)); break; default: AssertFatal(0,""); break; } } }
void GLSLProgram::setUniform3iv( const std::string & name, const GLint * value, const GLsizei count ) { const GLint loc = getUniformLocation( name ); assert( value != 0 ); assert( count != 0 ); if ( loc != -1 ) glUniform3iv( loc, count, value ); }
/*!*************************************************************************** @Function SetDefaultSemanticValue @Input pszName name of uniform @Input psDefaultValue pointer to default value @Description Sets the default value for the uniform semantic. *****************************************************************************/ void CPVRTPFXEffect::SetDefaultUniformValue(const char *const pszName, const SPVRTSemanticDefaultData *psDefaultValue) { GLint nLocation = glGetUniformLocation(m_uiProgram, pszName); switch(psDefaultValue->eType) { case eDataTypeMat2: glUniformMatrix2fv(nLocation, 1, GL_FALSE, psDefaultValue->pfData); break; case eDataTypeMat3: glUniformMatrix3fv(nLocation, 1, GL_FALSE, psDefaultValue->pfData); break; case eDataTypeMat4: glUniformMatrix4fv(nLocation, 1, GL_FALSE, psDefaultValue->pfData); break; case eDataTypeVec2: glUniform2fv(nLocation, 1, psDefaultValue->pfData); break; case eDataTypeVec3: glUniform3fv(nLocation, 1, psDefaultValue->pfData); break; case eDataTypeVec4: glUniform4fv(nLocation, 1, psDefaultValue->pfData); break; case eDataTypeIvec2: glUniform2iv(nLocation, 1, psDefaultValue->pnData); break; case eDataTypeIvec3: glUniform3iv(nLocation, 1, psDefaultValue->pnData); break; case eDataTypeIvec4: glUniform4iv(nLocation, 1, psDefaultValue->pnData); break; case eDataTypeBvec2: glUniform2i(nLocation, psDefaultValue->pbData[0] ? 1 : 0, psDefaultValue->pbData[1] ? 1 : 0); break; case eDataTypeBvec3: glUniform3i(nLocation, psDefaultValue->pbData[0] ? 1 : 0, psDefaultValue->pbData[1] ? 1 : 0, psDefaultValue->pbData[2] ? 1 : 0); break; case eDataTypeBvec4: glUniform4i(nLocation, psDefaultValue->pbData[0] ? 1 : 0, psDefaultValue->pbData[1] ? 1 : 0, psDefaultValue->pbData[2] ? 1 : 0, psDefaultValue->pbData[3] ? 1 : 0); break; case eDataTypeFloat: glUniform1f(nLocation, psDefaultValue->pfData[0]); break; case eDataTypeInt: glUniform1i(nLocation, psDefaultValue->pnData[0]); break; case eDataTypeBool: glUniform1i(nLocation, psDefaultValue->pbData[0] ? 1 : 0); break; case eNumDefaultDataTypes: case eDataTypeNone: default: break; } }
void GLProgram::setUniformLocationWith3iv(GLint location, GLint* ints, unsigned int numberOfArrays) { bool updated = updateUniformLocation(location, ints, sizeof(int)*3*numberOfArrays); if (updated) { glUniform3iv( (GLint)location, (GLsizei)numberOfArrays, ints ); } }
void mitk::GPGPU::Shader::SetUniform(char *name,int i0,int i1,int i2) { GLint i[3]; i[0]=i0; i[1]=i1; i[2]=i2; glUniform3iv( GetUniformLocation(name) , 1 , i ); GPGPU_CHECKGLERR << "setting uniform"; }
void Shader::setIntN(const std::string &name, const void *data, int count) { int location = glGetUniformLocation(mProgram, name.c_str()); if(count == 1) glUniform1iv(location, 1, (int*)data); else if(count == 2) glUniform2iv(location, 1, (int*)data); else if(count == 3) glUniform3iv(location, 1, (int*)data); else if(count == 4) glUniform4iv(location, 1, (int*)data); }
void Shader::setUniform<glm::bvec3>(const std::string& name, const glm::bvec3& data) { int prev_bound_program; glGetIntegerv(GL_CURRENT_PROGRAM, &prev_bound_program); if(name_to_location.count(name) == 0) { throw Exceptions::InvalidUniformNameException(name); } if(prev_bound_program != program_object) useProgram(); glUniform3iv(name_to_location[name], 1, glm::value_ptr(glm::ivec3(data))); if(prev_bound_program != program_object) glUseProgram(prev_bound_program); }
void GL3ProgramObjectProvider::set_uniformiv(int location, int size, int count, const int *data) { throw_if_disposed(); if (location >= 0) { ProgramObjectStateTracker state_tracker(handle); if( size == 1 ) glUniform1iv(location, count, data); else if( size == 2 ) glUniform2iv(location, count, data); else if( size == 3 ) glUniform3iv(location, count, data); else if( size == 4 ) glUniform4iv(location, count, data); } }
void shader_gl3::uniform(const char* name, const bool3* arg1, const size_t& count) const { A2E_CHECK_UNIFORM_EXISTENCE(name); A2E_CHECK_UNIFORM_TYPE(name, GL_BOOL_VEC3); GLint* int_array = new int[count*3]; for(size_t i = 0; i < (count*3); i++) { int_array[i] = arg1[i].x; i++; int_array[i] = arg1[i].y; } glUniform3iv(A2E_SHADER_GET_UNIFORM_POSITION(name), (GLsizei)count, int_array); delete [] int_array; }
bool COGLES2SLMaterialRenderer::setUniform( int index, const void* data, int count ) { if ((u32)index>=UniformInfo.size()) return false; SUniformInfo& ui = UniformInfo[index]; if ( ui.location == -1 ) return false; switch ( ui.type ) { case GL_FLOAT: glUniform1fv( ui.location, count, static_cast<const GLfloat*>( data ) ); break; case GL_FLOAT_VEC2: glUniform2fv( ui.location, count, static_cast<const GLfloat*>( data ) ); break; case GL_FLOAT_VEC3: glUniform3fv( ui.location, count, static_cast<const GLfloat*>( data ) ); break; case GL_FLOAT_VEC4: glUniform4fv( ui.location, count, static_cast<const GLfloat*>( data ) ); break; case GL_INT: case GL_BOOL: glUniform1iv( ui.location, count, static_cast<const GLint*>( data ) ); break; case GL_INT_VEC2: case GL_BOOL_VEC2: glUniform2iv( ui.location, count, static_cast<const GLint*>( data ) ); break; case GL_INT_VEC3: case GL_BOOL_VEC3: glUniform3iv( ui.location, count, static_cast<const GLint*>( data ) ); break; case GL_INT_VEC4: case GL_BOOL_VEC4: glUniform4iv( ui.location, count, static_cast<const GLint*>( data ) ); break; case GL_FLOAT_MAT2: glUniformMatrix2fv( ui.location, count, false, static_cast<const GLfloat*>( data ) ); break; case GL_FLOAT_MAT3: glUniformMatrix3fv( ui.location, count, false, static_cast<const GLfloat*>( data ) ); break; case GL_FLOAT_MAT4: glUniformMatrix4fv( ui.location, count, false, static_cast<const GLfloat*>( data ) ); break; default: // sampler glUniform1iv( ui.location, count, static_cast<const GLint*>( data ) ); break; } return !Driver->testGLError(); }
void Shader::SendVectorArray(int location, const Vector3i* vectors, unsigned int count) const { if (location == -1) return; if (glProgramUniform3iv) glProgramUniform3iv(m_program, location, count, reinterpret_cast<const int*>(vectors)); else { OpenGL::BindProgram(m_program); glUniform3iv(location, count, reinterpret_cast<const int*>(vectors)); } }
void Shader::SendVector(int location, const Vector3i& vector) const { if (location == -1) return; if (glProgramUniform3iv) glProgramUniform3iv(m_program, location, 1, vector); else { OpenGL::BindProgram(m_program); glUniform3iv(location, 1, vector); } }
void GPU_shader_uniform_vector_int(GPUShader *UNUSED(shader), int location, int length, int arraysize, const int *value) { if (location == -1) return; GPU_ASSERT_NO_GL_ERRORS("Pre Uniform Vector"); if (length == 1) glUniform1iv(location, arraysize, value); else if (length == 2) glUniform2iv(location, arraysize, value); else if (length == 3) glUniform3iv(location, arraysize, value); else if (length == 4) glUniform4iv(location, arraysize, value); GPU_ASSERT_NO_GL_ERRORS("Post Uniform Vector"); }
void program::set_uniform3iv(char const* varname, GLsizei count, GLint* value) const { GLint location = get_uniform_location(varname); if (location >= 0) { #if GPUCAST_GL_DIRECT_STATE_ACCESS glProgramUniform3iv(id_, location, count, value); #else glUniform3iv(location, count, value); #endif } }
bool COpenGLGPUProgram::setUniformiv( E_UNIFORM_TYPE uniform, const s32* integers, u32 size_bytes) { GLint loc = m_Uniforms[uniform].Location; if (loc == -1) { LOGGER.logErr("Can't set uniform '%s', due to unknown location", getUniformName(uniform)); return false; } GLenum type = m_Uniforms[uniform].Type; s32 count = m_Uniforms[uniform].Size; u32 actual_size = m_Uniforms[uniform].Bytes; if (size_bytes != actual_size) { LOGGER.logErr("Incorrect uniform '%s' size bytes (actual=%d, expected=%d)", getUniformName(uniform), actual_size, size_bytes); return false; } switch (type) { case GL_INT: case GL_SAMPLER_1D: case GL_SAMPLER_2D: case GL_SAMPLER_3D: case GL_SAMPLER_CUBE: case GL_SAMPLER_1D_SHADOW: case GL_SAMPLER_2D_SHADOW: glUniform1iv(loc, count, integers); break; case GL_INT_VEC2: glUniform2iv(loc, count, integers); break; case GL_INT_VEC3: glUniform3iv(loc, count, integers); break; case GL_INT_VEC4: glUniform4iv(loc, count, integers); break; default: LOGGER.logErr("Unknown OpenGL uniform integer type %X", type); return false; } return true; }
// (GL context) void IsoSurface::render(const Matrix4& projectionMatrix, const Matrix4& modelViewMatrix) { if (mIsEmpty) return; if (!mBound) bind(); if (mDirty) update(); // Vertices android_assert(mVertexAttrib != -1); glEnableVertexAttribArray(mVertexAttrib); android_assert(mVertexBuffer != 0); glBindBuffer(GL_ARRAY_BUFFER, mVertexBuffer); glVertexAttribPointer(mVertexAttrib, 3, GL_FLOAT, false, 0, nullptr); // Normals android_assert(mNormalAttrib != -1); glEnableVertexAttribArray(mNormalAttrib); android_assert(mNormalBuffer != 0); glBindBuffer(GL_ARRAY_BUFFER, mNormalBuffer); glVertexAttribPointer(mNormalAttrib, 3, GL_FLOAT, false, 0, nullptr); // Indices android_assert(mIndexBuffer != 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mIndexBuffer); // Rendering glUseProgram(mMaterial->getHandle()); glUniformMatrix4fv(mModelViewUniform, 1, false, modelViewMatrix.data_); glUniformMatrix4fv(mProjectionUniform, 1, false, projectionMatrix.data_); glUniformMatrix3fv(mNormalMatrixUniform, 1, false, modelViewMatrix.inverse().transpose().get3x3Matrix().data_); glUniform3iv(mDimensionsUniform, 1, mDimensions); if (mValueUniform != -1) glUniform1f(mValueUniform, (mValue-mRange[0])/(mRange[1]-mRange[0])); // glUniform1f(mOpacityUniform, (mStream ? 0.5f : 1.0f)); glUniform1f(mOpacityUniform, 1.0f); glUniform4fv(mClipPlaneUniform, 1, mClipEq); glDrawElements(GL_TRIANGLES, mIndices.size(), GL_UNSIGNED_SHORT, nullptr); glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); glDisableVertexAttribArray(mVertexAttrib); glDisableVertexAttribArray(mNormalAttrib); }
void CL_OpenGLProgramObjectProvider::set_uniformiv(const CL_StringRef &name, int size, int count, int *data) { throw_if_disposed(); CL_ProgramObjectStateTracker state_tracker(handle); int loc = get_uniform_location(name); if (loc == -1) return; if( size == 1 ) glUniform1iv(loc, count, data); else if( size == 2 ) glUniform2iv(loc, count, data); else if( size == 3 ) glUniform3iv(loc, count, data); else if( size == 4 ) glUniform4iv(loc, count, data); else throw CL_Exception(cl_format("Unsupported size given to uniform '%1'.", name)); }