static int program_set_uniform_number4(lua_State *L) { shader_type *p = (shader_type*)lua_touserdata(L, 1); const char *var = luaL_checkstring(L, 2); bool change = gl_c_shader != p->shader; if (change) tglUseProgramObject(p->shader); // Uniform array if (lua_istable(L, 3)) { int nb = lua_objlen(L, 3); int i; GLfloat is[4*nb]; for (i = 0; i < nb; i++) { lua_rawgeti(L, 3, i + 1); lua_rawgeti(L, -1, 1); is[i*4+0] = lua_tonumber(L, -1); lua_pop(L, 1); lua_rawgeti(L, -1, 2); is[i*4+1] = lua_tonumber(L, -1); lua_pop(L, 1); lua_rawgeti(L, -1, 3); is[i*4+2] = lua_tonumber(L, -1); lua_pop(L, 1); lua_rawgeti(L, -1, 4); is[i*4+3] = lua_tonumber(L, -1); lua_pop(L, 1); lua_pop(L, 1); } glUniform4fvARB(glGetUniformLocationARB(p->shader, var), nb, is); } else { GLfloat i[4]; i[0] = luaL_checknumber(L, 3); i[1] = luaL_checknumber(L, 4); i[2] = luaL_checknumber(L, 5); i[3] = luaL_checknumber(L, 6); glUniform4fvARB(glGetUniformLocationARB(p->shader, var), 1, i); } if (change) tglUseProgramObject(0); return 0; }
void GPU::Shader::SetUniform( const std::string& name, const void *value ) { UniformMap::iterator uu = m_Uniforms.find( name ); if( uu != m_Uniforms.end() ) { GLuint activeProgBackup = glGetHandleARB( GL_PROGRAM_OBJECT_ARB ); glUseProgramObjectARB( m_Id ); Uniform &u = uu->second; switch( u.type ) { case GL_FLOAT: glUniform1fvARB( u.location, u.size, (GLfloat*) value ); break; case GL_FLOAT_VEC2_ARB: glUniform2fvARB( u.location, u.size, (GLfloat*) value ); break; case GL_FLOAT_VEC3_ARB: glUniform3fvARB( u.location, u.size, (GLfloat*) value ); break; case GL_FLOAT_VEC4_ARB: glUniform4fvARB( u.location, u.size, (GLfloat*) value ); break; case GL_INT: glUniform1ivARB( u.location, u.size, (GLint*) value ); break; case GL_INT_VEC2_ARB: glUniform2ivARB( u.location, u.size, (GLint*) value ); break; case GL_INT_VEC3_ARB: glUniform3ivARB( u.location, u.size, (GLint*) value ); break; case GL_INT_VEC4_ARB: glUniform4ivARB( u.location, u.size, (GLint*) value ); break; case GL_BOOL_ARB: glUniform1ivARB( u.location, u.size, (GLint*) value ); break; case GL_BOOL_VEC2_ARB: glUniform2ivARB( u.location, u.size, (GLint*) value ); break; case GL_BOOL_VEC3_ARB: glUniform3ivARB( u.location, u.size, (GLint*) value ); break; case GL_BOOL_VEC4_ARB: glUniform4ivARB( u.location, u.size, (GLint*) value ); break; case GL_FLOAT_MAT2_ARB: glUniformMatrix2fvARB( u.location, u.size, GL_FALSE, (GLfloat*) value ); break; case GL_FLOAT_MAT3_ARB: glUniformMatrix3fvARB( u.location, u.size, GL_FALSE, (GLfloat*) value ); break; case GL_FLOAT_MAT4_ARB: glUniformMatrix4fvARB( u.location, u.size, GL_FALSE, (GLfloat*) value ); break; } glUseProgramObjectARB( activeProgBackup ); } }
/* * sendUniform4fv * * parameter name - char* * parameter count - GLsizei * parameter values - GLfloat* * return - bool */ bool ShaderObject::sendUniform4fv(const char * name, GLsizei count, GLfloat* values) { GLint location = getUniLoc(name); if (location == -1) return false; glUniform4fvARB(location, count, values); return true; } // end sendUniform4fv()
// // Set uniform vector in GLSL program // qbool SHD_SetUniformVector(shader_t *s, const char *name, const float *value) { int loc; if (!SHD_Initialized()) { Com_Printf("SHD_SetUniformVector: shader system not initialized\n"); return false; } if (!s || !s->program) Sys_Error("SHD_SetUniformVector: zero shader"); loc = glGetUniformLocationARB(s->program, name); if (loc < 0) { // should be Com_DPrintf(), but we are new to shaders yet, so let spam it Com_Printf("SHD_SetUniformVector: glGetUniformLocationARB failed for name:%s\n", name); return false; } glUniform4fvARB(loc, 1, value); return true; }
void useShader(shader_type *p, int x, int y, int w, int h, float tx, float ty, float tw, float th, float r, float g, float b, float a) { tglUseProgramObject(p->shader); GLfloat t = cur_frame_tick; glUniform1fvARB(p->p_tick, 1, &t); GLfloat d[4]; d[0] = r; d[1] = g; d[2] = b; d[3] = a; glUniform4fvARB(p->p_color, 1, d); GLfloat c[2]; c[0] = x; c[1] = y; glUniform2fvARB(p->p_mapcoord, 1, c); c[0] = w; c[1] = h; glUniform2fvARB(p->p_texsize, 1, c); d[0] = tx; d[1] = ty; d[2] = tw; d[3] = th; glUniform4fvARB(p->p_texcoord, 1, d); shader_reset_uniform *ru = p->reset_uniforms; while (ru) { switch (ru->kind) { case UNIFORM_NUMBER: glUniform1fvARB(ru->p, 1, &ru->data.number); break; case UNIFORM_VEC2: glUniform2fvARB(ru->p, 1, ru->data.vec2); break; case UNIFORM_VEC3: glUniform3fvARB(ru->p, 1, ru->data.vec3); break; case UNIFORM_VEC4: glUniform4fvARB(ru->p, 1, ru->data.vec4); break; } ru = ru->next; } }
bool Shader::sendUniform4fv(char* varname, GLsizei count, GLfloat *value) { GLint loc = GetUniformLocation(varname); if (loc == -1) return false; glUniform4fvARB(loc, count, value); return true; }
void ShaderState::switchTo(const State& to, bool fullStateSwitch) const { const ShaderState& ss = checked_cast_ref<const ShaderState&>(to); if (fullStateSwitch || _program != ss._program) { glUseProgramObjectARB(handleOf(ss._program)); } //UniformMapCIter fromIter = _uniforms.begin(); //UniformMapCIter fromEnd = _uniforms.end(); UniformMapCIter toIter = ss._uniforms.begin(); UniformMapCIter toEnd = ss._uniforms.end(); // This is wrong too. for (; toIter != toEnd; ++toIter) { GLint location = glGetUniformLocationARB(handleOf(ss._program), toIter->first.c_str()); glUniform4fvARB(location, 1, toIter->second.getData()); } #if 0 // This is wrong. while (fromIter != fromEnd || toIter != toEnd) { if (fromIter == fromEnd) { glUniform4fvARB(location, 1, toIter->second.getData()); ++toIter; } else if (toIter == toEnd) { ++fromIter; } else if (fromIter->first > toIter->first) { glUniform4fvARB(location, 1, toIter->second.getData()); switchFromDefault(*assertTrue(toIter->second), fullStateSwitch); ++toIter; } else if (fromIter->first < toIter->first) { glUniform4fvARB(location, 1, toIter->second.getData()); ++fromIter; } else { stateSwitch(*assertTrue(fromIter->second), *assertTrue(toIter->second), fullStateSwitch); ++toIter; ++fromIter; } } #endif }
bool GlslProgram :: setUniformVector ( const char * name, const Vector4D& value ) { int loc = glGetUniformLocationARB ( program, name ); if ( loc < 0 ) return false; glUniform4fvARB ( loc, 1, value ); return true; }
void BL_Shader::SetUniform(int uniform, const MT_Tuple4& vec) { if ( GLEW_ARB_fragment_shader && GLEW_ARB_vertex_shader && GLEW_ARB_shader_objects ) { float value[4]; vec.getValue(value); glUniform4fvARB(uniform, 1, value); } }
void GPU_shader_uniform_vector(GPUShader *UNUSED(shader), int location, int length, int arraysize, float *value) { if (location == -1) return; GPU_print_error("Pre Uniform Vector"); if (length == 1) glUniform1fvARB(location, arraysize, value); else if (length == 2) glUniform2fvARB(location, arraysize, value); else if (length == 3) glUniform3fvARB(location, arraysize, value); else if (length == 4) glUniform4fvARB(location, arraysize, value); else if (length == 9) glUniformMatrix3fvARB(location, arraysize, 0, value); else if (length == 16) glUniformMatrix4fvARB(location, arraysize, 0, value); GPU_print_error("Post Uniform Vector"); }
void BL_Shader::SetUniform(int uniform, const float* val, int len) { if ( GLEW_ARB_fragment_shader && GLEW_ARB_vertex_shader && GLEW_ARB_shader_objects ) { if (len == 2) glUniform2fvARB(uniform, 1,(GLfloat*)val); else if (len == 3) glUniform3fvARB(uniform, 1,(GLfloat*)val); else if (len == 4) glUniform4fvARB(uniform, 1,(GLfloat*)val); else MT_assert(0); } }
bool ShaderProgram::SetVariable(const char* name, int varDim, const float* values, int count) { if (!_linked) return false; if (_id) { GLint location = glGetUniformLocationARB(_id, name); if (location == -1) return false; switch (varDim) { case 1: glUniform1fvARB(location, count, values); break; case 2: glUniform2fvARB(location, count, values); break; case 3: glUniform3fvARB(location, count, values); break; case 4: glUniform4fvARB(location, count, values); break; default: return false; } return true; } else return false; }
/*! void Quaternions(Shaderobject shader, String uniform_variable)\n Function to pass the quaternions as uniform array to a vertexshader */ void Item_armature::Quaternions(QObject* _shader, QString var){ if (glwrapper_shader* shader = dynamic_cast<glwrapper_shader*>(_shader)){ float* space = new float[max_bone_id * 4 + 4]; for (QTreeWidgetItemIterator it(this);*it;it++){ if (Item_bone* bone = dynamic_cast<Item_bone*>(*it)){ space[bone->id * 4 + 0] = bone->quat[0]; space[bone->id * 4 + 1] = bone->quat[1]; space[bone->id * 4 + 2] = bone->quat[2]; space[bone->id * 4 + 3] = bone->quat[3]; } } shader->Bind(); int loc = glGetUniformLocationARB(shader->getShaderHandle(),var.toLatin1().constData()); glUniform4fvARB(loc, max_bone_id +1, space); delete[] space; } else{ qDebug() << "Item_armature::Joints parameter is not a shader object"; } }
void ccShaderARB::setTabUniform4fv(const char* uniform, int size, float* val) { int loc = glGetUniformLocationARB(prog,uniform); glUniform4fvARB(loc,size,val); }
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBShaderObjects_nglUniform4fvARB(JNIEnv *env, jclass clazz, jint location, jint count, jobject values, jint values_position, jlong function_pointer) { const GLfloat *values_address = ((const GLfloat *)(*env)->GetDirectBufferAddress(env, values)) + values_position; glUniform4fvARBPROC glUniform4fvARB = (glUniform4fvARBPROC)((intptr_t)function_pointer); glUniform4fvARB(location, count, values_address); }
void BL_Uniform::Apply(class BL_Shader *shader) { #ifdef SORT_UNIFORMS MT_assert(mType > UNI_NONE && mType < UNI_MAX && mData); if (!mDirty) return; switch (mType) { case UNI_FLOAT: { float *f = (float*)mData; glUniform1fARB(mLoc,(GLfloat)*f); break; } case UNI_INT: { int *f = (int*)mData; glUniform1iARB(mLoc, (GLint)*f); break; } case UNI_FLOAT2: { float *f = (float*)mData; glUniform2fvARB(mLoc,1, (GLfloat*)f); break; } case UNI_FLOAT3: { float *f = (float*)mData; glUniform3fvARB(mLoc,1,(GLfloat*)f); break; } case UNI_FLOAT4: { float *f = (float*)mData; glUniform4fvARB(mLoc,1,(GLfloat*)f); break; } case UNI_INT2: { int *f = (int*)mData; glUniform2ivARB(mLoc,1,(GLint*)f); break; } case UNI_INT3: { int *f = (int*)mData; glUniform3ivARB(mLoc,1,(GLint*)f); break; } case UNI_INT4: { int *f = (int*)mData; glUniform4ivARB(mLoc,1,(GLint*)f); break; } case UNI_MAT4: { float *f = (float*)mData; glUniformMatrix4fvARB(mLoc, 1, mTranspose?GL_TRUE:GL_FALSE,(GLfloat*)f); break; } case UNI_MAT3: { float *f = (float*)mData; glUniformMatrix3fvARB(mLoc, 1, mTranspose?GL_TRUE:GL_FALSE,(GLfloat*)f); break; } } mDirty = false; #endif }
void MGLContext::sendUniformVec4(unsigned int fxId, const char * name, float * values, const int count){ GLint uValue = glGetUniformLocationARB((GLhandleARB)fxId, name); if(uValue != -1) glUniform4fvARB(uValue, count, values); }
//----------------------------------------------------------------------------- // uploadJointMatrices() //----------------------------------------------------------------------------- void LLViewerJointMesh::uploadJointMatrices() { S32 joint_num; LLPolyMesh *reference_mesh = mMesh->getReferenceMesh(); LLDrawPool *poolp = mFace ? mFace->getPool() : NULL; BOOL hardware_skinning = (poolp && poolp->getVertexShaderLevel() > 0) ? TRUE : FALSE; //calculate joint matrices for (joint_num = 0; joint_num < reference_mesh->mJointRenderData.count(); joint_num++) { LLMatrix4 joint_mat = *reference_mesh->mJointRenderData[joint_num]->mWorldMatrix; if (hardware_skinning) { joint_mat *= LLDrawPoolAvatar::getModelView(); } gJointMatUnaligned[joint_num] = joint_mat; gJointRotUnaligned[joint_num] = joint_mat.getMat3(); } BOOL last_pivot_uploaded = FALSE; S32 j = 0; //upload joint pivots for (joint_num = 0; joint_num < reference_mesh->mJointRenderData.count(); joint_num++) { LLSkinJoint *sj = reference_mesh->mJointRenderData[joint_num]->mSkinJoint; if (sj) { if (!last_pivot_uploaded) { LLVector4 parent_pivot(sj->mRootToParentJointSkinOffset); parent_pivot.mV[VW] = 0.f; gJointPivot[j++] = parent_pivot; } LLVector4 child_pivot(sj->mRootToJointSkinOffset); child_pivot.mV[VW] = 0.f; gJointPivot[j++] = child_pivot; last_pivot_uploaded = TRUE; } else { last_pivot_uploaded = FALSE; } } //add pivot point into transform for (S32 i = 0; i < j; i++) { LLVector3 pivot; pivot = LLVector3(gJointPivot[i]); pivot = pivot * gJointRotUnaligned[i]; gJointMatUnaligned[i].translate(pivot); } // upload matrices if (hardware_skinning) { GLfloat mat[45*4]; memset(mat, 0, sizeof(GLfloat)*45*4); for (joint_num = 0; joint_num < reference_mesh->mJointRenderData.count(); joint_num++) { gJointMatUnaligned[joint_num].transpose(); for (S32 axis = 0; axis < NUM_AXES; axis++) { F32* vector = gJointMatUnaligned[joint_num].mMatrix[axis]; U32 offset = LL_CHARACTER_MAX_JOINTS_PER_MESH*axis+joint_num; memcpy(mat+offset*4, vector, sizeof(GLfloat)*4); } } stop_glerror(); glUniform4fvARB(gAvatarMatrixParam, 45, mat); stop_glerror(); } else { //load gJointMatUnaligned into gJointMatAligned for (joint_num = 0; joint_num < reference_mesh->mJointRenderData.count(); ++joint_num) { gJointMatAligned[joint_num].loadu(gJointMatUnaligned[joint_num]); } } }
bool GlslProgram :: setUniformVector ( int loc, const Vector4D& value ) { glUniform4fvARB ( loc, 1, value ); return true; }
void ProgramUniformGLSL::Set(const Quaternion &qQuaternion) { glUniform4fvARB(m_nOpenGLUniformLocation, 1, qQuaternion); }
void ProgramUniformGLSL::Set(const Color4 &cColor) { glUniform4fvARB(m_nOpenGLUniformLocation, 1, cColor); }
void ProgramUniformGLSL::Set(const Vector4 &vVector) { glUniform4fvARB(m_nOpenGLUniformLocation, 1, vVector); }
ShaderProgram &u4(const char *var, GLfloat *f) { glUniform4fvARB(uniform(var), 1, f); return *this; }
//----------------------------------------------------------------------- void GLSLLinkProgram::updateUniforms(GpuProgramParametersSharedPtr params, uint16 mask, GpuProgramType fromProgType) { // iterate through uniform reference list and update uniform values GLUniformReferenceIterator currentUniform = mGLUniformReferences.begin(); GLUniformReferenceIterator endUniform = mGLUniformReferences.end(); for (; currentUniform != endUniform; ++currentUniform) { // Only pull values from buffer it's supposed to be in (vertex or fragment) // This method will be called twice, once for vertex program params, // and once for fragment program params. if (fromProgType == currentUniform->mSourceProgType) { const GpuConstantDefinition* def = currentUniform->mConstantDef; if (def->variability & mask) { GLsizei glArraySize = (GLsizei)def->arraySize; // get the index in the parameter real list switch (def->constType) { case GCT_FLOAT1: glUniform1fvARB(currentUniform->mLocation, glArraySize, params->getFloatPointer(def->physicalIndex)); break; case GCT_FLOAT2: glUniform2fvARB(currentUniform->mLocation, glArraySize, params->getFloatPointer(def->physicalIndex)); break; case GCT_FLOAT3: glUniform3fvARB(currentUniform->mLocation, glArraySize, params->getFloatPointer(def->physicalIndex)); break; case GCT_FLOAT4: glUniform4fvARB(currentUniform->mLocation, glArraySize, params->getFloatPointer(def->physicalIndex)); break; case GCT_MATRIX_2X2: glUniformMatrix2fvARB(currentUniform->mLocation, glArraySize, GL_TRUE, params->getFloatPointer(def->physicalIndex)); break; case GCT_MATRIX_2X3: if (GLEW_VERSION_2_1) { glUniformMatrix2x3fv(currentUniform->mLocation, glArraySize, GL_TRUE, params->getFloatPointer(def->physicalIndex)); } break; case GCT_MATRIX_2X4: if (GLEW_VERSION_2_1) { glUniformMatrix2x4fv(currentUniform->mLocation, glArraySize, GL_TRUE, params->getFloatPointer(def->physicalIndex)); } break; case GCT_MATRIX_3X2: if (GLEW_VERSION_2_1) { glUniformMatrix3x2fv(currentUniform->mLocation, glArraySize, GL_TRUE, params->getFloatPointer(def->physicalIndex)); } break; case GCT_MATRIX_3X3: glUniformMatrix3fvARB(currentUniform->mLocation, glArraySize, GL_TRUE, params->getFloatPointer(def->physicalIndex)); break; case GCT_MATRIX_3X4: if (GLEW_VERSION_2_1) { glUniformMatrix3x4fv(currentUniform->mLocation, glArraySize, GL_TRUE, params->getFloatPointer(def->physicalIndex)); } break; case GCT_MATRIX_4X2: if (GLEW_VERSION_2_1) { glUniformMatrix4x2fv(currentUniform->mLocation, glArraySize, GL_TRUE, params->getFloatPointer(def->physicalIndex)); } break; case GCT_MATRIX_4X3: if (GLEW_VERSION_2_1) { glUniformMatrix4x3fv(currentUniform->mLocation, glArraySize, GL_TRUE, params->getFloatPointer(def->physicalIndex)); } break; case GCT_MATRIX_4X4: glUniformMatrix4fvARB(currentUniform->mLocation, glArraySize, GL_TRUE, params->getFloatPointer(def->physicalIndex)); break; case GCT_INT1: glUniform1ivARB(currentUniform->mLocation, glArraySize, (GLint*)params->getIntPointer(def->physicalIndex)); break; case GCT_INT2: glUniform2ivARB(currentUniform->mLocation, glArraySize, (GLint*)params->getIntPointer(def->physicalIndex)); break; case GCT_INT3: glUniform3ivARB(currentUniform->mLocation, glArraySize, (GLint*)params->getIntPointer(def->physicalIndex)); break; case GCT_INT4: glUniform4ivARB(currentUniform->mLocation, glArraySize, (GLint*)params->getIntPointer(def->physicalIndex)); break; case GCT_SAMPLER1D: case GCT_SAMPLER1DSHADOW: case GCT_SAMPLER2D: case GCT_SAMPLER2DSHADOW: case GCT_SAMPLER3D: case GCT_SAMPLERCUBE: // samplers handled like 1-element ints glUniform1ivARB(currentUniform->mLocation, 1, (GLint*)params->getIntPointer(def->physicalIndex)); break; case GCT_UNKNOWN: break; } // end switch #if OGRE_DEBUG_MODE checkForGLSLError( "GLSLLinkProgram::updateUniforms", "Error updating uniform", 0 ); #endif } // variability & mask } // fromProgType == currentUniform->mSourceProgType } // end for }
void GLSLShader::SetFloatVector4(GLint variable, GLsizei count, const float *value) { if (variable!=-1) glUniform4fvARB(variable, count, value); }
void ShaderProgramGl::setUniform(const string &name, const Vec4f &value){ assertGl(); glUniform4fvARB(getLocation(name), 1, value.ptr()); assertGl(); }
void ProgramUniformGLSL::Set4(const float *pfComponents) { glUniform4fvARB(m_nOpenGLUniformLocation, 1, pfComponents); }
void DiGLShaderParam::Bind() const { if (!mShaderLinker || !mShaderLinker->GetGLHandle()) return; // bind built-in (global) uniforms auto env = Driver->GetShaderEnvironment(); for (auto it = mBuiltinFuncs.begin(); it != mBuiltinFuncs.end(); ++it) { it->second(env, it->first); } // bind custom uniforms for (uint32 i = 0; i < NUM_VARIABLE_TYPES; ++i) { for (auto it = mShaderParams[i].begin(); it != mShaderParams[i].end(); ++it) { const DiAny& data = it->second; if (data.isEmpty()) continue; GLuint location = 0; int samplerUnit = 0; if (i == VARIABLE_SAMPLER2D || i == VARIABLE_SAMPLERCUBE) { auto sampler = mShaderLinker->GetSampler(it->first); if (!sampler) continue; location = sampler->location; samplerUnit = (int)sampler->unit; } else { auto constant = mShaderLinker->GetConstant(it->first); if (!constant) continue; location = constant->location; } switch (i) { case DiShaderParameter::VARIABLE_FLOAT: { float val = any_cast<float>(data); glUniform1fvARB(location, 1, &val); break; } case DiShaderParameter::VARIABLE_FLOAT2: { DiVec2 vec2 = any_cast<DiVec2>(data); glUniform2fvARB(location, 1, vec2.ptr()); break; } case DiShaderParameter::VARIABLE_FLOAT3: { DiVec3 vec3 = any_cast<DiVec3>(data); glUniform3fvARB(location, 1, vec3.ptr()); break; } case DiShaderParameter::VARIABLE_FLOAT4: { DiVec4 vec4 = any_cast<DiVec4>(data); glUniform4fvARB(location, 1, vec4.ptr()); break; } case DiShaderParameter::VARIABLE_MAT4: { DiMat4 vec4 = any_cast<DiMat4>(data); glUniformMatrix4fvARB(location, 1, GL_TRUE, vec4[0]); break; } case DiShaderParameter::VARIABLE_COLOR: { DiColor c = any_cast<DiColor>(data); DiVec4 vec4(c.r,c.g,c.b,c.a); glUniform4fvARB(location, 1, vec4.ptr()); break; } case DiShaderParameter::VARIABLE_FLOAT4_ARRAY: { DiPair<DiVec4*,uint32> v4Arr = any_cast<DiPair<DiVec4*,uint32>>(data); glUniform4fvARB(location, v4Arr.second, v4Arr.first->ptr()); break; } case DiShaderParameter::VARIABLE_SAMPLER2D: case DiShaderParameter::VARIABLE_SAMPLERCUBE: { glUniform1ivARB(location, 1, &samplerUnit); DiTexture* tex = any_cast<DiTexture*>(data); tex->Bind((uint32)samplerUnit); } break; } } } }
void ofxShader::setUniformVariable4fv (char * name, int count, float * value){ if (bLoaded == true){ glUniform4fvARB(glGetUniformLocationARB(shader, name), count, value); } }
void ofxShader::setUniformVariable4fv (char const *name, int count, float const *value) { if (loaded) glUniform4fvARB(glGetUniformLocationARB(shader, name), count, value); }