本文整理匯總了Java中org.lwjgl.opengl.GL30.glGenVertexArrays方法的典型用法代碼示例。如果您正苦於以下問題:Java GL30.glGenVertexArrays方法的具體用法?Java GL30.glGenVertexArrays怎麽用?Java GL30.glGenVertexArrays使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.lwjgl.opengl.GL30
的用法示例。
在下文中一共展示了GL30.glGenVertexArrays方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: VAO
import org.lwjgl.opengl.GL30; //導入方法依賴的package包/類
/**
* Creates a VertexArrayObject with the specified data
* @param data The FloatBuffer of all the object data
* @param attributes The different attributes of the data. x is size, y is stride
*/
public VAO(FloatBuffer data, int... dimensions) {
bufferObjects = new ArrayList<Integer>();
// Create the VAO
vaoid = GL30.glGenVertexArrays();
// Set the number of attributes to enable
attributes = dimensions.length;
// Put the data in the VAO
store(data, dimensions);
}
示例2: VertexArrayObject
import org.lwjgl.opengl.GL30; //導入方法依賴的package包/類
/**
* Builds renderable geometry from a list of vertices and indices.
* Each triplet of indices references three distinct vertices to form a triangle.
*
* @param vertices ordered list of vertices
* @param indices ordered list of indices references vertices used for determining render order
*/
public VertexArrayObject(Vertex[] vertices, byte[] indices){
indicesCount = indices.length;
// Create a new Vertex Array Object in memory and select it (bind)
vaoId = GL30.glGenVertexArrays();
GL30.glBindVertexArray(vaoId);
// Create a new Vertex Buffer Object in memory and select it (bind)
vboId = GL15.glGenBuffers();
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vboId);
GL15.glBufferData(GL15.GL_ARRAY_BUFFER, bufferFromVertices(vertices), GL15.GL_STREAM_DRAW);
// Put the position coordinates 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);
// Deselect
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
GL30.glBindVertexArray(0);
// Create a new VBO for the indices and select it (bind) - INDICES
indicesId = GL15.glGenBuffers();
GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, indicesId);
GL15.glBufferData(GL15.GL_ELEMENT_ARRAY_BUFFER, Buffers.createByteBuffer(indices), GL15.GL_STATIC_DRAW);
GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0);
}
示例3: Mesh
import org.lwjgl.opengl.GL30; //導入方法依賴的package包/類
public Mesh()
{
this.vertexBuffers = new VBO[0];
this.vertexCount = 0;
this.handle = GL30.glGenVertexArrays();
MESHES.add(this);
}
示例4: createVAO
import org.lwjgl.opengl.GL30; //導入方法依賴的package包/類
private int createVAO() {
int vaoID = GL30.glGenVertexArrays();
GL30.glBindVertexArray(vaoID);
return vaoID;
}
示例5: createVao
import org.lwjgl.opengl.GL30; //導入方法依賴的package包/類
private int createVao() {
int vaoId = GL30.glGenVertexArrays();
vaos.add(vaoId);
GL30.glBindVertexArray(vaoId);
return vaoId;
}
示例6: create
import org.lwjgl.opengl.GL30; //導入方法依賴的package包/類
public static Vao create() {
int id = GL30.glGenVertexArrays();
return new Vao(id);
}
示例7: Quad
import org.lwjgl.opengl.GL30; //導入方法依賴的package包/類
public Quad(float width, float height){
this.width = width;
this.height = height;
vao = GL30.glGenVertexArrays();
GL30.glBindVertexArray(vao);
vbo = GL15.glGenBuffers();
vto = GL15.glGenBuffers();
vboi = GL15.glGenBuffers();
float hw = width * 0.5f,
hh = height * 0.5f;
float[] verts = new float[]{
-hw, -hh, 0, //bottom left
-hw, hh, 0, //top left
hw, hh, 0, //top right
hw, -hh, 0, //bottom right
};
float[] texcoords = new float[]{
0,1,
0,0,
1,0,
1,1
};
int[] indices = new int[]{
0,1,2,
2,3,0
};
FloatBuffer vertBuffer = BufferUtils.createFloatBuffer(12);
vertBuffer.put(verts).flip();
FloatBuffer texBuffer = BufferUtils.createFloatBuffer(8);
texBuffer.put(texcoords).flip();
IntBuffer indBuffer = BufferUtils.createIntBuffer(6);
indBuffer.put(indices).flip();
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo);
GL15.glBufferData(GL15.GL_ARRAY_BUFFER, vertBuffer, GL15.GL_STATIC_DRAW);
GL20.glVertexAttribPointer(0, 3, GL11.GL_FLOAT, false, 0, 0);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vto);
GL15.glBufferData(GL15.GL_ARRAY_BUFFER, texBuffer, GL15.GL_STATIC_DRAW);
GL20.glVertexAttribPointer(1, 2, GL11.GL_FLOAT, false, 0, 0);
GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, vboi);
GL15.glBufferData(GL15.GL_ELEMENT_ARRAY_BUFFER, indBuffer, GL15.GL_STATIC_DRAW);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
GL30.glBindVertexArray(0);
}
示例8: Mesh
import org.lwjgl.opengl.GL30; //導入方法依賴的package包/類
public Mesh() {
vao = GL30.glGenVertexArrays();
vbo = GL15.glGenBuffers();
vboTexture = GL15.glGenBuffers();
vboi = GL15.glGenBuffers();
}
示例9: createVAO
import org.lwjgl.opengl.GL30; //導入方法依賴的package包/類
private int createVAO() {
int vaoID = GL30.glGenVertexArrays();
vaos.add(vaoID);
GL30.glBindVertexArray(vaoID);
return vaoID;
}
示例10: create
import org.lwjgl.opengl.GL30; //導入方法依賴的package包/類
public static Vao create() {
int id = GL30.glGenVertexArrays();
return new Vao(id);
}
示例11: CreateWindow
import org.lwjgl.opengl.GL30; //導入方法依賴的package包/類
public static void CreateWindow(int width, int height, String title)
{
try
{
if(!glfwInit()) throw new Exception("GLFW Initialization failed.");
glfwSetErrorCallback(m_errorCallback = GLFWErrorCallback.createPrint(System.err));
glfwDefaultWindowHints();
glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
glfwWindowHint(GLFW_REFRESH_RATE , GLFW_DONT_CARE);
glfwWindowHint(GLFW_DOUBLEBUFFER , GL_TRUE);
Window.WIDTH = width;
Window.HEIGHT = height;
m_window = glfwCreateWindow(width, height, title, NULL, NULL);
if(m_window == 0) throw new Exception("GLFW Window creation failed.");
GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor());
// Center our window
glfwSetWindowPos(
m_window,
(vidmode.width() - WIDTH) / 2,
(vidmode.height() - HEIGHT) / 2
);
Mouse = window.new Mouse();
Mouse.Create(m_window);
glfwSetWindowSizeCallback(m_window, m_resizeCallBack = new GLFWWindowSizeCallback()
{
@Override
public void invoke(long arg0, int arg1, int arg2)
{
Window.WIDTH = arg1;
Window.HEIGHT = arg2;
}
});
glfwMakeContextCurrent(m_window);
glfwSwapInterval(0);
glfwShowWindow(m_window);
GL.createCapabilities();
int vao = GL30.glGenVertexArrays ();
GL30.glBindVertexArray (vao);
}
catch (Exception e)
{
e.printStackTrace();
System.exit(0);
}
}