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


Java GL20.glGetShaderi方法代码示例

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


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

示例1: createShader

import org.lwjgl.opengl.GL20; //导入方法依赖的package包/类
public int createShader(String fileName, int type) {
	int shader = OpenGlHelper.glCreateShader(type);

	if (shader != 0) {
		ARBShaderObjects.glShaderSourceARB(shader, readFile(fileName));

		OpenGlHelper.glCompileShader(shader);
		OpenGlHelper.glCompileShader(shader);

		if (GL20.glGetShaderi(shader, OpenGlHelper.GL_COMPILE_STATUS) == GL11.GL_FALSE) {
			throw new RuntimeException("Error creating shader: " + getLogInfo(shader));
		}
	}

	return shader;
}
 
开发者ID:the-realest-stu,项目名称:Etheric,代码行数:17,代码来源:ShaderHandler.java

示例2: loadShader

import org.lwjgl.opengl.GL20; //导入方法依赖的package包/类
private int loadShader(MyFile file, int type) {
	StringBuilder shaderSource = new StringBuilder();
	try {
		BufferedReader reader = file.getReader();
		String line;
		while ((line = reader.readLine()) != null) {
			shaderSource.append(line).append("//\n");
		}
		reader.close();
	} catch (Exception e) {
		System.err.println("Could not read file.");
		e.printStackTrace();
		System.exit(-1);
	}
	int shaderID = GL20.glCreateShader(type);
	GL20.glShaderSource(shaderID, shaderSource);
	GL20.glCompileShader(shaderID);
	if (GL20.glGetShaderi(shaderID, GL20.GL_COMPILE_STATUS) == GL11.GL_FALSE) {
		System.out.println(GL20.glGetShaderInfoLog(shaderID, 500));
		System.err.println("Could not compile shader "+ file);
		System.exit(-1);
	}
	return shaderID;
}
 
开发者ID:TheThinMatrix,项目名称:LowPolyWater,代码行数:25,代码来源:ShaderProgram.java

示例3: Shader

import org.lwjgl.opengl.GL20; //导入方法依赖的package包/类
/**
 * @param filename location for shader source code
 * @param type GL20.GL_VERTEX_SHADER or GL20.GL_FRAGMENT_SHADER
 */
public Shader(String filename, int type) {
	// Load shader source as a string
	StringBuilder source = loadFromFile(filename);
	
	// Create and compile shader
    id = glCreateShader(type);
    glShaderSource(id, source);
    glCompileShader(id);
    
    // Check for compilation errors
    if (GL20.glGetShaderi(id, GL20.GL_COMPILE_STATUS) == GL11.GL_FALSE) {
    	System.err.println(GL20.glGetShaderInfoLog(id));
    	throw new Error("Shader compilation failed: " + filename);
    }
}
 
开发者ID:tacocat,项目名称:lambda,代码行数:20,代码来源:Shader.java

示例4: loadShader

import org.lwjgl.opengl.GL20; //导入方法依赖的package包/类
/**
 * reads shader from file.
 * @param file - File path
 * @param type - Shader type
 * @return - Shader ID to bind to program.
 */
private static int loadShader(String file, int type) {
    StringBuilder shaderSource = new StringBuilder();
    try {
        InputStream in = Class.class.getResourceAsStream(file);
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        String line;
        while ((line = reader.readLine()) != null) {
            shaderSource.append(line).append("//\n");
        }
        reader.close();
    } catch (IOException e) {
        e.printStackTrace();
        System.exit(-1);
    }
    int shaderID = GL20.glCreateShader(type);
    GL20.glShaderSource(shaderID, shaderSource);
    GL20.glCompileShader(shaderID);
    if (GL20.glGetShaderi(shaderID, GL20.GL_COMPILE_STATUS) == GL11.GL_FALSE) {
        System.out.println(GL20.glGetShaderInfoLog(shaderID, 500));
        System.err.println("Could not compile shader!");
        System.exit(-1);
    }
    return shaderID;
}
 
开发者ID:Essentria,项目名称:Elgin-Plant-Game,代码行数:31,代码来源:ShaderProgram.java

示例5: printShaderLogInfo

import org.lwjgl.opengl.GL20; //导入方法依赖的package包/类
private static boolean printShaderLogInfo(int shader, String name)
{
    IntBuffer intbuffer = BufferUtils.createIntBuffer(1);
    int i = GL20.glGetShaderi(shader, 35716);

    if (i > 1)
    {
        String s = GL20.glGetShaderInfoLog(shader, i);
        SMCLog.info("Shader info log: " + name + "\n" + s);
        return false;
    }
    else
    {
        return true;
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:17,代码来源:Shaders.java

示例6: Shader

import org.lwjgl.opengl.GL20; //导入方法依赖的package包/类
public Shader(String source, int type)
{
	this.type = type;

	this.handle = GL20.glCreateShader(this.type);
	if (this.handle == 0)
	{
		throw new GLException("Unable to create main.shader!");
	}

	GL20.glShaderSource(this.handle, source);
	GL20.glCompileShader(this.handle);

	int status = GL20.glGetShaderi(this.handle, GL20.GL_COMPILE_STATUS);
	if (status == GL11.GL_FALSE)
	{
		String infolog = GL20.glGetShaderInfoLog(this.handle);
		GL20.glDeleteShader(this.handle);
		this.handle = 0;

		throw new GLException(infolog);
	}

	SHADERS.add(this);
}
 
开发者ID:andykuo1,项目名称:candlelight,代码行数:26,代码来源:Shader.java

示例7: loadShader

import org.lwjgl.opengl.GL20; //导入方法依赖的package包/类
private static int loadShader(String file, int type) {
	StringBuilder shaderSource = new StringBuilder();
	try {
		InputStream in = Class.class.getResourceAsStream(file);
		BufferedReader reader = new BufferedReader(new InputStreamReader(in));
		String line;
		while ((line = reader.readLine()) != null) {
			shaderSource.append(line).append("//\n");
		}
		reader.close();
	} catch (IOException e) {
		e.printStackTrace();
		System.exit(-1);
	}
	int shaderID = GL20.glCreateShader(type);
	GL20.glShaderSource(shaderID, shaderSource);
	GL20.glCompileShader(shaderID);
	if (GL20.glGetShaderi(shaderID, GL20.GL_COMPILE_STATUS) == GL11.GL_FALSE) {
		System.out.println(GL20.glGetShaderInfoLog(shaderID, 500));
		System.err.println("Could not compile shader!");
		System.exit(-1);
	}
	return shaderID;
}
 
开发者ID:DevipriyaSarkar,项目名称:Terrain,代码行数:25,代码来源:ShaderProgram.java

示例8: printShaderLogInfo

import org.lwjgl.opengl.GL20; //导入方法依赖的package包/类
private static boolean printShaderLogInfo(int shader, String name, List<String> listFiles)
{
    IntBuffer intbuffer = BufferUtils.createIntBuffer(1);
    int i = GL20.glGetShaderi(shader, 35716);

    if (i <= 1)
    {
        return true;
    }
    else
    {
        for (int j = 0; j < listFiles.size(); ++j)
        {
            String s = (String)listFiles.get(j);
            SMCLog.info("File: " + (j + 1) + " = " + s);
        }

        String s1 = GL20.glGetShaderInfoLog(shader, i);
        SMCLog.info("Shader info log: " + name + "\n" + s1);
        return false;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:23,代码来源:Shaders.java

示例9: loadShader

import org.lwjgl.opengl.GL20; //导入方法依赖的package包/类
private int loadShader(MyFile file, int type) {
    StringBuilder shaderSource = new StringBuilder();
    try {
        BufferedReader reader = file.getReader();
        String line;
        while ((line = reader.readLine()) != null) {
            shaderSource.append(line).append("//\n");
        }
        reader.close();
    } catch (Exception e) {
        System.err.println("Could not read file.");
        e.printStackTrace();
        System.exit(-1);
    }
    int shaderID = GL20.glCreateShader(type);
    GL20.glShaderSource(shaderID, shaderSource);
    GL20.glCompileShader(shaderID);
    if (GL20.glGetShaderi(shaderID, GL20.GL_COMPILE_STATUS) == GL11.GL_FALSE) {
        System.out.println(GL20.glGetShaderInfoLog(shaderID, 500));
        System.err.println("Could not compile shader " + file);
        System.exit(-1);
    }
    return shaderID;
}
 
开发者ID:GryPLOfficial,项目名称:EcoSystem-Official,代码行数:25,代码来源:ShaderProgram.java

示例10: createShader

import org.lwjgl.opengl.GL20; //导入方法依赖的package包/类
private int createShader(String resource, int type) {
	int shader = GL20.glCreateShader(type);
	GL20.glShaderSource(shader, resource);
	GL20.glCompileShader(shader);
	int compiled = GL20.glGetShaderi(shader, GL20.GL_COMPILE_STATUS);
	String shaderLog = GL20.glGetShaderInfoLog(shader, GL20.glGetShaderi(shader, GL20.GL_INFO_LOG_LENGTH));
	if (shaderLog.trim().length() > 0) {
		System.err.println(shaderLog);
	}
	if (compiled == 0) {
		throw new AssertionError("Could not compile shader");
	}
	return shader;
}
 
开发者ID:18107,项目名称:MC-Ray-Tracer,代码行数:15,代码来源:Shader.java

示例11: loadShader

import org.lwjgl.opengl.GL20; //导入方法依赖的package包/类
private static int loadShader(String file, int type) {
    int shaderID = GL20.glCreateShader(type);
    GL20.glShaderSource(shaderID, FileLoadUtils.loadFileSource(file));
    GL20.glCompileShader(shaderID);
    if (GL20.glGetShaderi(shaderID, GL20.GL_COMPILE_STATUS) == GL11.GL_FALSE) {
        final String glGetShaderInfoLog = GL20.glGetShaderInfoLog(shaderID, 500);
        LOGGER.error("Can not compile shader - {}", glGetShaderInfoLog);
        throw new IllegalArgumentException("Can not compile shader - " + glGetShaderInfoLog);
    }
    return shaderID;
}
 
开发者ID:Biacode,项目名称:bia-engine,代码行数:12,代码来源:ShaderProgram.java

示例12: glGetShaderi

import org.lwjgl.opengl.GL20; //导入方法依赖的package包/类
public static int glGetShaderi(int shaderIn, int pname)
{
    return arbShaders ? ARBShaderObjects.glGetObjectParameteriARB(shaderIn, pname) : GL20.glGetShaderi(shaderIn, pname);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:OpenGlHelper.java


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