本文整理汇总了Java中com.jogamp.opengl.GL2.glUniform1f方法的典型用法代码示例。如果您正苦于以下问题:Java GL2.glUniform1f方法的具体用法?Java GL2.glUniform1f怎么用?Java GL2.glUniform1f使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jogamp.opengl.GL2
的用法示例。
在下文中一共展示了GL2.glUniform1f方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bindUniforms
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
void bindUniforms(GL2 gl, Scene scene,Renderer renderer, Simulation s, MeshEntity me,
Matrix4f projectionViewModel, Matrix4f viewModel, Matrix4f model,
FloatBuffer fb) {
fb.rewind();
gl.glUniformMatrix4fv(mvpMatrixHandle, 1, false, projectionViewModel.fillFloatBuffer(fb, true));
gl.glUniformMatrix4fv(mvMatrixHandle, 1, false, viewModel.fillFloatBuffer(fb, true));
gl.glUniformMatrix4fv(mMatrixHandle, 1, false, model.fillFloatBuffer(fb, true));
Vector3f lightPos = scene.getLight().getTransform().getTranslation();
Vector3f eyePos = scene.getCamera().getTransform().getTranslation();
gl.glUniform4f(lightPosHandle, lightPos.x, lightPos.y, lightPos.z, 1);
gl.glUniform4f(eyePosHandle, eyePos.x, eyePos.y, eyePos.z, 1);
float r = Color.red(me.getColor()) / 255.0f;
float g = Color.green(me.getColor()) / 255.0f;
float b = Color.blue(me.getColor()) / 255.0f;
float a = Color.alpha(me.getColor()) / 255.0f;
gl.glUniform4f(colorHandle, r, g, b, a);
gl.glUniform1f(ambient, me.getMaterial().getAmbient());
gl.glUniform1f(diffuse, me.getMaterial().getDiffuse());
gl.glUniform1f(specular, me.getMaterial().getSpecular());
gl.glUniform1f(shininess, me.getMaterial().getShininess());
}
示例2: bindUniforms
import com.jogamp.opengl.GL2; //导入方法依赖的package包/类
@Override
void bindUniforms(GL2 gl, Scene scene, Renderer renderer,Simulation s, MeshEntity me, Matrix4f projectionViewModel, Matrix4f viewModel, Matrix4f model, FloatBuffer fb) {
super.bindUniforms(gl, scene, renderer, s, me, projectionViewModel, viewModel, model, fb);
gl.glUniform1f(minPosColor, renderer.getForm().rtSlicePanel.getAmpColorMin());
gl.glUniform1f(maxPosColor, renderer.getForm().rtSlicePanel.getAmpColorMax());
gl.glUniform1f(minNegColor, -renderer.getForm().rtSlicePanel.getAmpColorMax());
gl.glUniform1f(maxNegColor, -renderer.getForm().rtSlicePanel.getAmpColorMin());
gl.glUniform1i(colouring, 4); //ice gradient
}