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

The following examples show how to use org.lwjgl.opengl.ARBShaderObjects#glGetObjectParameteriARB() . 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: Renderer.java    From FEMultiplayer with GNU General Public License v3.0 6 votes vote down vote up
private static int createShader(String filename, int shaderType) throws Exception {
	int shader = 0;
	try {
     shader = ARBShaderObjects.glCreateShaderObjectARB(shaderType);
     
     if(shader == 0)
     	return 0;
     
     ARBShaderObjects.glShaderSourceARB(shader, readFileAsString(filename));
     ARBShaderObjects.glCompileShaderARB(shader);
     
     if (ARBShaderObjects.glGetObjectParameteriARB(shader, ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB) == GL_FALSE)
         throw new RuntimeException("Error creating shader: " + getLogInfo(shader));
     
     return shader;
	}
	catch(Exception exc) {
		ARBShaderObjects.glDeleteObjectARB(shader);
		throw exc;
	}
}
 
Example 2
Source File: ShaderUtil.java    From Cyberware with MIT License 5 votes vote down vote up
private static int createShader(String filename, int shaderType)
{
	int shader = 0;
	try
	{
		shader = ARBShaderObjects.glCreateShaderObjectARB(shaderType);

		if(shader == 0)
		{
			return 0;
		}

		ARBShaderObjects.glShaderSourceARB(shader, readFileAsString(filename));
		ARBShaderObjects.glCompileShaderARB(shader);

		if (ARBShaderObjects.glGetObjectParameteriARB(shader, ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB) == GL11.GL_FALSE)
			throw new RuntimeException("Error creating shader: " + getLogInfo(shader));

		return shader;
	}
	catch(Exception e)
	{
		ARBShaderObjects.glDeleteObjectARB(shader);
		e.printStackTrace();
		return -1;
	}
}
 
Example 3
Source File: Renderer.java    From FEMultiPlayer-V2 with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates the shader.
 *
 * @param filename the filename
 * @param shaderType the shader type
 * @return the int
 * @throws Exception the exception
 */
/*
* With the exception of syntax, setting up vertex and fragment shaders
* is the same.
* @param the name and path to the vertex shader
*/
private static int createShader(String filename, int shaderType) throws Exception {
	int shader = 0;
	try {
     shader = ARBShaderObjects.glCreateShaderObjectARB(shaderType);
     
     if(shader == 0)
     	return 0;
     
     ARBShaderObjects.glShaderSourceARB(shader, readFileAsString(filename));
     ARBShaderObjects.glCompileShaderARB(shader);
     
     if (ARBShaderObjects.glGetObjectParameteriARB(shader, ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB) == GL_FALSE)
         throw new RuntimeException("Error creating shader: " + getLogInfo(shader));
     
     return shader;
	}
	catch(Exception exc) {
		ARBShaderObjects.glDeleteObjectARB(shader);
		throw exc;
	}
}
 
Example 4
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 5
Source File: ShaderHelper.java    From OpenModsLib with MIT License 4 votes vote down vote up
@Override
public int glGetProgrami(int program, int parameter) {
	return ARBShaderObjects.glGetObjectParameteriARB(program, parameter);
}
 
Example 6
Source File: ShaderHelper.java    From OpenModsLib with MIT License 4 votes vote down vote up
@Override
public int glGetShaderi(int shader, int parameter) {
	return ARBShaderObjects.glGetObjectParameteriARB(shader, parameter);
}