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


Java GL11.GL_FALSE属性代码示例

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


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

示例1: createShader

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,代码行数:16,代码来源:ShaderHandler.java

示例2: loadShader

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,代码行数:24,代码来源:ShaderProgram.java

示例3: ShaderProgram

/**
 * @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,代码行数:24,代码来源:ShaderProgram.java

示例4: Shader

/**
 * @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,代码行数:19,代码来源:Shader.java

示例5: createShader

/** Create a shader by type and file
 *  
 * @param type type of shader (vertex or fragment)
 * @param path path to shader file
 * @return a shader id
 */
private int createShader(int type, String path){
	//create the shader id
	int id = glCreateShader(type);
	
	//get and place the source to the shader
	glShaderSource(id, ResourceLoader.getText(path));
	
	//compile the shader
	glCompileShader(id);
	
	//check for compilation issues, if present, output them
	if(glGetShaderi(id, GL_COMPILE_STATUS) == GL11.GL_FALSE){
		System.err.println(glGetShaderInfoLog(id, 1024));
		//don't leak the shader
		glDeleteShader(id);
	}
	
	return id;
}
 
开发者ID:tek256,项目名称:LD38,代码行数:25,代码来源:Shader.java

示例6: loadShader

/**
 * 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,代码行数:30,代码来源:ShaderProgram.java

示例7: create

public static int create(IResourceManager manager, @Nullable ResourceLocation vsh, @Nullable ResourceLocation fsh) {
	int vshId = 0, fshId = 0, program = 0;
	if(vsh != null) {
		vshId = parse(manager, vsh, VERTEX);
	}
	if(fsh != null) {
		fshId = parse(manager, fsh, FRAGMENT);
	}
	if(vsh != null || fsh != null) {
		program = ARBShaderObjects.glCreateProgramObjectARB();
	}
	if(vsh != null) {
		OpenGlHelper.glAttachShader(program, vshId);
	}
	if(fsh != null) {
		OpenGlHelper.glAttachShader(program, fshId);
	}
	OpenGlHelper.glLinkProgram(program);
	if(OpenGlHelper.glGetShaderi(program, ARBShaderObjects.GL_OBJECT_LINK_STATUS_ARB) == GL11.GL_FALSE) {
		return 0;
	}
	if(OpenGlHelper.glGetShaderi(program, ARBShaderObjects.GL_OBJECT_VALIDATE_STATUS_ARB) == GL11.GL_FALSE) {
		return 0;
	}
	return program;
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:26,代码来源:ShaderManager.java

示例8: parse

private static int parse(IResourceManager manager, ResourceLocation location, int type) {
	int shader = OpenGlHelper.glCreateShader(type);
	try {
		InputStream inputStream = manager.getResource(location).getInputStream();
		String lines = IOUtils.readLines(inputStream, "UTF-8").stream()
				.collect(Collectors.joining("\n"));
		ARBShaderObjects.glShaderSourceARB(shader, lines);
		OpenGlHelper.glCompileShader(shader);
		inputStream.close();
		if(OpenGlHelper.glGetShaderi(shader, ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB) == GL11.GL_FALSE) {
			String info = OpenGlHelper.glGetProgramInfoLog(shader, ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB);
			throw new RuntimeException("Error creating shader: " + info);
		}
	} catch(IOException e) {
		Solar.LOG.warn("[Shader Resource] Failed to load shader " + location.toString());
		OpenGlHelper.glDeleteShader(shader);
		e.printStackTrace();
	}
	return shader;
}
 
开发者ID:ArekkuusuJerii,项目名称:Solar,代码行数:20,代码来源:ShaderManager.java

示例9: validate

public Program validate()
{
	GL20.glValidateProgram(this.handle);

	int status = GL20.glGetProgrami(this.handle, GL20.GL_VALIDATE_STATUS);
	if (status == GL11.GL_FALSE)
	{
		String infoLog = GL20.glGetProgramInfoLog(this.handle);
		GL20.glDeleteProgram(this.handle);
		this.handle = 0;

		throw new GLException(infoLog);
	}

	return this;
}
 
开发者ID:andykuo1,项目名称:candlelight,代码行数:16,代码来源:Program.java

示例10: Shader

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,代码行数:25,代码来源:Shader.java

示例11: loadShader

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,代码行数:24,代码来源:ShaderProgram.java

示例12: loadShader

private static int loadShader(String filename, int type) {
	
	StringBuilder shaderSource = new StringBuilder();
	
	try {
		BufferedReader reader = new BufferedReader(new FileReader(filename));
		String line;
		while((line = reader.readLine()) != null) {
			shaderSource.append(line).append("\n");
		}
		reader.close();
	} catch (IOException e) {
		System.err.println("Could not read shader file!");
		e.printStackTrace();
		System.exit(-1);
	}
	
	int shaderID = GL20.glCreateShader(type);
	GL20.glShaderSource(shaderID, shaderSource);
	GL20.glCompileShader(shaderID);
	
	if(GL20.glGetShader(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:marcioz98,项目名称:MRCEngine,代码行数:29,代码来源:ShaderProgram.java

示例13: loadShader

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,代码行数:11,代码来源:ShaderProgram.java

示例14: Shader

public Shader(String vertex, String fragment){
	this.vertex = vertex;
	this.fragment = fragment;
	
	//create each sub shader
	int vid = createShader(GL_VERTEX_SHADER, vertex);
	int fid = createShader(GL_FRAGMENT_SHADER, fragment);
	
	//create the program id
	id = glCreateProgram();
	
	//attach each individual shader
	glAttachShader(id, vid);
	glAttachShader(id, fid);
	
	//link the shaders together to make the program
	glLinkProgram(id);

	//if there is an error with linking, output the message
	if(glGetProgrami(id, GL_LINK_STATUS) == GL11.GL_FALSE){
		System.err.println(glGetProgramInfoLog(id, 1024));
		glDeleteProgram(id);
	}
	
	//remove the sub shader instances (already compiled into a whole)
	glDetachShader(id, vid);
	glDetachShader(id, fid);
	
	//add the shader program to the shader list by both paths of the shaders
	//note: collision will occur when reusing sub shaders
	shaders.put(vertex, this);
	shaders.put(fragment, this);
	
	//setup a uniform map (string uniform name, integer uniform location)
	uniforms = new HashMap<>();
	
	//create a buffer for 4x4 matrices
	buffer = BufferUtils.createFloatBuffer(16);
	
}
 
开发者ID:tek256,项目名称:LD38,代码行数:40,代码来源:Shader.java

示例15: link

public Program link(Shader... shaders)
{
	for (int i = 0; i < shaders.length; ++i)
	{
		GL20.glAttachShader(this.handle, shaders[i].handle());
	}
	GL20.glLinkProgram(this.handle);

	int status = GL20.glGetProgrami(this.handle, GL20.GL_LINK_STATUS);
	if (status == GL11.GL_FALSE)
	{
		String infolog = GL20.glGetProgramInfoLog(this.handle);
		GL20.glDeleteProgram(this.handle);
		this.handle = 0;

		throw new GLException(infolog);
	}

	for (int i = 0; i < shaders.length; ++i)
	{
		GL20.glDetachShader(this.handle, shaders[i].handle());
	}

	this.attribs = this.fetchAttribs();
	Uniform[] uniforms = this.fetchUniforms();
	for(Uniform uniform : uniforms)
	{
		this.uniforms.put(uniform.name, uniform);
	}

	return this;
}
 
开发者ID:andykuo1,项目名称:candlelight,代码行数:32,代码来源:Program.java


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