Login  Register

Re: glReadBuffer() behavior on MAC

Posted by Sven Gothel on Jan 29, 2013; 3:01pm
URL: https://forum.jogamp.org/glReadBuffer-behavior-on-MAC-tp4028039p4028043.html

On 01/29/2013 03:33 PM, gouessej [via jogamp] wrote:
> AWT GLCanvas uses CALayer under Mac OS X 10.7, not under Windows. Maybe Sven
> can confirm whether or not it can cause some troubles with FBOs.

Yes, if you must select the read buffer manually via glReadBuffer(..) [GL2, GL3, ..]
you need to use a valid buffer name - which is different in case of FBO usage.

FBO usage can be queried via the chosenGLCapabilities() of the GL[Auto]Drawable.

Here is a copy/paste of GLBase's getDefaultReadBuffer() method 'helper'
you may like to utilize:

   /**
    * Returns the default color buffer within the current bound
    * {@link #getDefaultReadFramebuffer()}, i.e. GL_READ_FRAMEBUFFER,
    * which will be used as the source for pixel reading commands,
    * like {@link GL#glReadPixels(int, int, int, int, int, int, java.nio.Buffer)} etc.
    * <p>
    * For offscreen framebuffer objects this is {@link GL#GL_COLOR_ATTACHMENT0},
    * otherwise this is {@link GL#GL_FRONT} for single buffer configurations
    * and {@link GL#GL_BACK} for double buffer configurations.
    * </p>
    */
   public int getDefaultReadBuffer();

~Sven



signature.asc (911 bytes) Download Attachment