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


Java GL15.glBufferData方法代码示例

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


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

示例1: add

import org.lwjgl.opengl.GL15; //导入方法依赖的package包/类
public void add(float[] vertices, float[] texCoords, int[] indices) {
	indicesSize = indices.length;

	GL30.glBindVertexArray(vao);

	GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo);
	GL15.glBufferData(GL15.GL_ARRAY_BUFFER, Util.flip(vertices), GL15.GL_STATIC_DRAW);
	GL20.glVertexAttribPointer(0, 3, GL11.GL_FLOAT, false, 0, 0);
	GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);

	GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vboTexture);
	GL15.glBufferData(GL15.GL_ARRAY_BUFFER, Util.flip(texCoords), GL15.GL_STATIC_DRAW);
	GL20.glVertexAttribPointer(1, 2, GL11.GL_FLOAT, false, 0, 0);
	GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);

	GL30.glBindVertexArray(0);

	GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, vboi);
	GL15.glBufferData(GL15.GL_ELEMENT_ARRAY_BUFFER, Util.flip(indices), GL15.GL_STATIC_DRAW);
	GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0);
}
 
开发者ID:ComunityEngine,项目名称:CommunityEngine-Java,代码行数:22,代码来源:Mesh.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: storeDataInAttributeList

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

示例4: compile

import org.lwjgl.opengl.GL15; //导入方法依赖的package包/类
/**
 * Compiles a FloatBuffer and binds it to OpenGL for rendering.
 *
 * @param buffer a FloatBuffer populated with VBO vertices
 * @return The original VBO
 */
public VBO compile(FloatBuffer buffer) {
	this.size = buffer.capacity();
	FEATHER.bindBuffer(this.id);
	GL15.glBufferData(GL15.GL_ARRAY_BUFFER, buffer, GL15.GL_STATIC_DRAW);
	FEATHER.bindBuffer(0);
	return this;
}
 
开发者ID:ImpactDevelopment,项目名称:ClientAPI,代码行数:14,代码来源:VBO.java

示例5: initializeWorld

import org.lwjgl.opengl.GL15; //导入方法依赖的package包/类
private void initializeWorld(int renderDistance, int centerX, int centerY, int centerZ, Shader shader) {
	
	playerChunkX = centerX;
	playerChunkZ = centerZ;
	
	//initialize the world
	worldChunks = new int[(renderDistance*2-1)*16*(renderDistance*2-1)];
	worldMetadata = new int[(renderDistance*2-1)*16*(renderDistance*2-1)];
	chunkIdList = new ArrayDeque<Integer>();
	metadataIdList = new ArrayDeque<Integer>();
	for (int i = worldChunks.length; i > 0; i--) {
		chunkIdList.push(i);
	}
	for (int i = worldMetadata.length; i > 0; i--) {
		metadataIdList.push(i);
	}
	
	//update the buffer size
	GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, shader.getChunkSsbo());
	GL15.glBufferData(GL43.GL_SHADER_STORAGE_BUFFER, chunkSize*worldChunks.length*2*4, GL15.GL_DYNAMIC_DRAW);
	
	GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, shader.getMetadataSsbo());
	GL15.glBufferData(GL43.GL_SHADER_STORAGE_BUFFER, chunkSize*worldMetadata.length*4, GL15.GL_DYNAMIC_DRAW);
	GL15.glBindBuffer(GL43.GL_SHADER_STORAGE_BUFFER, 0);
	
	//inform the shader of the new render distance
	int renderDistanceUniform = GL20.glGetUniformLocation(shader.getShaderProgram(), "renderDistance");
	GL20.glUniform1i(renderDistanceUniform, renderDistance-1);
}
 
开发者ID:18107,项目名称:MC-Ray-Tracer,代码行数:30,代码来源:WorldLoader.java

示例6: storeDataInAttributeList

import org.lwjgl.opengl.GL15; //导入方法依赖的package包/类
private void storeDataInAttributeList(int attributeNumber, int coordinateSize, float[] data) {
	int vboID = GL15.glGenBuffers();
	vbos.add(vboID);
	GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vboID);
	FloatBuffer buffer = storeDataInFloatBuffer(data);
	GL15.glBufferData(GL15.GL_ARRAY_BUFFER, buffer, GL15.GL_STATIC_DRAW);	// store data in the buffer - static data after it is stored in VBO
	GL20.glVertexAttribPointer(attributeNumber, coordinateSize, GL11.GL_FLOAT, false, 0, 0);	// store into the VAO
	GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);	// un-bind VBO
}
 
开发者ID:DevipriyaSarkar,项目名称:Terrain,代码行数:10,代码来源:Loader.java

示例7: 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

示例8: glBufferData

import org.lwjgl.opengl.GL15; //导入方法依赖的package包/类
public static void glBufferData(int target, ByteBuffer data, int usage)
{
    if (arbVbo)
    {
        ARBVertexBufferObject.glBufferDataARB(target, data, usage);
    }
    else
    {
        GL15.glBufferData(target, data, usage);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:12,代码来源:OpenGlHelper.java

示例9: 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

示例10: putData

import org.lwjgl.opengl.GL15; //导入方法依赖的package包/类
public VBO putData(IntBuffer buffer, boolean normalized, int usage)
{
	GL15.glBindBuffer(this.target, this.handle);
	GL15.glBufferData(this.target, buffer, usage);
	this.type = GL11.GL_UNSIGNED_INT;
	this.normalized = normalized;
	this.length = buffer.limit();

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

示例11: 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

示例12: storeData

import org.lwjgl.opengl.GL15; //导入方法依赖的package包/类
public void storeData(FloatBuffer data){
	GL15.glBufferData(type, data, GL15.GL_STATIC_DRAW);
}
 
开发者ID:TheThinMatrix,项目名称:OcclusionQueries,代码行数:4,代码来源:Vbo.java

示例13: 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

示例14: allocateData

import org.lwjgl.opengl.GL15; //导入方法依赖的package包/类
public void allocateData(long sizeInBytes){
	GL15.glBufferData(type, sizeInBytes, usage);
}
 
开发者ID:TheThinMatrix,项目名称:LowPolyWater,代码行数:4,代码来源:Vbo.java

示例15: allocateData

import org.lwjgl.opengl.GL15; //导入方法依赖的package包/类
public void allocateData(long sizeInBytes) {
    GL15.glBufferData(type, sizeInBytes, usage);
}
 
开发者ID:GryPLOfficial,项目名称:EcoSystem-Official,代码行数:4,代码来源:Vbo.java


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