当前位置: 首页>>代码示例>>Java>>正文


Java GL30.glGenVertexArrays方法代码示例

本文整理汇总了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);
   }
 
开发者ID:camilne,项目名称:open-world,代码行数:18,代码来源:VAO.java

示例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);
}
 
开发者ID:tacocat,项目名称:lambda,代码行数:40,代码来源:VertexArrayObject.java

示例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);
}
 
开发者ID:andykuo1,项目名称:candlelight,代码行数:10,代码来源:Mesh.java

示例4: createVAO

import org.lwjgl.opengl.GL30; //导入方法依赖的package包/类
private int createVAO() {
	int vaoID = GL30.glGenVertexArrays(); 
	GL30.glBindVertexArray(vaoID);
	return vaoID;
}
 
开发者ID:marcioz98,项目名称:MRCEngine,代码行数:6,代码来源:Loader.java

示例5: createVao

import org.lwjgl.opengl.GL30; //导入方法依赖的package包/类
private int createVao() {
    int vaoId = GL30.glGenVertexArrays();
    vaos.add(vaoId);
    GL30.glBindVertexArray(vaoId);
    return vaoId;
}
 
开发者ID:Biacode,项目名称:bia-engine,代码行数:7,代码来源:Loader.java

示例6: create

import org.lwjgl.opengl.GL30; //导入方法依赖的package包/类
public static Vao create() {
	int id = GL30.glGenVertexArrays();
	return new Vao(id);
}
 
开发者ID:TheThinMatrix,项目名称:LowPolyWater,代码行数:5,代码来源:Vao.java

示例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);
}
 
开发者ID:tek256,项目名称:LD38,代码行数:60,代码来源:Quad.java

示例8: Mesh

import org.lwjgl.opengl.GL30; //导入方法依赖的package包/类
public Mesh() {
	vao = GL30.glGenVertexArrays();
	vbo = GL15.glGenBuffers();
	vboTexture = GL15.glGenBuffers();
	vboi = GL15.glGenBuffers();
}
 
开发者ID:ComunityEngine,项目名称:CommunityEngine-Java,代码行数:7,代码来源:Mesh.java

示例9: createVAO

import org.lwjgl.opengl.GL30; //导入方法依赖的package包/类
private int createVAO() {
	int vaoID = GL30.glGenVertexArrays();
	vaos.add(vaoID);
	GL30.glBindVertexArray(vaoID);
	return vaoID;
}
 
开发者ID:DevipriyaSarkar,项目名称:Terrain,代码行数:7,代码来源:Loader.java

示例10: create

import org.lwjgl.opengl.GL30; //导入方法依赖的package包/类
public static Vao create() {
    int id = GL30.glGenVertexArrays();
    return new Vao(id);
}
 
开发者ID:GryPLOfficial,项目名称:EcoSystem-Official,代码行数:5,代码来源:Vao.java

示例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);
	}
}
 
开发者ID:RagnarrIvarssen,项目名称:Assimp-Tutorial-LWJGL-3,代码行数:49,代码来源:Window.java


注:本文中的org.lwjgl.opengl.GL30.glGenVertexArrays方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。