List of usage examples for org.lwjgl.opengl GL20 glEnableVertexAttribArray
public static void glEnableVertexAttribArray(@NativeType("GLuint") int index)
From source file:game.entity.lwjgl.EntityRenderer.java
private void prepareTexturedModel(TexturedModel model) { RawModel rawModel = model.getRawModel(); if (rawModel.doesContainInvertedNormals()) { GL11.glDisable(GL11.GL_CULL_FACE); }/*from w w w . j a v a2s .c o m*/ GL30.glBindVertexArray(rawModel.getVaoID()); GL20.glEnableVertexAttribArray(VERTEX_POSITIONS); GL20.glEnableVertexAttribArray(TEXTURE_COORDS); GL20.glEnableVertexAttribArray(NORMAL_VECTORS); this.loadUniformFloat("shineDamper", model.getModelTexture().getShineDamper()); this.loadUniformFloat("reflectivity", model.getModelTexture().getReflectivity()); GL13.glActiveTexture(GL13.GL_TEXTURE0); GL11.glBindTexture(GL11.GL_TEXTURE_2D, model.getModelTexture().getTextureID()); }
From source file:game.skybox.lwjgl.SkyboxRenderer.java
public void render() { GL30.glBindVertexArray(cube.getVaoID()); GL20.glEnableVertexAttribArray(0); GL13.glActiveTexture(GL13.GL_TEXTURE0); GL11.glBindTexture(GL13.GL_TEXTURE_CUBE_MAP, texture); GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, cube.getVertexCount()); GL20.glDisableVertexAttribArray(0);/*from www .j a v a2s .c om*/ GL30.glBindVertexArray(0); }
From source file:game.terrain.lwjgl.TerrainRenderer.java
/** * * @param terrain/*from w ww .ja v a 2s. c o m*/ */ private void prepareTerrain(Terrain terrain) { RawModel rawModel = terrain.getModel(); GL30.glBindVertexArray(rawModel.getVaoID()); GL20.glEnableVertexAttribArray(VERTEX_POSITIONS); GL20.glEnableVertexAttribArray(TEXTURE_COORDS); GL20.glEnableVertexAttribArray(NORMAL_VECTORS); bindTextures(terrain); }
From source file:gui.lwjgl.GUIRenderer.java
@Override public void render(GUIRenderable element) { GL30.glBindVertexArray(element.getGUIElement().getVaoID()); GL20.glEnableVertexAttribArray(VERTEX_POSITIONS); GL20.glEnableVertexAttribArray(TEXTURE_COORDS); Matrix4f transformationMatrix = Maths.createTransformationMatrix( new Vector2f(((2.0f * element.getGUIElement().getPosition().x) / Display.getWidth() - 1), -1 * ((2.0f * element.getGUIElement().getPosition().y) / Display.getHeight()) + 1f), element.getGUIElement().getRotation(), element.getGUIElement().getWidth() / (float) (Display.getWidth() / 2), element.getGUIElement().getHeight() / (float) (Display.getHeight() / 2)); this.loadUniformMatrix("transformationMatrix", transformationMatrix); GL13.glActiveTexture(GL13.GL_TEXTURE0); GL11.glBindTexture(GL11.GL_TEXTURE_2D, element.getGUIElement().getTexture().getTextureID()); GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, 6); GL20.glDisableVertexAttribArray(VERTEX_POSITIONS); GL20.glDisableVertexAttribArray(TEXTURE_COORDS); GL30.glBindVertexArray(0);// w w w. jav a2s . co m }
From source file:io.root.gfx.glutils.GL.java
License:Apache License
public static void glEnableVertexAttribArray(int index) { GL20.glEnableVertexAttribArray(index); }
From source file:itdelatrisu.opsu.render.CurveRenderState.java
License:Open Source License
/** * Do the actual drawing of the curve into the currently bound framebuffer. * @param color the color of the curve/*from www. j a v a 2 s . co m*/ * @param borderColor the curve border color * @param curve the points along the curve */ private void draw_curve(Color color, Color borderColor, Vec2f[] curve) { staticState.initGradient(); RenderState state = startRender(); int vtx_buf; // the size is: floatsize * (position + texture coordinates) * (number of cones) * (vertices in a cone) FloatBuffer buff = BufferUtils .createByteBuffer(4 * (4 + 2) * (2 * curve.length - 1) * (NewCurveStyleState.DIVIDES + 2)) .asFloatBuffer(); staticState.initShaderProgram(); vtx_buf = GL15.glGenBuffers(); for (int i = 0; i < curve.length; ++i) { float x = curve[i].x; float y = curve[i].y; //if (i == 0 || i == curve.length - 1){ fillCone(buff, x, y, NewCurveStyleState.DIVIDES); if (i != 0) { float last_x = curve[i - 1].x; float last_y = curve[i - 1].y; double diff_x = x - last_x; double diff_y = y - last_y; x = (float) (x - diff_x / 2); y = (float) (y - diff_y / 2); fillCone(buff, x, y, NewCurveStyleState.DIVIDES); } } buff.flip(); GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vtx_buf); GL15.glBufferData(GL15.GL_ARRAY_BUFFER, buff, GL15.GL_STATIC_DRAW); GL20.glUseProgram(staticState.program); GL20.glEnableVertexAttribArray(staticState.attribLoc); GL20.glEnableVertexAttribArray(staticState.texCoordLoc); GL20.glUniform1i(staticState.texLoc, 0); GL20.glUniform3f(staticState.colLoc, color.r, color.g, color.b); GL20.glUniform4f(staticState.colBorderLoc, borderColor.r, borderColor.g, borderColor.b, borderColor.a); //stride is 6*4 for the floats (4 bytes) (u,v)(x,y,z,w) //2*4 is for skipping the first 2 floats (u,v) GL20.glVertexAttribPointer(staticState.attribLoc, 4, GL11.GL_FLOAT, false, 6 * 4, 2 * 4); GL20.glVertexAttribPointer(staticState.texCoordLoc, 2, GL11.GL_FLOAT, false, 6 * 4, 0); for (int i = 0; i < curve.length * 2 - 1; ++i) GL11.glDrawArrays(GL11.GL_TRIANGLE_FAN, i * (NewCurveStyleState.DIVIDES + 2), NewCurveStyleState.DIVIDES + 2); GL20.glDisableVertexAttribArray(staticState.texCoordLoc); GL20.glDisableVertexAttribArray(staticState.attribLoc); GL15.glDeleteBuffers(vtx_buf); endRender(state); }
From source file:jpcsp.graphics.RE.RenderingEngineLwjgl.java
License:Open Source License
@Override public void enableVertexAttribArray(int id) { GL20.glEnableVertexAttribArray(id); }
From source file:main.EntityRenderer.java
private void prepareTextureModel(TextureModel model) { RawModel rawModel = model.getRawModel(); GL30.glBindVertexArray(rawModel.getVaoId()); GL20.glEnableVertexAttribArray(0); GL20.glEnableVertexAttribArray(1);/*from w w w .j a v a 2s . com*/ GL20.glEnableVertexAttribArray(2); ModelTexture texture = model.getTexture(); shader.loadShineVariables(texture.getShineDamper(), texture.getReflectivity()); GL13.glActiveTexture(GL13.GL_TEXTURE0); GL11.glBindTexture(GL11.GL_TEXTURE_2D, model.getTexture().getTextureId()); }
From source file:main.java.com.YeAJG.game.entity.Entity.java
License:Open Source License
@Override public void Render(float interpolation) { GL20.glUseProgram(pId);/*from w w w . j a va 2 s. co m*/ // Bind the texture GL13.glActiveTexture(GL13.GL_TEXTURE0); GL11.glBindTexture(GL11.GL_TEXTURE_2D, texId); // Bind to the VAO that has all the information about the vertices GL30.glBindVertexArray(vaoId); GL20.glEnableVertexAttribArray(0); GL20.glEnableVertexAttribArray(1); GL20.glEnableVertexAttribArray(2); // Bind to the index VBO that has all the information about the order of the vertices GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, vboiId); // Draw the vertices GL11.glDrawElements(GL11.GL_TRIANGLES, indicesCount, GL11.GL_UNSIGNED_BYTE, 0); // Put everything back to default (deselect) GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0); GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0); GL20.glDisableVertexAttribArray(0); GL20.glDisableVertexAttribArray(1); GL20.glDisableVertexAttribArray(2); GL30.glBindVertexArray(0); GL20.glUseProgram(0); Game.exitOnGLError("renderCycle"); }
From source file:main.TerrainRenderer.java
private void prepareTerrain(Terrain terrain) { RawModel rawModel = terrain.getModel(); GL30.glBindVertexArray(rawModel.getVaoId()); GL20.glEnableVertexAttribArray(0); GL20.glEnableVertexAttribArray(1);//from ww w. j a v a 2s .co m GL20.glEnableVertexAttribArray(2); ModelTexture texture = terrain.getTexture(); shader.loadShineVariables(texture.getShineDamper(), texture.getReflectivity()); GL13.glActiveTexture(GL13.GL_TEXTURE0); GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.getTextureId()); }