List of usage examples for org.lwjgl.opengl GL20 glCreateProgram
@NativeType("GLuint") public static int glCreateProgram()
From source file:fr.guillaume.prive.viper.core.graphic.GraphicMotor.java
private static void setupShaders() { int vsId = GraphicMotor.loadShader("resources/shader/ship.vert", GL20.GL_VERTEX_SHADER); int fsId = GraphicMotor.loadShader("resources/shader/ship.frag", GL20.GL_FRAGMENT_SHADER); instance.shipShaderId = GL20.glCreateProgram(); GL20.glAttachShader(instance.shipShaderId, vsId); GL20.glAttachShader(instance.shipShaderId, fsId); GL20.glBindAttribLocation(instance.shipShaderId, 0, "in_Position"); GL20.glBindAttribLocation(instance.shipShaderId, 1, "Normal"); GL20.glBindAttribLocation(instance.shipShaderId, 2, "in_Color"); GL20.glBindAttribLocation(instance.shipShaderId, 3, "in_TextureCoord"); GL20.glLinkProgram(instance.shipShaderId); GL20.glValidateProgram(instance.shipShaderId); instance.projectionMatrixLocation = GL20.glGetUniformLocation(instance.shipShaderId, "projectionMatrix"); instance.viewMatrixLocation = GL20.glGetUniformLocation(instance.shipShaderId, "viewMatrix"); instance.modelMatrixLocation = GL20.glGetUniformLocation(instance.shipShaderId, "modelMatrix"); instance.useTextureLocation = GL20.glGetUniformLocation(instance.shipShaderId, "use_texture"); GraphicMotor.exitOnGLError("setupShaders"); }
From source file:io.root.gfx.glutils.GL.java
License:Apache License
public static int glCreateProgram() { return GL20.glCreateProgram(); }
From source file:jpcsp.graphics.RE.RenderingEngineLwjgl.java
License:Open Source License
@Override public int createProgram() { return GL20.glCreateProgram(); }
From source file:lessur.util.shader.ShaderManager.java
License:GNU General Public License
/** * Creates a program, which can be used to attach shaders to * @return An int representing the program index/id *//*from w w w .j a va 2s . c o m*/ public int createProgram() { int program = -1; if (has_opengl2) { program = GL20.glCreateProgram(); } else if (has_arb) { program = ARBShaderObjects.glCreateProgramObjectARB(); } return program; }
From source file:main.java.com.YeAJG.game.entity.Entity.java
License:Open Source License
private void SetupShaders(String shaderPath, String fragPath) { // Load the vertex shader and fragment shader vsId = ShaderHandler.loadShader(shaderPath); fsId = ShaderHandler.loadFrag(fragPath); // Create a new shader program that links both shaders pId = GL20.glCreateProgram(); GL20.glAttachShader(pId, vsId);//w ww .j ava 2s .co m GL20.glAttachShader(pId, fsId); // Position information will be attribute 0 GL20.glBindAttribLocation(pId, 0, "in_Position"); // Color information will be attribute 1 GL20.glBindAttribLocation(pId, 1, "in_Color"); // Textute information will be attribute 2 GL20.glBindAttribLocation(pId, 2, "in_TextureCoord"); GL20.glLinkProgram(pId); GL20.glValidateProgram(pId); // Get matrices uniform locations projectionMatrixLocation = GL20.glGetUniformLocation(pId, "projectionMatrix"); viewMatrixLocation = GL20.glGetUniformLocation(pId, "viewMatrix"); modelMatrixLocation = GL20.glGetUniformLocation(pId, "modelMatrix"); decayLocation = GL20.glGetUniformLocation(pId, "decay"); Game.exitOnGLError("setupShaders"); }
From source file:me.thehutch.fusion.engine.render.opengl.gl20.OpenGL20Program.java
License:Open Source License
@Override public void create() { ensureNotCreated("Program is already created"); // Create the program this.id = GL20.glCreateProgram(); super.create(); }
From source file:net.betabears.the2dlibrary.graphics.shader.ShaderProgram.java
@Override public void init() { if (isLoaded && !isInited) { s0.createShader();//from ww w . ja v a 2 s .com s1.createShader(); id = GL20.glCreateProgram(); GL20.glAttachShader(id, s0.getID()); GL20.glAttachShader(id, s1.getID()); GL20.glLinkProgram(id); GL20.glValidateProgram(id); int i; while ((i = GL11.glGetError()) != 0) { LOGGER.log(Level.WARNING, "Error happened during creation of ShaderProgram. GL error code: {0}", i); } isInited = true; } else { LOGGER.log(Level.WARNING, "load() wasn't called before init() or init() has been called already."); } }
From source file:net.neilcsmith.praxis.video.opengl.internal.ShaderProgram.java
License:Apache License
private int linkProgram() { int program = GL20.glCreateProgram(); if (program == 0) return -1; GL20.glAttachShader(program, vertexShaderHandle); GL20.glAttachShader(program, fragmentShaderHandle); GL20.glLinkProgram(program);// ww w . j a v a 2 s .c o m // ByteBuffer tmp = ByteBuffer.allocateDirect(4); // tmp.order(ByteOrder.nativeOrder()); // IntBuffer intbuf = tmp.asIntBuffer(); GL20.glGetProgram(program, GL20.GL_LINK_STATUS, intbuf); int linked = intbuf.get(0); if (linked == 0) { return -1; } return program; }
From source file:net.smert.frameworkgl.opengl.helpers.ShaderHelper.java
License:Apache License
public int createProgram() { return GL20.glCreateProgram(); }
From source file:opengl.test.object.cube.wall.java
public wall(int vao, float x, float y, String path, float reapetNumber) { this.programID = GL20.glCreateProgram(); this.path = path; this.vao = vao; this.x = x;//from w w w. j a v a 2 s. com this.y = y; this.repeatCount = reapetNumber; this.vertexShader("opengl/test/object/object.vs"); this.fragmentShader("opengl/test/object/object.fs"); this.link(); this.initVertex(); this.initUniformValues(); }