本文整理汇总了Java中org.lwjgl.opengl.GL11.glDrawElements方法的典型用法代码示例。如果您正苦于以下问题:Java GL11.glDrawElements方法的具体用法?Java GL11.glDrawElements怎么用?Java GL11.glDrawElements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.opengl.GL11
的用法示例。
在下文中一共展示了GL11.glDrawElements方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* Renders the VAO as triangles
*/
@Override
public void render() {
bind();
enableAttributes();
// Bind the EBO
GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, getBufferObject(1));
// Render all the indexed vertices as triangles
GL11.glDrawElements(GL11.GL_TRIANGLES, vertexCount, GL11.GL_UNSIGNED_INT, 0);
disableAttributes();
unbind();
}
示例2: draw
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public void draw(Asset<Mesh> modelMesh, Material material, Matrix4fc transformation)
{
final Program program = this.program.get();
final Mesh mesh = modelMesh.get();
MaterialProperty.MODELVIEWPROJECTION.apply(program,
this.viewProjection.mul(transformation, this.modelViewProjection));
mesh.bind();
{
material.applyOrDefault(MaterialProperty.COLOR, program, new Vector4f(1, 1, 1, 0));
GL11.glDrawElements(GL11.GL_LINE_LOOP, mesh.getVertexCount(), GL11.GL_UNSIGNED_INT, 0);
}
mesh.unbind();
}
示例3: render
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public void render(Map<TexturedModel, List<Entity>> entities) {
for(TexturedModel model : entities.keySet()) {
prepareTexturedModel(model);
List<Entity> batch = entities.get(model);
for(Entity entity : batch) {
prepareInstance(entity);
GL11.glDrawElements(GL11.GL_TRIANGLES, model.getRawModel().getVertexCount(), GL11.GL_UNSIGNED_INT, 0);
}
unbindTexturedModel();
}
}
示例4: render
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public void render(List<Terrain> terrains) {
for(Terrain terrain : terrains) {
prepareTerrain(terrain);
loadModelMatrix(terrain);
GL11.glDrawElements(GL11.GL_TRIANGLES, terrain.getModel().getVertexCount(), GL11.GL_UNSIGNED_INT, 0);
unbindTexturedModel();
}
}
示例5: draw
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public void draw(){
GL30.glBindVertexArray(vao);
GL20.glEnableVertexAttribArray(0);
GL20.glEnableVertexAttribArray(1);
GL11.glDrawElements(GL11.GL_TRIANGLES, 6, GL11.GL_UNSIGNED_INT, 0);
GL20.glDisableVertexAttribArray(0);
GL20.glDisableVertexAttribArray(1);
GL30.glBindVertexArray(vao);
}
示例6: render
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public void render(List<Terrain> terrains) {
for(Terrain t: terrains) {
prepareTerrain(t);
loadModelMatrix(t);
GL11.glDrawElements(GL11.GL_TRIANGLES, t.getModel().getVertexCount(), GL11.GL_UNSIGNED_INT, 0);
unbindTexturedModel();
}
}
示例7: draw
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public void draw(Asset<Mesh> modelMesh, Material material, Matrix4fc transformation)
{
final Program program = this.program.get();
final Mesh mesh = modelMesh.get();
MaterialProperty.MODELVIEWPROJECTION.apply(program,
this.viewProjection.mul(transformation, this.modelViewProjection));
mesh.bind();
{
boolean flag = material.apply(MaterialProperty.TEXTURE, program);
material.applyOrDefault(MaterialProperty.COLOR, program, flag ? DEFAULT_PROPERTY_TEXTURE_COLOR : DEFAULT_PROPERTY_COLOR);
material.applyOrDefault(MaterialProperty.SPRITE_OFFSET, program, DEFAULT_PROPERTY_SPRITE_OFFSET);
material.applyOrDefault(MaterialProperty.SPRITE_SCALE, program, DEFAULT_PROPERTY_SPRITE_SCALE);
material.applyOrDefault(MaterialProperty.TRANSPARENCY, program, DEFAULT_PROPERTY_TRANSPARENCY);
GL11.glDrawElements(GL11.GL_TRIANGLES, mesh.getVertexCount(), GL11.GL_UNSIGNED_INT, 0);
//Clean up
if (flag)
{
Asset<Texture> texture = material.getProperty(MaterialProperty.TEXTURE);
texture.get().unbind();
}
}
mesh.unbind();
}
示例8: render
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public void render(List<WaterTile> water, ICamera camera, Vector3f lightDir) {
prepareRender(camera, lightDir);
for (WaterTile tile : water) {
Matrix4f modelMatrix = createModelMatrix(tile.getX(), tile.getHeight(), tile.getZ(), WaterTile.TILE_SIZE);
shader.modelMatrix.loadMatrix(modelMatrix);
GL11.glDrawElements(GL11.GL_TRIANGLES, quad.getIndexCount(), GL11.GL_UNSIGNED_INT, 0);
}
finish();
}
示例9: render
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public void render(Shader shader, int modelMatrix, GameObject object, Camera camera) {
GL11.glBindTexture(GL11.GL_TEXTURE_2D, object.getTextureID());
Matrix4f transformationMatrix = createTransformationMatrix(object.getTransform());
shader.loadMatrix(modelMatrix, transformationMatrix);
object.update();
GL11.glDrawElements(GL11.GL_TRIANGLES, indicesSize, GL11.GL_UNSIGNED_INT, 0);
}
示例10: render
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public void render(Map<TexturedModel, List<Entity>> entities) {
for (TexturedModel model : entities.keySet()) {
prepareTexturedModel(model);
List<Entity> batch = entities.get(model);
for (Entity entity : batch) {
prepareInstance(entity);
GL11.glDrawElements(GL11.GL_TRIANGLES, model.getRawModel().getVertexCount(), GL11.GL_UNSIGNED_INT, 0);
}
unbindTexturedModel();
}
}
示例11: render
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public void render(List<Terrain> terrains) {
for (Terrain terrain : terrains) {
prepareTerrain(terrain);
loadModelMatrix(terrain);
GL11.glDrawElements(GL11.GL_TRIANGLES, terrain.getModel().getVertexCount(), GL11.GL_UNSIGNED_INT, 0);
unbindTexturedModel();
}
}
示例12: render
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* Renders the skybox.
*
* @param camera
* - the scene's camera.
*/
public void render(ICamera camera) {
prepare(camera);
box.bind(0);
GL11.glDrawElements(GL11.GL_TRIANGLES, box.getIndexCount(), GL11.GL_UNSIGNED_INT, 0);
box.unbind(0);
shader.stop();
}
示例13: render
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public void render(Terrain terrain, ICamera camera, Light light) {
prepare(terrain, camera, light);
if (hasIndices) {
GL11.glDrawElements(GL11.GL_TRIANGLES, terrain.getVertexCount(), GL11.GL_UNSIGNED_INT, 0);
} else {
GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, terrain.getVertexCount());
}
stop(terrain);
}
示例14: render
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public void render(List<Entity> shinyEntities, Texture enviromap, ICamera camera, Vector3f lightDir) {
prepare(camera, lightDir, enviromap);
for (Entity entity : shinyEntities) {
entity.getSkin().getDiffuseTexture().bindToUnit(0);
Vao model = entity.getModel().getVao();
model.bind(0, 1, 2);
GL11.glDrawElements(GL11.GL_TRIANGLES, model.getIndexCount(), GL11.GL_UNSIGNED_INT, 0);
model.unbind(0, 1, 2);
}
finish();
}
示例15: render
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public void render(List<Entity> entities, ICamera camera, Vector3f lightDir, Vector4f clipPlane) {
prepare(camera, lightDir, clipPlane);
for (Entity entity : entities) {
prepareSkin(entity.getSkin());
Vao model = entity.getModel().getVao();
model.bind(0, 1, 2);
GL11.glDrawElements(GL11.GL_TRIANGLES, model.getIndexCount(), GL11.GL_UNSIGNED_INT, 0);
model.unbind(0, 1, 2);
}
finish();
}