本文整理汇总了C++中ShaderProgram::GetAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ ShaderProgram::GetAttribute方法的具体用法?C++ ShaderProgram::GetAttribute怎么用?C++ ShaderProgram::GetAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShaderProgram
的用法示例。
在下文中一共展示了ShaderProgram::GetAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Java_android_filterfw_core_ShaderProgram_setShaderAttributeVertexFrame
jboolean Java_android_filterfw_core_ShaderProgram_setShaderAttributeVertexFrame(
JNIEnv* env,
jobject thiz,
jstring attr_name,
jobject vertex_frame,
jint type,
jint component_count,
jint stride,
jint offset,
jboolean normalize) {
ShaderProgram* program = ConvertFromJava<ShaderProgram>(env, thiz);
if (program) {
// Get the vertex frame
VertexFrame* v_frame = ConvertFromJava<VertexFrame>(env, vertex_frame);
// Get the program variable to set
const std::string attr_string = ToCppString(env, attr_name);
ProgramVar program_var = program->GetAttribute(attr_string);
// Set the variable
if (v_frame && ShaderProgram::IsVarValid(program_var)) {
const bool success = program->SetAttributeValues(program_var,
v_frame,
type,
component_count,
stride,
offset,
ToCppBool(normalize));
return ToJBool(success);
}
}
return JNI_FALSE;
}
示例2: Java_android_filterfw_core_ShaderProgram_setShaderAttributeValues
jboolean Java_android_filterfw_core_ShaderProgram_setShaderAttributeValues(
JNIEnv* env,
jobject thiz,
jstring attr_name,
jfloatArray values,
jint component_count) {
ShaderProgram* program = ConvertFromJava<ShaderProgram>(env, thiz);
if (program) {
// Get the floats to set
jfloat* float_ptr = env->GetFloatArrayElements(values, NULL);
const int length = env->GetArrayLength(values);
// Get the program variable to set
const std::string attr_string = ToCppString(env, attr_name);
ProgramVar program_var = program->GetAttribute(attr_string);
// Set the variable
if (float_ptr && ShaderProgram::IsVarValid(program_var)) {
const bool success = program->SetAttributeValues(program_var,
reinterpret_cast<float*>(float_ptr),
length,
component_count);
env->ReleaseFloatArrayElements(values, float_ptr, JNI_ABORT);
return ToJBool(success);
}
}
return JNI_FALSE;
}