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


Java ARBVertexShader类代码示例

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


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

示例1: getShaderProgram

import org.lwjgl.opengl.ARBVertexShader; //导入依赖的package包/类
/**
 * Loads a vertex and fragment shader pair, compiles them and links them to a ProgramObjectARB
 * @param name
 * @return the program object ID
 */
public int getShaderProgram(ByteBuffer vcode, ByteBuffer fcode) {
	int progID = -1;

	int vid = ARBShaderObjects.glCreateShaderObjectARB(ARBVertexShader.GL_VERTEX_SHADER_ARB);
	int fid = ARBShaderObjects.glCreateShaderObjectARB(ARBFragmentShader.GL_FRAGMENT_SHADER_ARB);

	ARBShaderObjects.glShaderSourceARB(vid, vcode);
	ARBShaderObjects.glCompileShaderARB(vid);
	printLogInfo(vid, "Compile Vertex Shader");

	ARBShaderObjects.glShaderSourceARB(fid, fcode);
	ARBShaderObjects.glCompileShaderARB(fid);
	printLogInfo(fid, "Compile Fragment Shader");
	
	progID = ARBShaderObjects.glCreateProgramObjectARB();
	ARBShaderObjects.glAttachObjectARB(progID, vid);
	ARBShaderObjects.glAttachObjectARB(progID, fid);
	
	ARBShaderObjects.glLinkProgramARB(progID);
	printLogInfo(progID, "Link");
	ARBShaderObjects.glValidateProgramARB(progID);
	printLogInfo(progID, "Validate");
	
	return progID;
}
 
开发者ID:Erkaman,项目名称:NeoTextureEdit2,代码行数:31,代码来源:OpenGLTextureRenderCanvas.java

示例2: testNoVertexAttribPointerInOtherVAOViaExtension

import org.lwjgl.opengl.ARBVertexShader; //导入依赖的package包/类
@Test
public void testNoVertexAttribPointerInOtherVAOViaExtension() {
    window = glfwCreateWindow(800, 600, "", 0L, 0L);
    glfwMakeContextCurrent(window);
    createCapabilities();
    ARBVertexShader.glEnableVertexAttribArrayARB(0);
    int vao = ARBVertexArrayObject.glGenVertexArrays();
    ARBVertexArrayObject.glBindVertexArray(vao);
    glDrawArrays(GL_POINTS, 0, 1); // <--- MUST NOT THROW
    ARBVertexArrayObject.glDeleteVertexArrays(new int[] { vao });
}
 
开发者ID:LWJGLX,项目名称:debug,代码行数:12,代码来源:DebugIT.java

示例3: glVertexAttributeMat4

import org.lwjgl.opengl.ARBVertexShader; //导入依赖的package包/类
public void glVertexAttributeMat4(int loc, Matrix4f matrix)
{
    ARBVertexShader.glVertexAttrib4fARB(loc  , matrix.m00, matrix.m01, matrix.m02, matrix.m03);
    ARBVertexShader.glVertexAttrib4fARB(loc+1, matrix.m10, matrix.m11, matrix.m12, matrix.m13);
    ARBVertexShader.glVertexAttrib4fARB(loc+2, matrix.m20, matrix.m21, matrix.m22, matrix.m23);
    ARBVertexShader.glVertexAttrib4fARB(loc+3, matrix.m30, matrix.m31, matrix.m32, matrix.m33);
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:8,代码来源:ShaderProgram.java

示例4: initialize

import org.lwjgl.opengl.ARBVertexShader; //导入依赖的package包/类
protected void initialize(final String vertexSrc, final String fragmentSrc) throws ShaderException {

		int vertShader = 0;
		int fragShader = 0;

		vertShader = createShader(vertexSrc, ARBVertexShader.GL_VERTEX_SHADER_ARB);
		fragShader = createShader(fragmentSrc, ARBFragmentShader.GL_FRAGMENT_SHADER_ARB);

		if (vertShader == 0 || fragShader == 0)
			throw new ShaderException(this.name, "Unable to intialize shader!");

		this.programId = ARBShaderObjects.glCreateProgramObjectARB();

		if (this.programId != 0) {
			ARBShaderObjects.glAttachObjectARB(this.programId, vertShader);
			ARBShaderObjects.glAttachObjectARB(this.programId, fragShader);

			ARBShaderObjects.glLinkProgramARB(this.programId);
			if (ARBShaderObjects.glGetObjectParameteriARB(this.programId,
					ARBShaderObjects.GL_OBJECT_LINK_STATUS_ARB) == GL11.GL_FALSE) {
				throw new ShaderException(this.name, getLogInfo(this.programId));
			}

			ARBShaderObjects.glValidateProgramARB(this.programId);
			if (ARBShaderObjects.glGetObjectParameteriARB(this.programId,
					ARBShaderObjects.GL_OBJECT_VALIDATE_STATUS_ARB) == GL11.GL_FALSE) {
				throw new ShaderException(this.name, getLogInfo(this.programId));
			}
		}
	}
 
开发者ID:OreCruncher,项目名称:DynamicSurroundings,代码行数:31,代码来源:ShaderProgram.java

示例5: createProgram

import org.lwjgl.opengl.ARBVertexShader; //导入依赖的package包/类
public static int createProgram(@Nullable final ResourceLocation vert, @Nullable final ResourceLocation frag) {
	int vertId = 0, fragId = 0, program;
	if (vert != null)
		vertId = createShader(vert, ARBVertexShader.GL_VERTEX_SHADER_ARB);
	if (frag != null)
		fragId = createShader(frag, ARBFragmentShader.GL_FRAGMENT_SHADER_ARB);

	program = OpenGlHelper.glCreateProgram();
	if (program == 0)
		return 0;

	if (vert != null)
		OpenGlHelper.glAttachShader(program, vertId);
	if (frag != null)
		OpenGlHelper.glAttachShader(program, fragId);

	OpenGlHelper.glLinkProgram(program);
	if (OpenGlHelper.glGetProgrami(program, ARBShaderObjects.GL_OBJECT_LINK_STATUS_ARB) == GL11.GL_FALSE) {
		LibLog.log().error(getLogInfoProgram(program), null);
		return 0;
	}

	GL20.glValidateProgram(program);
	if (OpenGlHelper.glGetProgrami(program, ARBShaderObjects.GL_OBJECT_VALIDATE_STATUS_ARB) == GL11.GL_FALSE) {
		LibLog.log().error(getLogInfoProgram(program), null);
		return 0;
	}

	OpenGlHelper.glDeleteShader(vertId);
	OpenGlHelper.glDeleteShader(fragId);

	OpenGlHelper.glUseProgram(0);
	
	return program;
}
 
开发者ID:OreCruncher,项目名称:DynamicSurroundings,代码行数:36,代码来源:ShaderUtils.java

示例6: glVertexAttributeMat4

import org.lwjgl.opengl.ARBVertexShader; //导入依赖的package包/类
public void glVertexAttributeMat4(int loc, Matrix4f matrix)
{
    ARBVertexShader.glVertexAttrib4fARB(loc, matrix.m00, matrix.m01, matrix.m02, matrix.m03);
    ARBVertexShader.glVertexAttrib4fARB(loc + 1, matrix.m10, matrix.m11, matrix.m12, matrix.m13);
    ARBVertexShader.glVertexAttrib4fARB(loc + 2, matrix.m20, matrix.m21, matrix.m22, matrix.m23);
    ARBVertexShader.glVertexAttrib4fARB(loc + 3, matrix.m30, matrix.m31, matrix.m32, matrix.m33);
}
 
开发者ID:Darkona,项目名称:AdventureBackpack2,代码行数:8,代码来源:ShaderProgram.java

示例7: getAttributeLocation

import org.lwjgl.opengl.ARBVertexShader; //导入依赖的package包/类
/**
 * Returns the index for a given attribute in this {@link ShaderProgram}.
 * Th program must be loaded before this method is called.
 * 
 * @param name The name of the attribute to look up.
 * @return The index of the attribute , or -1 if there was a problem.
 */
public Location getAttributeLocation(String name) {
  Location output = new Location(name, false);
  output.index =  ARBVertexShader.glGetAttribLocationARB(shaderprog, name);
  locations.put(name, output);
  
  return output;
}
 
开发者ID:Arcbe,项目名称:GPVM,代码行数:15,代码来源:ShaderProgram.java

示例8: Shader

import org.lwjgl.opengl.ARBVertexShader; //导入依赖的package包/类
public Shader(String fragmentShader, String vertexShader) {
	this.fragmentShader = fragmentShader;
	this.vertexShader = vertexShader;
	this.vertexShaderId = loadShader(ARBVertexShader.GL_VERTEX_SHADER_ARB,
			vertexShader);
	this.fragmentShaderId = loadShader(
			ARBFragmentShader.GL_FRAGMENT_SHADER_ARB, fragmentShader);
	this.programId = ARBShaderObjects.glCreateProgramObjectARB();
	ARBShaderObjects.glAttachObjectARB(this.programId, this.vertexShaderId);
	ARBShaderObjects.glAttachObjectARB(this.programId,
			this.fragmentShaderId);
	ARBShaderObjects.glLinkProgramARB(this.programId);
	ARBShaderObjects.glValidateProgramARB(this.programId);
}
 
开发者ID:g-rauhoeft,项目名称:Beeg-StaKe,代码行数:15,代码来源:Shader.java

示例9: glGetAttribLocation

import org.lwjgl.opengl.ARBVertexShader; //导入依赖的package包/类
public static int glGetAttribLocation(int p_153164_0_, CharSequence p_153164_1_)
{
    return arbShaders ? ARBVertexShader.glGetAttribLocationARB(p_153164_0_, p_153164_1_) : GL20.glGetAttribLocation(p_153164_0_, p_153164_1_);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:OpenGlHelper.java

示例10: glGetAttribLocation

import org.lwjgl.opengl.ARBVertexShader; //导入依赖的package包/类
public static int glGetAttribLocation(int program, CharSequence name)
{
    return arbShaders ? ARBVertexShader.glGetAttribLocationARB(program, name) : GL20.glGetAttribLocation(program, name);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:OpenGlHelper.java

示例11: getAttribLoc

import org.lwjgl.opengl.ARBVertexShader; //导入依赖的package包/类
public int getAttribLoc(String name)
{
    return ARBVertexShader.glGetAttribLocationARB(programID, name);
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:5,代码来源:ShaderProgram.java

示例12: init

import org.lwjgl.opengl.ARBVertexShader; //导入依赖的package包/类
public void init() {
    // vertex shader
    final int vertShader = ARBShaderObjects.glCreateShaderObjectARB(ARBVertexShader.GL_VERTEX_SHADER_ARB);
    if (vertShader == GL_FALSE) {
        throw new RuntimeException("failed to create vert shader");
    }
    final String vertexCode = ""
            + "#version 120                                                 \n"
            + "                                                             \n" 
            + "                                                             \n" 
            + "void main() {                                                \n" 
            //+ "    gl_Position = gl_Vertex;                                 \n"
            + "    gl_Position = vec4(gl_Vertex.xyz * 0.5, gl_Vertex.w);    \n"
            + "}                                                            \n";
    ARBShaderObjects.glShaderSourceARB(vertShader, vertexCode);
    ARBShaderObjects.glCompileShaderARB(vertShader);
    if (GL20.glGetShaderi(vertShader, GL20.GL_COMPILE_STATUS) == GL_FALSE) {
        System.out.println(GL20.glGetShaderInfoLog(vertShader));
        throw new RuntimeException("vert comp failed");
    }

    // fragment shader
    final int fragShader = ARBShaderObjects.glCreateShaderObjectARB(ARBFragmentShader.GL_FRAGMENT_SHADER_ARB);
    if (fragShader == GL_FALSE) {
        throw new RuntimeException("failed to create frag shader");
    }
    final String fragCode = ""
            + "#version 120                                     \n"
            + "                                                 \n" 
            + "void main() {                                    \n" 
            + "    gl_FragColor = vec4(1.0, 1.0, 0.4, 1.0);     \n"
            + "}                                                \n";
    ARBShaderObjects.glShaderSourceARB(fragShader, fragCode);
    ARBShaderObjects.glCompileShaderARB(fragShader);
    if (GL20.glGetShaderi(fragShader, GL20.GL_COMPILE_STATUS) == GL_FALSE) {
        System.out.println(GL20.glGetShaderInfoLog(fragShader));
        throw new RuntimeException("frag comp failed");
    }

    // program
    program = ARBShaderObjects.glCreateProgramObjectARB();
    if (program == GL_FALSE) {
        throw new RuntimeException("failed to create shader program");
    }
    ARBShaderObjects.glAttachObjectARB(program, vertShader);
    ARBShaderObjects.glAttachObjectARB(program, fragShader);
    ARBShaderObjects.glLinkProgramARB(program);                     //is there a way to check this result?
    ARBShaderObjects.glValidateProgramARB(program);                 //is there a way to check this result?

    glClearColor(.42f, .67f, .87f, 1f);
}
 
开发者ID:WhiteHexagon,项目名称:example-jovr-lwjgl3-rift,代码行数:52,代码来源:ShaderProgram120.java

示例13: func_153164_b

import org.lwjgl.opengl.ARBVertexShader; //导入依赖的package包/类
public static int func_153164_b(int p_153164_0_, CharSequence p_153164_1_)
{
    return field_153214_y ? ARBVertexShader.glGetAttribLocationARB(p_153164_0_, p_153164_1_) : GL20.glGetAttribLocation(p_153164_0_, p_153164_1_);
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:5,代码来源:OpenGlHelper.java

示例14: Shader

import org.lwjgl.opengl.ARBVertexShader; //导入依赖的package包/类
/**
 * Create a shader with the given id and shader strings.
 *
 * @param vsh The vertex shader. (as a string)
 * @param fsh The fragment shader. (as a string)
 */
public Shader(final String vsh, final String fsh) {
    if (!Display.isCreated()) {
        throw new IllegalStateException("You need to initialize the display module first.");
    }
    try {
        if (vsh != null) {
            vsId = createShader(vsh, ARBVertexShader.GL_VERTEX_SHADER_ARB);
        }
        if (fsh != null) {
            fsId = createShader(fsh,
                    ARBFragmentShader.GL_FRAGMENT_SHADER_ARB);
        }
        program = ARBShaderObjects.glCreateProgramObjectARB();

        if (program <= 0) {
            throw new RuntimeException("Cannot create shader");
        }

        if (vsId != 0) {
            ARBShaderObjects.glAttachObjectARB(program, vsId);
        }
        if (fsId != 0) {
            ARBShaderObjects.glAttachObjectARB(program, fsId);
        }
        ARBShaderObjects.glLinkProgramARB(program);

        if (ARBShaderObjects.glGetObjectParameteriARB(program,
                ARBShaderObjects.GL_OBJECT_LINK_STATUS_ARB) == GL11.GL_FALSE) {
            throw new RuntimeException(getLogInfo(program));
        }

        ARBShaderObjects.glValidateProgramARB(program);
        if (ARBShaderObjects.glGetObjectParameteriARB(program,
                ARBShaderObjects.GL_OBJECT_VALIDATE_STATUS_ARB) == GL11.GL_FALSE) {
            throw new RuntimeException(getLogInfo(program));
        }
    } catch (RuntimeException e) {
        delete();
        throw e;
    }
}
 
开发者ID:PenguinMenaceTechnologies,项目名称:PenguinMenaceEngine,代码行数:48,代码来源:Shader.java

示例15: glGetAttribLocation

import org.lwjgl.opengl.ARBVertexShader; //导入依赖的package包/类
@Override
public int glGetAttribLocation(int program, String attrib) {
	return ARBVertexShader.glGetAttribLocationARB(program, attrib);
}
 
开发者ID:OpenMods,项目名称:OpenModsLib,代码行数:5,代码来源:ShaderHelper.java


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