Java Code Examples for org.lwjgl.opengl.ARBShaderObjects#glLinkProgramARB()

The following examples show how to use org.lwjgl.opengl.ARBShaderObjects#glLinkProgramARB() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ShaderUtil.java    From Cyberware with MIT License 4 votes vote down vote up
private static int createShader(String vert, String frag)
{
	int fragid = 0;
	int vertid = 0;
	
	if (frag != null)
	{
		fragid = createShader(frag, FRAG);
	}
	if (vert != null)
	{
		vertid = createShader(vert, VERT);
	}
	
	int program = ARBShaderObjects.glCreateProgramObjectARB();
	if (program == 0)
	{
		return 0;
	}
	
	if (frag != null)
	{
		ARBShaderObjects.glAttachObjectARB(program, fragid);
	}
	
	if (vert != null)
	{
		ARBShaderObjects.glAttachObjectARB(program, vertid);
	}
	
	ARBShaderObjects.glLinkProgramARB(program);
	if(ARBShaderObjects.glGetObjectParameteriARB(program, ARBShaderObjects.GL_OBJECT_LINK_STATUS_ARB) == GL11.GL_FALSE)
	{
		System.out.println("BAD: " + getLogInfo(program));
		return 0;
	}
	
	if (ARBShaderObjects.glGetObjectParameteriARB(program, ARBShaderObjects.GL_OBJECT_VALIDATE_STATUS_ARB) == GL11.GL_FALSE)
	{
		System.out.println("BAD: " + getLogInfo(program));
		return 0;
	}
	
	return program;
}
 
Example 2
Source File: ShaderHelper.java    From OpenModsLib with MIT License 4 votes vote down vote up
@Override
public void glLinkProgram(int program) {
	ARBShaderObjects.glLinkProgramARB(program);
}