@Override public void disable() { gc.getGL().getGL2GL3().glBindVertexArray(0); } }
/** * @param name Name der Attribut Variable(wie im Vertex ShaderProgramm * definiert). * <p/> * @return Gibt den Index der Attribut Varibale im Grafikspeicher zur�ck. */ public int getAttrLocation(String name) { return gc.getGL().getGL2GL3().glGetAttribLocation(programObject, name); }
@Override public void prepare() { gc.getGL().getGL2GL3().glBindVertexArray(id); }
/** * Deaktiviert ShaderProgramm Programme im GL Context. */ public void disable() { gc.getGL().getGL2GL3().glUseProgram(0); shaderinuse = null; }
private void setReadBuffer(final int attachVal) { final GL gl = GLContext.getCurrentGL(); gl.getGL2GL3().glReadBuffer(attachVal); }
private void setDrawBuffer(final int attachVal) { final GL gl = GLContext.getCurrentGL(); gl.getGL2GL3().glDrawBuffer(attachVal); }
@Override public final void glDebugMessageInsert(final int source, final int type, final int id, final int severity, final String buf) { final int len = (null != buf) ? buf.length() : 0; if(glDebugHandler.isExtensionARB()) { gl.getGL2GL3().glDebugMessageInsert(source, type, id, severity, len, buf); } else if(glDebugHandler.isExtensionAMD()) { gl.getGL2GL3().glDebugMessageInsertAMD(GLDebugMessage.translateARB2AMDCategory(source, type), severity, id, len, buf); } }
@Override public final void glDebugMessageControl(final int source, final int type, final int severity, final int count, final int[] ids, final int ids_offset, final boolean enabled) { if(glDebugHandler.isExtensionARB()) { gl.getGL2GL3().glDebugMessageControl(source, type, severity, count, ids, ids_offset, enabled); } else if(glDebugHandler.isExtensionAMD()) { gl.getGL2GL3().glDebugMessageEnableAMD(GLDebugMessage.translateARB2AMDCategory(source, type), severity, count, ids, ids_offset, enabled); } }
@Override public final void glDebugMessageControl(final int source, final int type, final int severity, final int count, final IntBuffer ids, final boolean enabled) { if(glDebugHandler.isExtensionARB()) { gl.getGL2GL3().glDebugMessageControl(source, type, severity, count, ids, enabled); } else if(glDebugHandler.isExtensionAMD()) { gl.getGL2GL3().glDebugMessageEnableAMD(GLDebugMessage.translateARB2AMDCategory(source, type), severity, count, ids, enabled); } }
/** * Aktiviert das ShaderProgramm Programm im GL Context. */ public void use() { if (shaderinuse != this) { gc.getGL().getGL2GL3().glUseProgram(getPObject()); shaderinuse = this; } }
public int getUniformLocation(String s) { return gc.getGL().getGL2GL3().glGetUniformLocation(getPObject(), s); }
@AssistedInject @ParametersAreNonnullByDefault public VAOAttributs(GraphicContext gcontext, @Assisted Shader shader, @Assisted VertexBO[] vbuffers, @Assisted @Nullable BufferObject indice) { gc = gcontext; int[] i = new int[1]; gc.getGL().getGL2GL3().glGenVertexArrays(1, i, 0); id = i[0]; StdAttributs sa = new StdAttributs(gc, shader, vbuffers, indice); prepare(); sa.prepare(); disable(); //TODO: wtf??? GL Error about vbo not bound sa.disable(); }
public void delete() { gc.getGL().getGL2GL3().glDeleteProgram(getPObject()); if (shaderinuse == this) { disable(); } }
public void setShader(ShaderProgramm s) { uniform_pos = s.getUniformLocation(uniname); s.use(); gc.getGL().getGL2GL3().glUniform1i(uniform_pos, textureUnit - GL.GL_TEXTURE0); } }
private int compileShaderObject(ShaderType type, String[] shaderText) throws BuildException { GL2GL3 gl = gc.getGL().getGL2GL3(); int glObject = gl.glCreateShader(type.glConst); gl.glShaderSource(glObject, shaderText.length, shaderText, null); gl.glCompileShader(glObject); handleError(glObject, shaderText); return glObject; }
public void setupNormalData(final FloatBufferData normalBufferData) { final GL gl = GLContext.getCurrentGL(); final FloatBuffer normalBuffer = normalBufferData != null ? normalBufferData.getBuffer() : null; if (normalBuffer == null) { if (gl.isGL2GL3()) { gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_NORMAL_ARRAY); } } else { if (gl.isGL2GL3()) { gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_NORMAL_ARRAY); } normalBuffer.rewind(); if (gl.isGL2ES1()) { gl.getGL2ES1().glNormalPointer(GL.GL_FLOAT, 0, normalBuffer); } } }
private void setDrawBuffers(final int maxEntry) { final GL gl = GLContext.getCurrentGL(); if (maxEntry <= 1) { setDrawBuffer(maxEntry != 0 ? GL.GL_COLOR_ATTACHMENT0 : GL.GL_NONE); } else { // We should only get to this point if we support ARBDrawBuffers. _attachBuffer.clear(); _attachBuffer.limit(maxEntry); gl.getGL2GL3().glDrawBuffers(_attachBuffer.limit(), _attachBuffer); // TODO Check <size> } }
public void copyColorTo(FrameBufferObject dst) { bindAsReadBuffer(); dst.bindAsDrawBuffer(); gc.getGL().getGL2GL3().glBlitFramebuffer(0, 0, width, height, 0, 0, dst.getWidth(), dst.getHeight(), GL.GL_COLOR_BUFFER_BIT, GL.GL_LINEAR); }
@Override protected void blitMSFBO() { final GL gl = GLContext.getCurrentGL(); gl.glBindFramebuffer(GL2GL3.GL_READ_FRAMEBUFFER, _msfboID); gl.glBindFramebuffer(GL2GL3.GL_DRAW_FRAMEBUFFER, _fboID); gl.getGL2GL3().glBlitFramebuffer(0, 0, _width, _height, 0, 0, _width, _height, GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT, GL.GL_NEAREST); gl.glBindFramebuffer(GL2GL3.GL_READ_FRAMEBUFFER, 0); gl.glBindFramebuffer(GL2GL3.GL_DRAW_FRAMEBUFFER, 0); gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0); }
public void setupColorDataVBO(final FloatBufferData data) { final GL gl = GLContext.getCurrentGL(); final RenderContext context = ContextManager.getCurrentContext(); final RendererRecord rendRecord = context.getRendererRecord(); final int vboID = setupVBO(data, context); if (vboID != 0) { if (gl.isGL2GL3()) { gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_COLOR_ARRAY); } JoglRendererUtil.setBoundVBO(rendRecord, vboID); if (gl.isGL2ES1()) { gl.getGL2ES1().glColorPointer(data.getValuesPerTuple(), GL.GL_FLOAT, 0, 0); } } else { if (gl.isGL2GL3()) { gl.getGL2GL3().glDisableClientState(GLPointerFunc.GL_COLOR_ARRAY); } } }