glReadPixels is an OpenGL API function to read pixels data from source framebuffer to destination memory buffer. When FBO is supported, the source could be FBO; when PBO is supported, the destination could be PBO.
Questions tagged [glreadpixels]
200 questions
1
vote
0 answers
glTexImage2D giving GL_INVALID_VALUE because width or height cannot be represented as 2k + 2
I have a screenshot taken from the first opengl canvas which i need to draw in the second opengl canvas. I have taken the screenshot using glReadPixels:
glReadPixels(posx, posy, pageWidth , pageHeight, GL_RGB, GL_UNSIGNED_BYTE, data);
The first…

Manoranjan Aithal
- 11
- 3
1
vote
1 answer
GL_INVALID_FRAMEBUFFER_OPERATION Android NDK GL FrameBuffer and glReadPixels returns 0 0 0 0
My C++ code was designed for iOS and now I ported it to NDK with minimal modifications.
I bind frame buffer and call
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
then I bind main frame buffer like…

Max
- 6,286
- 5
- 44
- 86
1
vote
2 answers
glReadPixels alpha value issue
I am having issues reading back the alpha channel from my OpenGL texture on Android. I call glReadPixels this way:
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
and just as a test, I made a fragment shader looking like…

BlueVoodoo
- 3,626
- 5
- 29
- 37
1
vote
1 answer
glReadPixels usage with glPixelStore
I looked at multiple tutorials about glReadPixels but I'm confused:
void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid * data)
The last argument is a void?
I saw tutorials and they…

abcdef
- 236
- 1
- 5
- 17
1
vote
2 answers
How to make a simple screenshot method using LWJGL?
So basically I was messing about with LWJGL for a while now, and I came to a sudden stop with with annoyances surrounding glReadPixels().
And why it will only read from left-bottom -> top-right.
So I am here to answer my own question since I figured…

Maarten
- 635
- 1
- 9
- 29
1
vote
1 answer
CVOpenGLESTextureCacheCreateTextureFromImage instead of glReadPixels
For 3 full days, I have been trying to improve the performance of my AVAssetWriter which is based on glReadPixels. I have gone through Apple's RosyWriter and Camera Ripple code and Brad Larson's GPUImage but I am still scratching my head. I've also…

BlueVoodoo
- 3,626
- 5
- 29
- 37
1
vote
1 answer
glReadPixels() alpha with overlapping textures
I'm attempting to get the alpha value of a texture with glReadPixel(). The problem I have is once the alpha value pixel is below 0.5f, it starts to combine the alpha value of the background object. I can never get an alpha value of 0.0f thru…

aquawicket
- 524
- 1
- 9
- 27
1
vote
1 answer
Android: glReadpixels larger than viewport?
I need to capture more pixels than the width of the screen contains to save a higher res image. I figure the only two options are to pack more pixels into the screen with some Matrix command, or to make the actual view larger than the screen (which…

Slynk
- 527
- 5
- 9
1
vote
0 answers
glReadPixels not working when multi-sampling is turned on
glReadPixel works well when multi-sampling is not enabled. But when multisampling is enabled, it gives 0x502 opengl error and screen is not captured. After researching a little bit, it seems to be related to resolving multi-samples buffers -…

Simple Golpadia
- 11
- 2
1
vote
1 answer
OpenGL ES on iOS - glReadPixels() returns the image with a black bar on the side
i like to render a simple texture with my fragment shader to 4 vertices and read the image resolution with glReadPixels. I set the (readPixel) size like the (source)picture size but i didn't get a complete image back. There is always a black bar on…

retinotop
- 483
- 11
- 17
0
votes
0 answers
Opengl texturing (with mimap or not) from a FBO
I must be missing something obvious in using FBO :
I call TMyForm::Init() once at the start of my application :
class TMyForm
{ ...
private:
Gluint mTextureId, mFboId;
int mWidth, mHeight;
}
void TMyForm::Init()
{
mWidth = 1920;
…

Arnaud
- 109
- 3
- 15
0
votes
2 answers
Android NDK glReadPixels() from offscreen buffer
I'm writing a game using android ndk. I'm using picking to select objects in opengl.
For that i have an offscreen framebuffer object where i render into and i use glReadPixels() to get the color from the FBO. The color then encodes the id of the…

D-rk
- 5,513
- 1
- 37
- 55
0
votes
0 answers
android GLES20.glReadPixels returned 0 on some devices
I am developing a camera app using OpenGL.
I found that GLES20.glReadPixels works fine but does not work with some devices.
It works smoothly on almost all devices, but only on the Galaxy S10 and Galaxy Note 10 models, glReadPixels returns 0.
And…

SumRok
- 1
0
votes
1 answer
OpenGL: glReadPixels "fails" although glGetError returns 0
Problem summary:
I use OpenGL glReadPixels to get a screenshot but the buffer is unchanged.
If I use glGetError to get the error from the last function, it returns 0, as if everything is fine.
I've researched online throughly and haven't found…

O-z
- 3
- 2
0
votes
1 answer
OpenGL ES - Reducing texture quality and texture size
Is it possible to "degrade" the quality of textures in OpenGL ES? By degrade I mean make the images more pixelated/blocky/blurry etc.
My goal is to reduce the size of textures to help glReadPixels run faster (transfer less bytes from VRAM to…

SundayMonday
- 19,147
- 29
- 100
- 154