本文整理汇总了Java中org.lwjgl.opengl.GL32类的典型用法代码示例。如果您正苦于以下问题:Java GL32类的具体用法?Java GL32怎么用?Java GL32使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GL32类属于org.lwjgl.opengl包,在下文中一共展示了GL32类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ShaderProgram
import org.lwjgl.opengl.GL32; //导入依赖的package包/类
public ShaderProgram(MyFile vertexFile, MyFile geometryFile, MyFile fragmentFile, String... inVariables) {
int vertexShaderID = loadShader(vertexFile, GL20.GL_VERTEX_SHADER);
int geometryShaderID = loadShader(geometryFile, GL32.GL_GEOMETRY_SHADER);
int fragmentShaderID = loadShader(fragmentFile, GL20.GL_FRAGMENT_SHADER);
programID = GL20.glCreateProgram();
GL20.glAttachShader(programID, vertexShaderID);
GL20.glAttachShader(programID, geometryShaderID);
GL20.glAttachShader(programID, fragmentShaderID);
bindAttributes(inVariables);
GL20.glLinkProgram(programID);
GL20.glDetachShader(programID, vertexShaderID);
GL20.glDetachShader(programID, geometryShaderID);
GL20.glDetachShader(programID, fragmentShaderID);
GL20.glDeleteShader(vertexShaderID);
GL20.glDeleteShader(geometryShaderID);
GL20.glDeleteShader(fragmentShaderID);
}
示例2: ShaderProgram
import org.lwjgl.opengl.GL32; //导入依赖的package包/类
public ShaderProgram(MyFile vertexFile, MyFile geometryFile, MyFile fragmentFile, String... inVariables) {
int vertexShaderID = loadShader(vertexFile, GL20.GL_VERTEX_SHADER);
int geometryShaderID = loadShader(geometryFile, GL32.GL_GEOMETRY_SHADER);
int fragmentShaderID = loadShader(fragmentFile, GL20.GL_FRAGMENT_SHADER);
programID = GL20.glCreateProgram();
GL20.glAttachShader(programID, vertexShaderID);
GL20.glAttachShader(programID, geometryShaderID);
GL20.glAttachShader(programID, fragmentShaderID);
bindAttributes(inVariables);
GL20.glLinkProgram(programID);
GL20.glDetachShader(programID, vertexShaderID);
GL20.glDetachShader(programID, geometryShaderID);
GL20.glDetachShader(programID, fragmentShaderID);
GL20.glDeleteShader(vertexShaderID);
GL20.glDeleteShader(geometryShaderID);
GL20.glDeleteShader(fragmentShaderID);
}
示例3: compileGLSL
import org.lwjgl.opengl.GL32; //导入依赖的package包/类
private ExtendedGLSLProgram compileGLSL(
String vertexShaderCode,
String fragmentShaderCode,
String geometryShaderCode,
String tcsShaderCode,
String tesShaderCode,
ProgramAssemblyInfo assemblyInfo) {
int vertexShader = compileShader(GL20.GL_VERTEX_SHADER, vertexShaderCode, assemblyInfo);
int fragmentShader = compileShader(GL20.GL_FRAGMENT_SHADER, fragmentShaderCode, assemblyInfo);
int geometryShader = compileShader(GL32.GL_GEOMETRY_SHADER, geometryShaderCode, assemblyInfo);
int tcsShader = compileShader(GL40.GL_TESS_CONTROL_SHADER, tcsShaderCode, assemblyInfo);
int tesShader = compileShader(GL40.GL_TESS_EVALUATION_SHADER, tesShaderCode, assemblyInfo);
int program;
String[] outNames = ProgramOutputResolver.getOutput(fragmentShaderCode);
program = GLSLShaderCompiler.createProgram(
new int[]{vertexShader, tcsShader, tesShader, geometryShader, fragmentShader}, outNames, assemblyInfo.getProgramName()
);
return new ExtendedGLSLProgram(fragmentShader, vertexShader, geometryShader, tcsShader, tesShader, program);
}
示例4: GLShader
import org.lwjgl.opengl.GL32; //导入依赖的package包/类
public GLShader(String _name, String type_as_string) {
this.name = _name;
switch (type_as_string) {
case "GL_VERTEX_SHADER":
this.type = GL20.GL_VERTEX_SHADER;
break;
case "GL_FRAGMENT_SHADER":
this.type = GL20.GL_FRAGMENT_SHADER;
break;
case "GL_GEOMETRY_SHADER":
this.type = GL32.GL_GEOMETRY_SHADER;
break;
default:
Logger.getRootLogger().error("Unknow GL_TYPE " + type_as_string);
break;
}
}
示例5: cancel
import org.lwjgl.opengl.GL32; //导入依赖的package包/类
public void cancel() {
if (hitIdSync != -1) {
GL32.glDeleteSync(hitIdSync);
hitIdSync = -1;
}
if (worldPositionSync != -1) {
GL32.glDeleteSync(worldPositionSync);
worldPositionSync = -1;
}
if (localPositionSync != -1) {
GL32.glDeleteSync(localPositionSync);
localPositionSync = -1;
}
if (workingPboIndex != -1) {
renderer.freePbos.add(workingPboIndex);
}
}
示例6: recreate
import org.lwjgl.opengl.GL32; //导入依赖的package包/类
private void recreate() {
frameBufferID = GL30.glGenFramebuffers();
GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, frameBufferID);
GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, colorTextureID, 0);
GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT1, GL11.GL_TEXTURE_2D, positionTextureID, 0);
GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT2, GL11.GL_TEXTURE_2D, normalTextureID, 0);
GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT3, GL11.GL_TEXTURE_2D, specularTextureID, 0);
GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, depthTexutreID, 0);
if (GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER) != GL30.GL_FRAMEBUFFER_COMPLETE) {
Logs.e("Framebuffer error: " + GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER));
throw new RuntimeException("Frame buffer is not complete");
}
GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);
}
示例7: recreate
import org.lwjgl.opengl.GL32; //导入依赖的package包/类
private void recreate() {
frameBufferID = GL30.glGenFramebuffers();
GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, frameBufferID);
GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, colorTextureID, 0);
GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT1, GL11.GL_TEXTURE_2D, worldPositionTextureID, 0);
GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT2, GL11.GL_TEXTURE_2D, localPositionTextureID, 0);
GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, depthTexutreID, 0);
if (GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER) != GL30.GL_FRAMEBUFFER_COMPLETE) {
Logs.e("Framebuffer error: " + GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER));
throw new RuntimeException("Frame buffer is not complete");
}
GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);
}
示例8: compileShaders
import org.lwjgl.opengl.GL32; //导入依赖的package包/类
protected void compileShaders(String vertexShader, String geometryShader, String fragmentShader) throws Exception {
if(!isCompiled()) return;
$setValue_vertexShaderHandle(loadShader(GL20.GL_VERTEX_SHADER, vertexShader));
geometryShaderHandle = loadShader(GL32.GL_GEOMETRY_SHADER, geometryShader);
$setValue_fragmentShaderHandle(loadShader(GL20.GL_FRAGMENT_SHADER, fragmentShader));
if(geometryShaderHandle == -1) {
$setValue_isCompiled(false);
return;
}
int programId = linkProgram(createProgram());
if(programId == -1) {
$setValue_isCompiled(false);
return;
}
$setValue_program(programId);
$setValue_isCompiled(true);
}
示例9: throwIfLANotSupported
import org.lwjgl.opengl.GL32; //导入依赖的package包/类
private static void throwIfLANotSupported() {
if(!GLContext.getCapabilities().OpenGL30) {
return;
}
if(!GLContext.getCapabilities().OpenGL32) {
if(!GLContext.getCapabilities().GL_ARB_compatibility) {
throw new ImageFormatUnsupportedException("Core OpenGL contexts cannot use Luminance/alpha.");
}
}
else {
int profileMask = glGetInteger(GL32.GL_CONTEXT_PROFILE_MASK);
if((profileMask & GL32.GL_CONTEXT_CORE_PROFILE_BIT) != 0) {
throw new ImageFormatUnsupportedException("Core OpenGL contexts cannot use Luminance/alpha.");
}
}
}
示例10: prepare
import org.lwjgl.opengl.GL32; //导入依赖的package包/类
/**
* Prepares for a rendering pass. The depth and colour buffers of the
* current framebuffer are cleared and a few other default settings are set.
*/
private void prepare() {
GL11.glClearColor(1f, 1f, 1f, 1f);
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
GL32.glProvokingVertex(GL32.GL_FIRST_VERTEX_CONVENTION);
OpenGlUtils.cullBackFaces(true);
OpenGlUtils.enableDepthTesting(true);
OpenGlUtils.antialias(true);
}
示例11: attachTexture
import org.lwjgl.opengl.GL32; //导入依赖的package包/类
public FBO attachTexture(Texture texture, int attachment, boolean updateViewPort)
{
this.bind();
this.texture = texture;
this.viewport.setWidth((int) this.texture.width());
this.viewport.setHeight((int) this.texture.height());
GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, attachment, this.texture.handle(), 0);
this.unbind();
return this;
}
示例12: prepare
import org.lwjgl.opengl.GL32; //导入依赖的package包/类
/**
* A few general settings. Clears the colour and depth buffer before
* rendering, turns on backface culling, enables depth testing, turns on
* antialiasing and allows for wireframe rendering if the "G" key is
* pressed. The provoking vertex convention is also set here, indicating
* that the first vertex of each triangle should be the provoking vertex.
* This is important when using the "flat" type qualifier in the shaders.
*/
private void prepare() {
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
GL32.glProvokingVertex(GL32.GL_FIRST_VERTEX_CONVENTION);
OpenGlUtils.cullBackFaces(true);
OpenGlUtils.enableDepthTesting(true);
OpenGlUtils.antialias(true);
if (Keyboard.isKeyDown(Keyboard.KEY_G)) {
GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
} else {
GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
}
}
示例13: prepare
import org.lwjgl.opengl.GL32; //导入依赖的package包/类
/**
* Prepares for a rendering pass. The depth and colour buffers of the
* current framebuffer are cleared and a few other default settings are set.
*/
private void prepare() {
GL11.glClearColor(0f, 0.66f, 0.94f, 1f);
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
GL32.glProvokingVertex(GL32.GL_FIRST_VERTEX_CONVENTION);
OpenGlUtils.cullBackFaces(true);
OpenGlUtils.enableDepthTesting(true);
OpenGlUtils.antialias(true);
}
示例14: createTextureAttachment
import org.lwjgl.opengl.GL32; //导入依赖的package包/类
private int createTextureAttachment( int width, int height) {
int texture = GL11.glGenTextures();
GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, width, height,
0, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, (ByteBuffer) null);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0,
texture, 0);
return texture;
}
示例15: createDepthTextureAttachment
import org.lwjgl.opengl.GL32; //导入依赖的package包/类
private int createDepthTextureAttachment(int width, int height){
int texture = GL11.glGenTextures();
GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL14.GL_DEPTH_COMPONENT32, width, height,
0, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, (ByteBuffer) null);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT,
texture, 0);
return texture;
}