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


Java GL15.glGenBuffers方法代码示例

本文整理汇总了Java中org.lwjgl.opengl.GL15.glGenBuffers方法的典型用法代码示例。如果您正苦于以下问题:Java GL15.glGenBuffers方法的具体用法?Java GL15.glGenBuffers怎么用?Java GL15.glGenBuffers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.lwjgl.opengl.GL15的用法示例。


在下文中一共展示了GL15.glGenBuffers方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: store

import org.lwjgl.opengl.GL15; //导入方法依赖的package包/类
/**
    * Store the specified indices into an ElementBufferObject
    * @param indices
    */
   private void store(int[] indices) {
bind();

// Create an id for the ElementBufferObject
int eboid = GL15.glGenBuffers();
// Bind the EBO
GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, eboid);
// Store the data in the EBO
GL15.glBufferData(GL15.GL_ELEMENT_ARRAY_BUFFER, Util.toBuffer(indices), GL15.GL_STATIC_DRAW);

// Add this to the buffer objects for memory management and rendering
addBufferObject(eboid);

unbind();
   }
 
开发者ID:camilne,项目名称:open-world,代码行数:20,代码来源:IndexedVAO.java

示例2: bindIndicesBuffer

import org.lwjgl.opengl.GL15; //导入方法依赖的package包/类
private void bindIndicesBuffer(int[] indices) {
	int vboID = GL15.glGenBuffers();
	vbos.add(vboID);
	GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, vboID);
	IntBuffer buffer = storeDataInIntBuffer(indices);
	GL15.glBufferData(GL15.GL_ELEMENT_ARRAY_BUFFER, buffer, GL15.GL_STATIC_DRAW);
}
 
开发者ID:marcioz98,项目名称:MRCEngine,代码行数:8,代码来源:Loader.java

示例3: store

import org.lwjgl.opengl.GL15; //导入方法依赖的package包/类
/**
    * Stores the specified data into the VAO with a VBO
    * @param data
    * @param dimensions
    */
   private void store(FloatBuffer data, int[] dimensions) {
bind();

// Generate a VBO to hold the data
int vboid = GL15.glGenBuffers();
// Bind the VBO
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vboid);
// Store the data in the VBO
GL15.glBufferData(GL15.GL_ARRAY_BUFFER, data, GL15.GL_STATIC_DRAW);

// Get the stride of the data in bytes
int stride = 0;
if(dimensions.length > 1)
    for(int i = 0; i < dimensions.length; i++) {
	stride += dimensions[i] * 4;
    }

// Determine the number of vertices assuming attribute 0 is position
vertexCount = data.capacity() / dimensions[0];

// Setup data in VBO
int offset = 0;
for(int i = 0; i < dimensions.length; i++) {
    GL20.glVertexAttribPointer(i, dimensions[i], GL11.GL_FLOAT, false, stride, offset);
    offset += dimensions[i] * 4;
}

// Add the vbo to the list of buffer objects for memory management
addBufferObject(vboid);

unbind();
   }
 
开发者ID:camilne,项目名称:open-world,代码行数:38,代码来源:VAO.java

示例4: storeDataInAttributeList

import org.lwjgl.opengl.GL15; //导入方法依赖的package包/类
private void storeDataInAttributeList(final int attributeNumber, final int coordinateSize, final float[] data) {
    int vboId = GL15.glGenBuffers();
    vbos.add(vboId);
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vboId);
    GL15.glBufferData(GL15.GL_ARRAY_BUFFER, storeDataInFloatBuffer(data), GL15.GL_STATIC_DRAW);
    GL20.glVertexAttribPointer(attributeNumber, coordinateSize, GL11.GL_FLOAT, false, 0, 0);
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
}
 
开发者ID:Biacode,项目名称:bia-engine,代码行数:9,代码来源:Loader.java

示例5: VertexArrayObject

import org.lwjgl.opengl.GL15; //导入方法依赖的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

示例6: VBO

import org.lwjgl.opengl.GL15; //导入方法依赖的package包/类
public VBO(int target)
{
	this.target = target;

	this.handle = GL15.glGenBuffers();
	this.normalized = false;
	this.length = 0;

	VBOS.add(this);
}
 
开发者ID:andykuo1,项目名称:candlelight,代码行数:11,代码来源:VBO.java

示例7: createShaderProgram

import org.lwjgl.opengl.GL15; //导入方法依赖的package包/类
public void createShaderProgram(RenderMethod renderMethod) {
	shaderProgram = GL20.glCreateProgram();
	vshader = createShader(vertexShader, GL20.GL_VERTEX_SHADER);
	fshader = createShader(renderMethod.getFragmentShader(), GL20.GL_FRAGMENT_SHADER);
	GL20.glAttachShader(shaderProgram, vshader);
	GL20.glAttachShader(shaderProgram, fshader);
	GL20.glBindAttribLocation(shaderProgram, 0, "vertex");
	GL30.glBindFragDataLocation(shaderProgram, 0, "color");
	GL20.glLinkProgram(shaderProgram);
	int linked = GL20.glGetProgrami(shaderProgram, GL20.GL_LINK_STATUS);
	String programLog = GL20.glGetProgramInfoLog(shaderProgram, GL20.glGetProgrami(shaderProgram, GL20.GL_INFO_LOG_LENGTH));
	if (programLog.trim().length() > 0) {
		System.err.println(programLog);
	}
	if (linked == 0) {
		throw new AssertionError("Could not link program");
	}
	
	//init vbo
	vbo = GL15.glGenBuffers();
	GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo);
	ByteBuffer bb = BufferUtils.createByteBuffer(2 * 6);
	bb.put((byte) -1).put((byte) -1);
	bb.put((byte) 1).put((byte) -1);
	bb.put((byte) 1).put((byte) 1);
	bb.put((byte) 1).put((byte) 1);
	bb.put((byte) -1).put((byte) 1);
	bb.put((byte) -1).put((byte) -1);
	bb.flip();
	GL15.glBufferData(GL15.GL_ARRAY_BUFFER, bb, GL15.GL_STATIC_DRAW);
	GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
}
 
开发者ID:shaunlebron,项目名称:flex-fov,代码行数:33,代码来源:Shader.java

示例8: glGenBuffers

import org.lwjgl.opengl.GL15; //导入方法依赖的package包/类
public static int glGenBuffers()
{
    return arbVbo ? ARBVertexBufferObject.glGenBuffersARB() : GL15.glGenBuffers();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:OpenGlHelper.java

示例9: createShaderProgram

import org.lwjgl.opengl.GL15; //导入方法依赖的package包/类
public void createShaderProgram() {
	shaderProgram = GL20.glCreateProgram();
	vShader = createShader(vertexShader, GL20.GL_VERTEX_SHADER);
	fShader = createShader(fragmentShader, GL20.GL_FRAGMENT_SHADER);
	
	GL20.glAttachShader(shaderProgram, vShader);
	GL20.glAttachShader(shaderProgram, fShader);
	GL20.glBindAttribLocation(shaderProgram, 0, "vertex");
	GL30.glBindFragDataLocation(shaderProgram, 0, "color");
	GL20.glLinkProgram(shaderProgram);
	
	GL20.glDetachShader(shaderProgram, vShader);
	GL20.glDetachShader(shaderProgram, fShader);
	GL20.glDeleteShader(vShader);
	vShader = 0;
	GL20.glDeleteShader(fShader);
	fShader = 0;
	
	int linked = GL20.glGetProgrami(shaderProgram, GL20.GL_LINK_STATUS);
	String programLog = GL20.glGetProgramInfoLog(shaderProgram, GL20.glGetProgrami(shaderProgram, GL20.GL_INFO_LOG_LENGTH));
	if (programLog.trim().length() > 0) {
		System.err.println(programLog);
	}
	if (linked == 0) {
		throw new AssertionError("Could not link program");
	}
	
	//init vbo
	vbo = GL15.glGenBuffers();
	GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo);
	ByteBuffer bb = BufferUtils.createByteBuffer(2 * 6);
	bb.put((byte) -1).put((byte) -1);
	bb.put((byte) 1).put((byte) -1);
	bb.put((byte) 1).put((byte) 1);
	bb.put((byte) 1).put((byte) 1);
	bb.put((byte) -1).put((byte) 1);
	bb.put((byte) -1).put((byte) -1);
	bb.flip();
	GL15.glBufferData(GL15.GL_ARRAY_BUFFER, bb, GL15.GL_STATIC_DRAW);
	GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
	
	worldChunkSsbo = GL15.glGenBuffers();
	chunkSsbo = GL15.glGenBuffers();
	worldMetadataSsbo = GL15.glGenBuffers();
	metadataSsbo = GL15.glGenBuffers();
	
	GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, worldChunkSsbo);
	GL15.glBufferData(GL43.GL_SHADER_STORAGE_BUFFER, 0, GL15.GL_DYNAMIC_DRAW);
	GL30.glBindBufferBase(GL43.GL_SHADER_STORAGE_BUFFER, 2, worldChunkSsbo);
	
	GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, chunkSsbo);
	GL15.glBufferData(GL43.GL_SHADER_STORAGE_BUFFER, 0, GL15.GL_DYNAMIC_DRAW);
	GL30.glBindBufferBase(GL43.GL_SHADER_STORAGE_BUFFER, 3, chunkSsbo);
	
	GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, worldMetadataSsbo);
	GL15.glBufferData(GL43.GL_SHADER_STORAGE_BUFFER, 0, GL15.GL_DYNAMIC_DRAW);
	GL30.glBindBufferBase(GL43.GL_SHADER_STORAGE_BUFFER, 4, worldMetadataSsbo);
	
	GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, metadataSsbo);
	GL15.glBufferData(GL43.GL_SHADER_STORAGE_BUFFER, 0, GL15.GL_DYNAMIC_DRAW);
	GL30.glBindBufferBase(GL43.GL_SHADER_STORAGE_BUFFER, 5, metadataSsbo);
	GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, 0);
}
 
开发者ID:18107,项目名称:MC-Ray-Tracer,代码行数:64,代码来源:Shader.java

示例10: create

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

示例11: create

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

示例12: create

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

示例13: Mesh

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

示例14: FrameBufferObject

import org.lwjgl.opengl.GL15; //导入方法依赖的package包/类
public FrameBufferObject(){
    int width = Main.WIDTH;
    int height = Main.HEIGHT;
    this.fbo = glGenFramebuffers();
    glBindFramebuffer(GL_FRAMEBUFFER, fbo);

    //Creation de la texture qui va contenir la sortie RGB du shader
    int renderedTexture = glGenTextures();
    glBindTexture(GL_TEXTURE_2D, renderedTexture);
    glTexImage2D(GL_TEXTURE_2D, 0,GL_RGB, width, height, 0,GL_RGB, GL_UNSIGNED_BYTE, 0);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

    //Creation du tampon de profondeur
    int depthrenderbuffer = glGenRenderbuffers();
    glBindRenderbuffer(GL_RENDERBUFFER, depthrenderbuffer);
    glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, width, height);
    glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthrenderbuffer);

    //Definir le render Texture
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,GL_TEXTURE_2D, renderedTexture, 0);
    if(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
        throw new IllegalStateException("FBO not loaded !");
    fboTexID = renderedTexture;
    renderID = depthrenderbuffer;


    this.vbo = GL15.glGenBuffers();
    float[] a = new float[]{
            0,0,        0.0f,0.0f,
            1,0,         1.0f,0.0f,
            1,1,          1.0f,1.0f,
            0,1,         0.0f,1.0f
    };
    FloatBuffer buffer = BufferUtils.createFloatBuffer(a.length);
    buffer.put(a).flip();
    size = a.length/(2+2);

    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo);
    GL15.glBufferData(GL15.GL_ARRAY_BUFFER, buffer, GL15.GL_STATIC_DRAW);

    GL20.glEnableVertexAttribArray(Shaders.MAIN_SHADERS.getAttribLocation("vert"));
    GL20.glVertexAttribPointer(Shaders.MAIN_SHADERS.getAttribLocation("vert"), 2, GL11.GL_FLOAT, false, (2+2)*4, 0);

    GL20.glEnableVertexAttribArray(Shaders.MAIN_SHADERS.getAttribLocation("vertTexCoord"));
    GL20.glVertexAttribPointer(Shaders.MAIN_SHADERS.getAttribLocation("vertTexCoord"), 2, GL11.GL_FLOAT, true, (2+2)*4, 2*4);

    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
}
 
开发者ID:mrdev023,项目名称:Global-Gam-Jam-2017,代码行数:50,代码来源:FrameBufferObject.java


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