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


Java GL20.glBindAttribLocation方法代码示例

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


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

示例1: createShaderProgram

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

示例2: bindAttribute

import org.lwjgl.opengl.GL20; //导入方法依赖的package包/类
protected void bindAttribute(int attribute, String variableName) {
	GL20.glBindAttribLocation(programID, attribute, variableName);
}
 
开发者ID:marcioz98,项目名称:MRCEngine,代码行数:4,代码来源:ShaderProgram.java

示例3: createShaderProgram

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

示例4: bindAttribute

import org.lwjgl.opengl.GL20; //导入方法依赖的package包/类
protected void bindAttribute(final int attribute, final String variableName) {
    GL20.glBindAttribLocation(programId, attribute, variableName);
}
 
开发者ID:Biacode,项目名称:bia-engine,代码行数:4,代码来源:ShaderProgram.java

示例5: bindAttributes

import org.lwjgl.opengl.GL20; //导入方法依赖的package包/类
private void bindAttributes(String[] inVariables){
	for(int i=0;i<inVariables.length;i++){
		GL20.glBindAttribLocation(programID, i, inVariables[i]);
	}
}
 
开发者ID:TheThinMatrix,项目名称:LowPolyWater,代码行数:6,代码来源:ShaderProgram.java

示例6: bindAttribLocation

import org.lwjgl.opengl.GL20; //导入方法依赖的package包/类
public void bindAttribLocation(int index, String name) {
	GL20.glBindAttribLocation(program, index, name);
}
 
开发者ID:ComunityEngine,项目名称:CommunityEngine-Java,代码行数:4,代码来源:Shader.java

示例7: bindAttributes

import org.lwjgl.opengl.GL20; //导入方法依赖的package包/类
private void bindAttributes(String[] inVariables) {
    for (int i = 0; i < inVariables.length; i++) {
        GL20.glBindAttribLocation(programID, i, inVariables[i]);
    }
}
 
开发者ID:GryPLOfficial,项目名称:EcoSystem-Official,代码行数:6,代码来源:ShaderProgram.java

示例8: bindAttribute

import org.lwjgl.opengl.GL20; //导入方法依赖的package包/类
/**
    * Binds an attribute to this shader
    * @param index The index of the attribute
    * @param name The name of the attribute
    */
   public void bindAttribute(int index, String name) {
GL20.glBindAttribLocation(pid, index, name);
   }
 
开发者ID:camilne,项目名称:open-world,代码行数:9,代码来源:Shader.java

示例9: bindAttribute

import org.lwjgl.opengl.GL20; //导入方法依赖的package包/类
/**
 * ???
 * @param name
 * @param location
 */
public void bindAttribute(String name, int location) {
	GL20.glBindAttribLocation(id, location, name);
}
 
开发者ID:tacocat,项目名称:lambda,代码行数:9,代码来源:ShaderProgram.java

示例10: bindAttribute

import org.lwjgl.opengl.GL20; //导入方法依赖的package包/类
/**
 * Binds attribute to program for use in vertex shader
 * @param attribute - Attribute index
 * @param varName - Variable name
 */
protected void bindAttribute(int attribute, String varName) {
    GL20.glBindAttribLocation(programID, attribute, varName);
}
 
开发者ID:Essentria,项目名称:Elgin-Plant-Game,代码行数:9,代码来源:ShaderProgram.java


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