當前位置: 首頁>>代碼示例>>Java>>正文


Java GL20.glLinkProgram方法代碼示例

本文整理匯總了Java中org.lwjgl.opengl.GL20.glLinkProgram方法的典型用法代碼示例。如果您正苦於以下問題:Java GL20.glLinkProgram方法的具體用法?Java GL20.glLinkProgram怎麽用?Java GL20.glLinkProgram使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.lwjgl.opengl.GL20的用法示例。


在下文中一共展示了GL20.glLinkProgram方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ShaderProgram

import org.lwjgl.opengl.GL20; //導入方法依賴的package包/類
public ShaderProgram(MyFile vertexFile, MyFile geometryFile, MyFile fragmentFile, String... inVariables) {
    int vertexShaderID = loadShader(vertexFile, GL20.GL_VERTEX_SHADER);
    int geometryShaderID = loadShader(geometryFile, GL32.GL_GEOMETRY_SHADER);
    int fragmentShaderID = loadShader(fragmentFile, GL20.GL_FRAGMENT_SHADER);
    programID = GL20.glCreateProgram();
    GL20.glAttachShader(programID, vertexShaderID);
    GL20.glAttachShader(programID, geometryShaderID);
    GL20.glAttachShader(programID, fragmentShaderID);
    bindAttributes(inVariables);
    GL20.glLinkProgram(programID);
    GL20.glDetachShader(programID, vertexShaderID);
    GL20.glDetachShader(programID, geometryShaderID);
    GL20.glDetachShader(programID, fragmentShaderID);
    GL20.glDeleteShader(vertexShaderID);
    GL20.glDeleteShader(geometryShaderID);
    GL20.glDeleteShader(fragmentShaderID);
}
 
開發者ID:GryPLOfficial,項目名稱:EcoSystem-Official,代碼行數:18,代碼來源:ShaderProgram.java

示例2: ShaderProgram

import org.lwjgl.opengl.GL20; //導入方法依賴的package包/類
public ShaderProgram(MyFile vertexFile, MyFile geometryFile, MyFile fragmentFile, String... inVariables) {
	int vertexShaderID = loadShader(vertexFile, GL20.GL_VERTEX_SHADER);
	int geometryShaderID = loadShader(geometryFile, GL32.GL_GEOMETRY_SHADER);
	int fragmentShaderID = loadShader(fragmentFile, GL20.GL_FRAGMENT_SHADER);
	programID = GL20.glCreateProgram();
	GL20.glAttachShader(programID, vertexShaderID);
	GL20.glAttachShader(programID, geometryShaderID);
	GL20.glAttachShader(programID, fragmentShaderID);
	bindAttributes(inVariables);
	GL20.glLinkProgram(programID);
	GL20.glDetachShader(programID, vertexShaderID);
	GL20.glDetachShader(programID, geometryShaderID);
	GL20.glDetachShader(programID, fragmentShaderID);
	GL20.glDeleteShader(vertexShaderID);
	GL20.glDeleteShader(geometryShaderID);
	GL20.glDeleteShader(fragmentShaderID);
}
 
開發者ID:TheThinMatrix,項目名稱:LowPolyWater,代碼行數:18,代碼來源:ShaderProgram.java

示例3: ShaderProgram

import org.lwjgl.opengl.GL20; //導入方法依賴的package包/類
/**
 * @param shaders list of shaders to use in program
 */
public ShaderProgram(Shader ... shaders) {
	id = GL20.glCreateProgram();
	this.shaders = shaders;
	
	// Attach shaders
	for (Shader shader : shaders) {
		GL20.glAttachShader(id, shader.id);
	}
	
	// Link
	GL20.glLinkProgram(id);
	if (GL20.glGetProgrami(id, GL20.GL_LINK_STATUS) == GL11.GL_FALSE) {
		throw new Error("Failed to link shader program.");
	}
		   
	// Validate
	GL20.glValidateProgram(id);
	if (GL20.glGetProgrami(id, GL20.GL_VALIDATE_STATUS) == GL11.GL_FALSE) {
		throw new Error("Failed to validate shader program.");
	}
}
 
開發者ID:tacocat,項目名稱:lambda,代碼行數:25,代碼來源:ShaderProgram.java

示例4: Shader

import org.lwjgl.opengl.GL20; //導入方法依賴的package包/類
/**
    * Creates a shader with the specified file name.
    * @param name The filename of the shader as found in the specified PATH with the specified extensions
    */
   public Shader(String name) throws IOException {
// Create the program id
pid = GL20.glCreateProgram();

// Instantiate the uniform lookup
uniforms = new HashMap<String, Integer>();

// Add the vertex shader to the program
String vertSource = addShader(GL20.GL_VERTEX_SHADER, path + name + "." + vertexExtension);
// Add the fragment shader to the program
String fragSource = addShader(GL20.GL_FRAGMENT_SHADER, path + name + "." + fragmentExtension);

// Link the program
GL20.glLinkProgram(pid);
// Check if linking was successful
closeIfProgramError(GL20.glGetProgrami(pid, GL20.GL_LINK_STATUS) == 0, pid);

// Validate the program
GL20.glValidateProgram(pid);
// Check if validation was successful
closeIfProgramError(GL20.glGetProgrami(pid, GL20.GL_VALIDATE_STATUS) == 0, pid);

// Bind the shader
bind();

// Automatically add uniforms
autoAddUniforms(vertSource);
autoAddUniforms(fragSource);
   }
 
開發者ID:camilne,項目名稱:open-world,代碼行數:34,代碼來源:Shader.java

示例5: ShaderProgram

import org.lwjgl.opengl.GL20; //導入方法依賴的package包/類
public ShaderProgram(final String vertexFile, final String fragmentFle) {
    LOGGER.debug("Initializing shader program for vertex - {} and fragment - {}", vertexFile, fragmentFle);
    vertShaderId = loadShader(vertexFile, GL20.GL_VERTEX_SHADER);
    fragShaderId = loadShader(fragmentFle, GL20.GL_FRAGMENT_SHADER);
    programId = GL20.glCreateProgram();
    GL20.glAttachShader(programId, vertShaderId);
    GL20.glAttachShader(programId, fragShaderId);
    bindAttributes();
    GL20.glLinkProgram(programId);
    GL20.glValidateProgram(programId);
    LOGGER.debug("Initialized shader - {} vertex - {} fragment - {}", programId, vertShaderId, fragShaderId);
    getAllUniformLocations();
}
 
開發者ID:Biacode,項目名稱:bia-engine,代碼行數:14,代碼來源:ShaderProgram.java

示例6: glLinkProgram

import org.lwjgl.opengl.GL20; //導入方法依賴的package包/類
public static void glLinkProgram(int program)
{
    if (arbShaders)
    {
        ARBShaderObjects.glLinkProgramARB(program);
    }
    else
    {
        GL20.glLinkProgram(program);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:12,代碼來源:OpenGlHelper.java

示例7: ShaderProgram

import org.lwjgl.opengl.GL20; //導入方法依賴的package包/類
/**
 * Loads shader files and binds them the this program.
 * @param vertexFile - Vertex Shader location
 * @param fragmentFile - Fragment Shader location
 */
public ShaderProgram(String vertexFile, String fragmentFile) {
    vertexShaderID = loadShader(vertexFile, GL20.GL_VERTEX_SHADER);
    fragmentShaderID = loadShader(fragmentFile, GL20.GL_FRAGMENT_SHADER);

    programID = GL20.glCreateProgram();
    GL20.glAttachShader(programID, vertexShaderID);
    GL20.glAttachShader(programID, fragmentShaderID);
    bindAttributes();
    GL20.glLinkProgram(programID);
    GL20.glValidateProgram(programID);
    initUniforms();
}
 
開發者ID:Essentria,項目名稱:Elgin-Plant-Game,代碼行數:18,代碼來源:ShaderProgram.java

示例8: ShaderProgram

import org.lwjgl.opengl.GL20; //導入方法依賴的package包/類
public ShaderProgram(MyFile vertexFile, MyFile fragmentFile, String... inVariables) {
	int vertexShaderID = loadShader(vertexFile, GL20.GL_VERTEX_SHADER);
	int fragmentShaderID = loadShader(fragmentFile, GL20.GL_FRAGMENT_SHADER);
	programID = GL20.glCreateProgram();
	GL20.glAttachShader(programID, vertexShaderID);
	GL20.glAttachShader(programID, fragmentShaderID);
	bindAttributes(inVariables);
	GL20.glLinkProgram(programID);
	GL20.glDetachShader(programID, vertexShaderID);
	GL20.glDetachShader(programID, fragmentShaderID);
	GL20.glDeleteShader(vertexShaderID);
	GL20.glDeleteShader(fragmentShaderID);
}
 
開發者ID:TheThinMatrix,項目名稱:OcclusionQueries,代碼行數:14,代碼來源:ShaderProgram.java

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

示例10: ShaderProgram

import org.lwjgl.opengl.GL20; //導入方法依賴的package包/類
public ShaderProgram(String vertexFile, String fragmentFile) {
	vertexShaderID = loadShader(vertexFile, GL20.GL_VERTEX_SHADER);
	fragmentShaderID = loadShader(fragmentFile, GL20.GL_FRAGMENT_SHADER);
	programID = GL20.glCreateProgram();
	GL20.glAttachShader(programID, vertexShaderID);
	GL20.glAttachShader(programID, fragmentShaderID);
	bindAttributes();
	GL20.glLinkProgram(programID);
	GL20.glValidateProgram(programID);
	getAllUniformLocations();
}
 
開發者ID:DevipriyaSarkar,項目名稱:Terrain,代碼行數:12,代碼來源:ShaderProgram.java

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

示例12: linkAndValidate

import org.lwjgl.opengl.GL20; //導入方法依賴的package包/類
public void linkAndValidate() {
	GL20.glLinkProgram(program);
	GL20.glValidateProgram(program);
}
 
開發者ID:ComunityEngine,項目名稱:CommunityEngine-Java,代碼行數:5,代碼來源:Shader.java


注:本文中的org.lwjgl.opengl.GL20.glLinkProgram方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。