/** * For GLES3, sampling-sink {@link Colorbuffer} <i>internal format</i> <b>must be equal</b> w/ the sampling-source {@link Colorbuffer}. * Implementation aligns w/ {@link #createColorTextureAttachment(GLProfile, boolean, int, int, int, int, int, int)} * and {@link #createColorAttachment(boolean)}. */ private final boolean sampleSinkExFormatMismatch(final GL gl) { if( null != samplingColorSink && getColorbufferCount() > 0 && gl.isGL2ES3() ) { final Attachment ca = (Attachment)getColorbuffer(0); // should be at attachment-point 0 // We cannot comply w/ attachment's format other than attachment point 0! // return ( null != ca && ca.format != samplingColorSink.getFormat() ) || // hasAlpha(samplingColorSink.getFormat()) != hasAttachmentUsingAlpha(); return null != ca && ca.format != samplingColorSink.getFormat(); } return false; }
/* pp */ final void validateGL(final GL gl) throws GLException { if( imageBuffer != null && !gl.isGL2ES3()) { throw new GLException("Using image-buffer w/ inssufficient GL context: "+gl.getContext().getGLVersion()+", "+gl.getGLProfile()); } }
rgba8Avail = gl.isGL2ES3() || gl.isExtensionAvailable(GLExtensions.OES_rgb8_rgba8); depth24Avail = fullFBOSupport || gl.isExtensionAvailable(GLExtensions.OES_depth24); depth32Avail = fullFBOSupport || gl.isExtensionAvailable(GLExtensions.OES_depth32);
if(gl.isGL2ES3()) { final GL2ES3 gl2es3 = gl.getGL2ES3(); gl2es3.glPixelStorei(GL2ES3.GL_PACK_ROW_LENGTH, panelWidth);
private final void restorePack(final GL gl) { if( gl.isGL2() ) { gl.getGL2().glPopClientAttrib(); } else { gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, cachePack[0]); if( gl.isGL2ES3() ) { gl.glPixelStorei(GL2ES3.GL_PACK_ROW_LENGTH, cachePack[1]); gl.glPixelStorei(GL2ES3.GL_PACK_SKIP_ROWS, cachePack[2]); gl.glPixelStorei(GL2ES3.GL_PACK_SKIP_PIXELS, cachePack[3]); if( gl.isGL2GL3() ) { gl.glPixelStorei(GL2GL3.GL_PACK_SWAP_BYTES, cachePack[4]); gl.glPixelStorei(GL2GL3.GL_PACK_LSB_FIRST, cachePack[5]); gl.glPixelStorei(GL2GL3.GL_PACK_IMAGE_HEIGHT, cachePack[6]); gl.glPixelStorei(GL2GL3.GL_PACK_SKIP_IMAGES, cachePack[7]); } } } }
final GL2ES3 gl2es3; final int readBuffer; if( gl.isGL2ES3() ) { gl2es3 = gl.getGL2ES3(); readBuffer = gl2es3.getDefaultReadBuffer();
private final void restoreUnpack(final GL gl) { if( gl.isGL2() ) { gl.getGL2().glPopClientAttrib(); } else { gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, cacheUnpack[0]); if( gl.isGL2ES3() ) { gl.glPixelStorei(GL2ES2.GL_UNPACK_ROW_LENGTH, cacheUnpack[1]); gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_ROWS, cacheUnpack[2]); gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_PIXELS, cacheUnpack[3]); gl.glPixelStorei(GL2ES3.GL_UNPACK_IMAGE_HEIGHT, cacheUnpack[4]); gl.glPixelStorei(GL2ES3.GL_UNPACK_SKIP_IMAGES, cacheUnpack[5]); if( gl.isGL2GL3() ) { gl.glPixelStorei(GL2GL3.GL_UNPACK_SWAP_BYTES, cacheUnpack[6]); gl.glPixelStorei(GL2GL3.GL_UNPACK_LSB_FIRST, cacheUnpack[7]); } } } } }
/** * Resets PACK pixel storage modes to their default value. */ public final void resetPack(final GL gl) { // Compared w/ ES2, ES3 and GL3-core spec gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, 4); // es2, es3, gl3 if( gl.isGL2ES3() ) { gl.glPixelStorei(GL2ES3.GL_PACK_ROW_LENGTH, 0); // es3, gl3 gl.glPixelStorei(GL2ES3.GL_PACK_SKIP_ROWS, 0); // es3, gl3 gl.glPixelStorei(GL2ES3.GL_PACK_SKIP_PIXELS, 0); // es3, gl3 if( gl.isGL2GL3() ) { gl.glPixelStorei(GL2GL3.GL_PACK_SWAP_BYTES, GL.GL_FALSE); // gl3 gl.glPixelStorei(GL2GL3.GL_PACK_LSB_FIRST, GL.GL_FALSE); // gl3 if( gl.getContext().getGLVersionNumber().compareTo(GLContext.Version120) >= 0 ) { gl.glPixelStorei(GL2GL3.GL_PACK_IMAGE_HEIGHT, 0); // gl3, GL_VERSION_1_2 gl.glPixelStorei(GL2GL3.GL_PACK_SKIP_IMAGES, 0); // gl3, GL_VERSION_1_2 } } } } /**
final GL2ES3 gl2es3; final int readBuffer; if( gl.isGL2ES3() ) { gl2es3 = gl.getGL2ES3(); readBuffer = gl2es3.getDefaultReadBuffer();
if(res) { psm.setPackAlignment(gl, alignment); if(gl.isGL2ES3()) { final GL2ES3 gl2es3 = gl.getGL2ES3(); gl2es3.glPixelStorei(GL2ES3.GL_PACK_ROW_LENGTH, width);
/** * Resets UNPACK pixel storage modes to their default value. */ public final void resetUnpack(final GL gl) { // Compared w/ ES2, ES3 and GL3-core spec gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 4); // es2, es3, gl3 if( gl.isGL2ES3() ) { gl.glPixelStorei(GL2ES2.GL_UNPACK_ROW_LENGTH, 0); // es3, gl3 gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_ROWS, 0); // es3, gl3 gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_PIXELS, 0); // es3, gl3 if( gl.isGL2GL3() ) { if( gl.getContext().getGLVersionNumber().compareTo(GLContext.Version120) >= 0 ) { gl.glPixelStorei(GL2ES3.GL_UNPACK_IMAGE_HEIGHT, 0); // es3, gl3, GL_VERSION_1_2 gl.glPixelStorei(GL2ES3.GL_UNPACK_SKIP_IMAGES, 0); // es3, gl3, GL_VERSION_1_2 } gl.glPixelStorei(GL2GL3.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE); // gl3 gl.glPixelStorei(GL2GL3.GL_UNPACK_LSB_FIRST, GL.GL_FALSE); // gl3 } else { gl.glPixelStorei(GL2ES3.GL_UNPACK_IMAGE_HEIGHT, 0); // es3, gl3, GL_VERSION_1_2 gl.glPixelStorei(GL2ES3.GL_UNPACK_SKIP_IMAGES, 0); // es3, gl3, GL_VERSION_1_2 } } } /**
if( gl.isGL2ES3() ) { gl.glGetIntegerv(GL2ES3.GL_PACK_ROW_LENGTH, cachePack, 1); gl.glGetIntegerv(GL2ES3.GL_PACK_SKIP_ROWS, cachePack, 2);
if( gl.isGL2ES3() ) { gl.glGetIntegerv(GL2ES2.GL_UNPACK_ROW_LENGTH, cacheUnpack, 1); gl.glGetIntegerv(GL2ES2.GL_UNPACK_SKIP_ROWS, cacheUnpack, 2);
final int[] tmp = new int[1]; final GL rootGL = gl.getRootGL(); if( rootGL.isGL2ES3() ) { // FIXME remove if ES2 == ES3 later final GL2ES3 gl2es3 = rootGL.getGL2ES3(); gl2es3.glGenVertexArrays(1, tmp, 0);