List of usage examples for org.lwjgl.opengl GL30 glGenVertexArrays
@NativeType("void") public static int glGenVertexArrays()
From source file:bd.ac.seu.lwjgldemo.Renderer.java
private void setupModel() { int COLUMNS_PER_ROW = 3; vertices = new double[NUM_VERTICES * COLUMNS_PER_ROW]; for (int row = 0; row < vertices.length / COLUMNS_PER_ROW; row++) { vertices[row * COLUMNS_PER_ROW + 0] = Math.random(); vertices[row * COLUMNS_PER_ROW + 1] = Math.random(); vertices[row * COLUMNS_PER_ROW + 2] = 0; }/*from w ww . ja va 2 s . c o m*/ DoubleBuffer buffer = BufferUtils.createDoubleBuffer(vertices.length); buffer.put(vertices); buffer.flip(); vaoId = GL30.glGenVertexArrays(); GL30.glBindVertexArray(vaoId); vboId = GL15.glGenBuffers(); GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vboId); GL15.glBufferData(GL15.GL_ARRAY_BUFFER, buffer, GL15.GL_STATIC_DRAW); GL20.glVertexAttribPointer(0, 3, GL11.GL_DOUBLE, false, 0, 0); GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0); GL30.glBindVertexArray(0); }
From source file:br.com.perin.renderEngine.Loader.java
private int createVAO() { int vaoID = GL30.glGenVertexArrays(); GL30.glBindVertexArray(vaoID); return vaoID; }
From source file:com.adavr.player.globjects.VertexArray.java
License:Open Source License
public static VertexArray create() { int id = GL30.glGenVertexArrays(); return new VertexArray(id); }
From source file:com.badlogic.gdx.backends.jglfw.JglfwGL30.java
License:Apache License
@Override public void glGenVertexArrays(int n, int[] arrays, int offset) { for (int i = offset; i < offset + n; i++) { arrays[i] = GL30.glGenVertexArrays(); }//from ww w .j a v a2 s .c o m }
From source file:com.flowpowered.caustic.lwjgl.gl30.GL30VertexArray.java
License:MIT License
@Override public void create() { checkNotCreated();// ww w . j a v a 2s . c o m // Generate the vao id = GL30.glGenVertexArrays(); // Update state super.create(); // Check for errors LWJGLUtil.checkForGLError(); }
From source file:com.geekyaubergine.geekyjgameutil.model.ModelLoader.java
License:Open Source License
/** * Creates VAO and returns its ID//from w ww .ja v a 2 s . c o m * @return Created VAO ID */ private static int createVAO() { int vaoId = GL30.glGenVertexArrays(); vaos.add(vaoId); GL30.glBindVertexArray(vaoId); return vaoId; }
From source file:com.github.kajdreef.mazerunnermvn.Object.GameObject.java
protected void createVBO() { FloatBuffer verticesBuffer = BufferUtils.createFloatBuffer(vertices.length * Vertex.elementCount); for (int i = 0; i < vertices.length; i++) { verticesBuffer.put(vertices[i].getElements()); }//from w w w. j a v a 2s . c om verticesBuffer.flip(); // Create the indices buffer and place the data in it. ByteBuffer indicesBuffer = BufferUtils.createByteBuffer(indicesData.length); indicesBuffer.put(indicesData); indicesBuffer.flip(); // Initialize the VAO vaoId = GL30.glGenVertexArrays(); GL30.glBindVertexArray(vaoId); // Initialize the VBO vboVerticesId = GL15.glGenBuffers(); GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vboVerticesId); GL15.glBufferData(GL15.GL_ARRAY_BUFFER, verticesBuffer, GL15.GL_STATIC_DRAW); // Put the positions in attribute list 0 GL20.glVertexAttribPointer(0, Vertex.positionElementCount, GL11.GL_FLOAT, false, Vertex.stride, Vertex.positionByteOffset); // Put the color components in attribute list 1 GL20.glVertexAttribPointer(1, Vertex.colorElementCount, GL11.GL_FLOAT, false, Vertex.stride, Vertex.colorByteOffset); // Put the texture coordinates in attribute list 2 GL20.glVertexAttribPointer(2, Vertex.textureElementCount, GL11.GL_FLOAT, false, Vertex.stride, Vertex.textureByteOffset); GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0); // Deselect the VAO GL30.glBindVertexArray(0); // Create a VBO for the indices. vboIndicesId = GL15.glGenBuffers(); GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, vboIndicesId); GL15.glBufferData(GL15.GL_ELEMENT_ARRAY_BUFFER, indicesBuffer, GL15.GL_STATIC_DRAW); GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0); }
From source file:com.google.gapid.glviewer.GeometryScene.java
License:Apache License
@Override public void init(Renderer renderer) { float[] background = new float[] { .2f, .2f, .2f, 1f }; LOG.log(FINE, "GL Version: " + GL11.glGetString(GL11.GL_VERSION)); LOG.log(FINE, "GLSL Version: " + GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION)); shaders = Shaders.init(renderer);/*w w w .j a v a 2s .c o m*/ if (renderable != null) { renderable.init(renderer); } GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glClearColor(background[0], background[1], background[2], background[3]); GL11.glPointSize(4); GL30.glBindVertexArray(GL30.glGenVertexArrays()); }
From source file:com.google.gapid.glviewer.gl.Renderer.java
License:Apache License
/** * Initializes the renderer for use.//from www. j a v a 2 s. c o m * Must be called before any other methods. */ public void initialize() { GL30.glBindVertexArray(GL30.glGenVertexArrays()); buildPrimitives(); }
From source file:com.google.gapid.glviewer.Viewer.java
License:Apache License
@Override public void init() { float[] background = new float[] { .2f, .2f, .2f, 1f }; LOG.log(FINE, "GL Version: " + GL11.glGetString(GL11.GL_VERSION)); LOG.log(FINE, "GLSL Version: " + GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION)); shaders = Shaders.init();/*from w ww. jav a2 s. com*/ if (renderable != null) { renderable.init(); } GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glClearColor(background[0], background[1], background[2], background[3]); GL11.glPointSize(4); GL30.glBindVertexArray(GL30.glGenVertexArrays()); }