本文整理汇总了Java中com.jogamp.opengl.GL4.glDrawElements方法的典型用法代码示例。如果您正苦于以下问题:Java GL4.glDrawElements方法的具体用法?Java GL4.glDrawElements怎么用?Java GL4.glDrawElements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jogamp.opengl.GL4
的用法示例。
在下文中一共展示了GL4.glDrawElements方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
public void render(GL4 gl4, Application app) {
gl4.glDisable(GL_DEPTH_TEST);
gl4.glViewport(0, 0, app.windowSize.x, app.windowSize.y);
gl4.glBindVertexArray(vertexArrayName.get(0));
gl4.glUseProgram(program.name);
for (int eye = 0; eye < VR.EVREye.Max; eye++) {
gl4.glBindTexture(GL_TEXTURE_2D, app.eyeDesc[eye].textureName.get(FramebufferDesc.Target.RESOLVE));
gl4.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
gl4.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
gl4.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
gl4.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
// left lens (first half of index array ), right lens (second half of index array )
gl4.glDrawElements(GL_TRIANGLES, indexSize / 2, GL_UNSIGNED_SHORT,
eye == VR.EVREye.EYE_Left ? 0 : indexSize); // indexSize / 2 * Short.Bytes = indexSize
}
gl4.glBindVertexArray(0);
gl4.glUseProgram(0);
}
示例2: render
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
@Override
protected boolean render(GL gl) {
GL4 gl4 = (GL4) gl;
{
Mat4 projection = glm.perspectiveFov_((float) Math.PI * 0.25f, windowSize.x, windowSize.y, 0.1f, 100.0f);
uniformPointer.asFloatBuffer().put(projection.mul(viewMat4()).mul(new Mat4(1.0f)).toFa_());
}
gl4.glClearBufferfv(GL_COLOR, 0, clearColor);
// gl4.glMultiDrawElementsIndirect(GL_TRIANGLES, GL_UNSIGNED_SHORT, null, 1, DrawElementsIndirectCommand.SIZEOF);
gl4.glDrawElements(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0);
return true;
}
示例3: render
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
/**
* Draws the render model.
* @param gl4
*/
public void render(GL4 gl4) {
gl4.glBindVertexArray(vertexArrayName.get(0));
gl4.glActiveTexture(GL_TEXTURE0 + Semantic.Sampler.DIFFUSE);
gl4.glBindTexture(GL_TEXTURE_2D, textureName.get(0));
gl4.glDrawElements(GL_TRIANGLES, vertexCount, GL_UNSIGNED_SHORT, 0);
gl4.glBindVertexArray(0);
}