@Override public void glBindTexture(int param1, int param2) { GLContext.getCurrentGL().glBindTexture(param1, param2); }
@Override protected void bindTextureImpl(int target, int texture) { gl.glBindTexture(target, texture); }
@Override public void glBindTexture(int target, int texture) { GLContext.getCurrentGL().glBindTexture(target, texture); }
/** * Unbind texture, ie bind 'non' texture 0 * * <p>Leaves the FBO unbound.</p> */ public final void unuse(final GL gl) { unbind(gl); gl.glBindTexture(GL.GL_TEXTURE_2D, 0); // don't use it }
/** * Unbind texture, ie bind 'non' texture 0 * * <p>Leaves the FBO unbound.</p> */ public final void unuse(final GL gl) { unbind(gl); gl.glBindTexture(GL.GL_TEXTURE_2D, 0); // don't use it }
public GLTexture bind(GL gl) { gl.glBindTexture(bindingTarget, getTextureID()); return this; }
@Override public void glBindTexture(int param1, int param2) { GLContext.getCurrentGL().glBindTexture(param1, param2); }
/** * Binds this texture to the given GL context. This method is a * shorthand equivalent of the following OpenGL code: <pre> gl.glBindTexture(texture.getTarget(), texture.getTextureObject()); </pre> * * See the <a href="#perftips">performance tips</a> above for hints * on how to maximize performance when using many Texture objects. * * @param gl the current GL context * @throws GLException if no OpenGL context was current or if any * OpenGL-related errors occurred */ public void bind(final GL gl) throws GLException { validateTexID(gl, true); gl.glBindTexture(target, texID); }
public void bind() { final GL gl = GLContext.getCurrentGL(); gl.glBindTexture(GL.GL_TEXTURE_2D, textureId); checkGLError(); }
/** * {@link #syncSamplingSink(GL) Synchronize the sampling sink} and bind the given {@link TextureAttachment}, if not <code>null</code>. * * <p>If using a {@link TextureAttachment} and multiple texture units, ensure you call {@link GL#glActiveTexture(int)} first!</p> * * <p>{@link #syncSamplingSink(GL)} is being called</p> * * <p>Leaves the FBO unbound!</p> * * @param gl the current GL context * @param ta {@link TextureAttachment} to use, prev. attached w/ {@link #attachTexture2D(GL, int, boolean, int, int, int, int) attachTexture2D(..)}, * may be <code>null</code> in case no {@link TextureAttachment} is used. * @throws IllegalArgumentException */ public final void use(final GL gl, final TextureAttachment ta) throws IllegalArgumentException { syncSamplingSink(gl); if( null != ta ) { gl.glBindTexture(GL.GL_TEXTURE_2D, ta.getName()); // use it .. } }
/** * {@link #syncSamplingSink(GL) Synchronize the sampling sink} and bind the given {@link TextureAttachment}, if not <code>null</code>. * * <p>If using a {@link TextureAttachment} and multiple texture units, ensure you call {@link GL#glActiveTexture(int)} first!</p> * * <p>{@link #syncSamplingSink(GL)} is being called</p> * * <p>Leaves the FBO unbound!</p> * * @param gl the current GL context * @param ta {@link TextureAttachment} to use, prev. attached w/ {@link #attachTexture2D(GL, int, boolean, int, int, int, int) attachTexture2D(..)}, * may be <code>null</code> in case no {@link TextureAttachment} is used. * @throws IllegalArgumentException */ public final void use(final GL gl, final TextureAttachment ta) throws IllegalArgumentException { syncSamplingSink(gl); if( null != ta ) { gl.glBindTexture(GL.GL_TEXTURE_2D, ta.getName()); // use it .. } }
@Override void bindTextureCubeMap(Context ctx, int objectId, boolean enable) { if (VERBOSE) System.err.println("JoglPipeline.bindTextureCubeMap()"); GL gl = context(ctx).getGL(); // TextureCubeMap will take precedure over 3D Texture so // there is no need to disable 3D Texture here. if (!enable) { gl.glDisable(GL.GL_TEXTURE_CUBE_MAP); } else { gl.glBindTexture(GL.GL_TEXTURE_CUBE_MAP, objectId); gl.glEnable(GL.GL_TEXTURE_CUBE_MAP); } }
@Override void bindTexture3D(Context ctx, int objectId, boolean enable) { if (VERBOSE) System.err.println("JoglPipeline.bindTexture3D()"); GL gl = context(ctx).getGL(); // textureCubeMap will take precedure over 3D Texture gl.glDisable(GL.GL_TEXTURE_CUBE_MAP); if (!enable) { gl.glDisable(GL2.GL_TEXTURE_3D); } else { gl.glBindTexture(GL2.GL_TEXTURE_3D, objectId); gl.glEnable(GL2.GL_TEXTURE_3D); } }
/** * Restores the texture-unit's texture-target state. * <p> * First the texture-unit is activated, then all states are restored. * </p> * @param gl current GL context's GL object */ public final void restore(final GL gl) { gl.glActiveTexture(state[0]); gl.glBindTexture(target, state[1]); gl.glTexParameteri(target, GL.GL_TEXTURE_MAG_FILTER, state[2]); gl.glTexParameteri(target, GL.GL_TEXTURE_MIN_FILTER, state[3]); gl.glTexParameteri(target, GL.GL_TEXTURE_WRAP_S, state[4]); gl.glTexParameteri(target, GL.GL_TEXTURE_WRAP_T, state[5]); }
@Override void bindTexture2D(Context ctx, int objectId, boolean enable) { if (VERBOSE) System.err.println("JoglPipeline.bindTexture2D(objectId=" + objectId + ",enable=" + enable + ")"); GL gl = context(ctx).getGL(); gl.glDisable(GL.GL_TEXTURE_CUBE_MAP); gl.glDisable(GL2.GL_TEXTURE_3D); if (!enable) { gl.glDisable(GL.GL_TEXTURE_2D); } else { gl.glBindTexture(GL.GL_TEXTURE_2D, objectId); gl.glEnable(GL.GL_TEXTURE_2D); } }
public void bind(final GL gl) throws GLException { gl.glEnable(GL2.GL_TEXTURE_1D); validateTexID(gl, true); gl.glBindTexture(GL2.GL_TEXTURE_1D, texID); if (name != null) { gl.glActiveTexture(GL.GL_TEXTURE1); } gl.glTexParameteri(GL2.GL_TEXTURE_1D, GL2.GL_TEXTURE_WRAP_S, GL2.GL_CLAMP_TO_EDGE); // gl.glTexParameteri(GL2.GL_TEXTURE_3D, GL2.GL_TEXTURE_WRAP_T, GL2.GL_CLAMP); // gl.glTexParameteri(GL2.GL_TEXTURE_3D, GL2.GL_TEXTURE_WRAP_R, GL2.GL_CLAMP); gl.glTexParameteri(GL2.GL_TEXTURE_1D, GL2.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); gl.glTexParameteri(GL2.GL_TEXTURE_1D, GL2.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST); setTextureData(gl,image,shape); }
public void bind(final GL gl) throws GLException { gl.glEnable(GL2.GL_TEXTURE_3D); validateTexID(gl, true); gl.glBindTexture(GL2.GL_TEXTURE_3D, texID); gl.glActiveTexture(GL.GL_TEXTURE0); gl.glTexParameteri(GL2.GL_TEXTURE_3D, GL2.GL_TEXTURE_WRAP_S, GL2.GL_CLAMP); gl.glTexParameteri(GL2.GL_TEXTURE_3D, GL2.GL_TEXTURE_WRAP_T, GL2.GL_CLAMP); gl.glTexParameteri(GL2.GL_TEXTURE_3D, GL2.GL_TEXTURE_WRAP_R, GL2.GL_CLAMP); gl.glTexParameteri(GL2.GL_TEXTURE_3D, GL2.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR); gl.glTexParameteri(GL2.GL_TEXTURE_3D, GL2.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR); setTextureData(gl,buffer,shape); }
private final void freeAllColorbufferImpl(final GL gl) { for(int i=0; i<maxColorAttachments; i++) { final Colorbuffer colbuf = colorbufferAttachments[i]; // shortcut, don't validate here if(null == colbuf) { return; } if( colbuf.isTextureAttachment() ) { final TextureAttachment texA = colbuf.getTextureAttachment(); if( 0 != texA.getName() ) { gl.glFramebufferTexture2D(GL.GL_FRAMEBUFFER, GL.GL_COLOR_ATTACHMENT0 + i, GL.GL_TEXTURE_2D, 0, 0); gl.glBindTexture(GL.GL_TEXTURE_2D, 0); } texA.free(gl); } else { final ColorAttachment colA = colbuf.getColorAttachment(); if( 0 != colA.getName() ) { gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_COLOR_ATTACHMENT0 + i, GL.GL_RENDERBUFFER, 0); } colA.free(gl); } } }
private final void freeAllColorbufferImpl(final GL gl) { for(int i=0; i<maxColorAttachments; i++) { final Colorbuffer colbuf = colorbufferAttachments[i]; // shortcut, don't validate here if(null == colbuf) { return; } if( colbuf.isTextureAttachment() ) { final TextureAttachment texA = colbuf.getTextureAttachment(); if( 0 != texA.getName() ) { gl.glFramebufferTexture2D(GL.GL_FRAMEBUFFER, GL.GL_COLOR_ATTACHMENT0 + i, GL.GL_TEXTURE_2D, 0, 0); gl.glBindTexture(GL.GL_TEXTURE_2D, 0); } texA.free(gl); } else { final ColorAttachment colA = colbuf.getColorAttachment(); if( 0 != colA.getName() ) { gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_COLOR_ATTACHMENT0 + i, GL.GL_RENDERBUFFER, 0); } colA.free(gl); } } }
gl.glBindTexture(GL.GL_TEXTURE_2D, name[0]); if( 0 < magFilter ) { gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, magFilter);