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);

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.

[QUOTE=carsten neumann;1260103]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.[/QUOTE]

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_RENDERBUFFER, GLES20.GL_RGBA4 , wi,he);
GLES20.glFramebufferRenderbuffer(GLES20.GL_FRAMEBUFFER, 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);

Please use [noparse]


[/noparse] 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.

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.

Thank you all. It works