本文整理汇总了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;
}
示例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 });
}
示例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);
}
示例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));
}
}
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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_);
}
示例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);
}
示例11: getAttribLoc
import org.lwjgl.opengl.ARBVertexShader; //导入依赖的package包/类
public int getAttribLoc(String name)
{
return ARBVertexShader.glGetAttribLocationARB(programID, name);
}
示例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);
}
示例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_);
}
示例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;
}
}
示例15: glGetAttribLocation
import org.lwjgl.opengl.ARBVertexShader; //导入依赖的package包/类
@Override
public int glGetAttribLocation(int program, String attrib) {
return ARBVertexShader.glGetAttribLocationARB(program, attrib);
}