Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: how to render in the viewport display of more than?

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2014
    Posts
    6

    how to render in the viewport display of more than?

    GLES20 Android

    Hi all,

    how to render in the viewport display of more than? for example GLES20.glViewport (0, 0, 5000, 5000);

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Apr 2010
    Posts
    867
    I think the wiki page on Frame Buffer Objects is what you are looking for, they allow you to render to textures where the size is independent of the application window size (but still subject to certain size limits).
    If that is not what you are looking for, please provide more details on what you are trying to do and where you are running into problems.

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2014
    Posts
    6
    Quote Originally Posted by carsten neumann View Post
    I think the wiki page on Frame Buffer Objects is what you are looking for, they allow you to render to textures where the size is independent of the application window size (but still subject to certain size limits).
    If that is not what you are looking for, please provide more details on what you are trying to do and where you are running into problems.
    GLES20
    I need to use to get the picture and glReadPixels​ 5000 to 5000, without the use of textures

    like this

    wi=5000;
    he=5000;

    GLES20.glViewport(0, 0, wi, he);
    Matrix.orthoM(mProjMatrix, 0, -wi/2,wi/2 , -he/2, he/2, 1, 10);
    frame = new int[1];
    GLES20.glGenFramebuffers(1, frame, 0);
    int fboId = frame[0];
    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, fboId);
    int[] renderbuffers = new int[1];
    GLES20.glGenRenderbuffers(1, renderbuffers, 0);
    GLES20.glBindRenderbuffer(GLES20.GL_RENDERBUFFER, renderbuffers[0]);
    GLES20.glRenderbufferStorage(GLES20.GL_RENDERBUFFE R, GLES20.GL_RGBA4 , wi,he);
    GLES20.glFramebufferRenderbuffer(GLES20.GL_FRAMEBU FFER, GLES20.GL_DEPTH_ATTACHMENT, GLES20.GL_RENDERBUFFER, renderbuffers[0]);

    //render...

    //mPixelBuf - Houses the picture 5000x5000

    GLES20.glReadPixels(0, 0,wi, hi, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, mPixelBuf);

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Apr 2010
    Posts
    867
    Please use [code][/code] around source code to preserve formatting, thanks.

    Your FBO only has a depth attachment, you also need a color attachment where the actual picture you are rendering is stored - before calling glReadPixels() use glReadBuffer() to select your color attachment as the source.

  5. #5
    Intern Contributor
    Join Date
    Mar 2014
    Location
    San Jose, CA
    Posts
    58
    The renderbuffer allocated in the code has format RGBA4, so it would not be valid as a depth attachment. This renderbuffer was probably supposed to be attached as a color attachment. The second argument to glFramebufferRenderbuffer() will have to be GL_COLOR_ATTACHMENT0 instead of GL_DEPTH_ATTACHMENT in this case.

    If a depth attachment is needed as well, that one will have to be allocated with a format of GL_DEPTH_COMPONENT16.

    Also, 5000x5000 is a large size. Since ES 2.0 is used, I figure we're talking about mobile devices. Many of them will have size limits on the render target that are smaller than this.

  6. #6
    Junior Member Newbie
    Join Date
    Apr 2014
    Posts
    6
    Thank you all. It works
    Last edited by Argonaft; 06-25-2014 at 10:48 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •