Пример #1
0
// 2 components
void ProgramUniformGLSL::Get(int &nX, int &nY)
{
	int nElements[2];
	glGetUniformivARB(m_nOpenGLProgram, m_nOpenGLUniformLocation, nElements);
	nX = nElements[0];
	nY = nElements[1];
}
/*
 * getUniformiv
 *
 * parameter name - char*
 * parameter values - GLint*
 */
void ShaderObject::getUniformiv(const char * name, GLint* values) {
    GLint location;
    location = glGetUniformLocationARB(shaderObject, name);
    if (location == -1) {
        std::cout << "Error: can't find uniform variable \"" << name << "\"" << std::endl;
    }

    glGetUniformivARB(shaderObject, location, values);

} // end getUniformiv()
Пример #3
0
static GLboolean
check_uniform(const GLint expected[4], GLuint size, int sign,
              GLint loc, const char *func)
{
   if (sign == SIGNED) {
      GLint vals[4];
      glGetUniformivARB(Program, loc, vals);
      if (size < 4)
         vals[3] = 1;
      if (size < 3)
         vals[2] = 0;
      if (size < 2)
         vals[1] = 0;
      if (expected[0] != vals[0] ||
          expected[1] != vals[1] ||
          expected[2] != vals[2] ||
          expected[3] != vals[3]) {
         fprintf(stderr, "%s: %s failed\n", TestName, func);
         fprintf(stderr, "  Expected: %d, %d, %d, %d\n",
                 expected[0], expected[1], expected[2], expected[3]);
         fprintf(stderr, "  Found:    %d, %d, %d, %d\n",
                 vals[0], vals[1], vals[2], vals[3]);
         return GL_FALSE;
      }
   }
   else {
      GLuint vals[4];
      glGetUniformuivEXT(Program, loc, vals);
      if (size < 4)
         vals[3] = 1;
      if (size < 3)
         vals[2] = 0;
      if (size < 2)
         vals[1] = 0;
      if (expected[0] != vals[0] ||
          expected[1] != vals[1] ||
          expected[2] != vals[2] ||
          expected[3] != vals[3]) {
         fprintf(stderr, "%s: %s failed\n", TestName, func);
         fprintf(stderr, "  Expected: %d, %d, %d, %d\n",
                 expected[0], expected[1], expected[2], expected[3]);
         fprintf(stderr, "  Found:    %u, %u, %u, %u\n",
                 vals[0], vals[1], vals[2], vals[3]);
         return GL_FALSE;
      }
   }
   return GL_TRUE;
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_ARBShaderObjects_nglGetUniformivARB(JNIEnv *env, jclass clazz, jint programObj, jint location, jobject params, jint params_position, jlong function_pointer) {
	GLint *params_address = ((GLint *)(*env)->GetDirectBufferAddress(env, params)) + params_position;
	glGetUniformivARBPROC glGetUniformivARB = (glGetUniformivARBPROC)((intptr_t)function_pointer);
	glGetUniformivARB(programObj, location, params_address);
}
Пример #5
0
void ProgramUniformGLSL::Get4(int *pnComponents)
{
	glGetUniformivARB(m_nOpenGLProgram, m_nOpenGLUniformLocation, pnComponents);
}
Пример #6
0
void ProgramUniformGLSL::Get(Vector3i &vVector)
{
	glGetUniformivARB(m_nOpenGLProgram, m_nOpenGLUniformLocation, vVector.nV);
}
Пример #7
0
//[-------------------------------------------------------]
//[ Public virtual PLRenderer::ProgramUniform functions   ]
//[-------------------------------------------------------]
// 1 component
void ProgramUniformGLSL::Get(int &nX)
{
	glGetUniformivARB(m_nOpenGLProgram, m_nOpenGLUniformLocation, &nX);
}
void WShaderProgram::getValue1i( const char *name, int &v1 )
{
	GLint loc = glGetUniformLocationARB( programId(), name );
	glGetUniformivARB( programId(), loc, &v1 );
}