Questions tagged [glreadpixels]

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.

200 questions
2
votes
3 answers

GLSURFACEVIEW SAVE to PNG - ERROR glReadPixels

I am trying to render the output of a glsurfaceview to a PNG on the sdCard and am having some issues. I have spent a few days trying to sort through similar SO queries and this is simply above my level of expertise. Can someone pls help me sort…
user1540142
  • 185
  • 2
  • 15
2
votes
0 answers

glReadPixels white spots issues

I'm trying to make a screenshot on my iPad with OpenGL ES. This does work, but there are blank spots on them. These blank spots seem to be the rendered object. I've tried using the other buffers aswell, but none of them seem to contain the actual 3D…
Diamondo25
  • 769
  • 1
  • 8
  • 21
2
votes
1 answer

glReadPixels GL_RGBA returning ARGB pixels instead

In NDK, Android. Calling the next instruction to get the viewport pixels. I am expecting the pixels to be in RGBA format, but instead I get ARGB pixels. Is there something wrong or the be set prior to glReadPixels?? void getViewPortPixels(const…
PerracoLabs
  • 16,449
  • 15
  • 74
  • 127
2
votes
2 answers

glReadPixels byte to float

I am trying to retrieve a color in OpenGL ES with glReadPixels. I set my objects' colors with float[], e.g. {0.0f,0.5f,0.2f,1.0f} How can I convert the glReadPixels value to the same float[], since it's unsigned byte? Setting the…
Urho
  • 2,232
  • 1
  • 24
  • 34
2
votes
1 answer

simple 2D collision detection c++

I am kinda new to all this but I am trying to make myself a simple 2D game in c++. I have decided to do a kind of a maze type game and what I am doing for this is drawing out the maze as a texture and then having another texture as my character move…
user1324894
  • 35
  • 1
  • 6
1
vote
3 answers

How to call glReadPixels on different thread?

When I call glReadPixels on another thread, it doesn't return me any data. I read somewhere suggesting that I need to create a new context in the calling thread and copy the memory over. How exactly do I do this? This is the glReadPixels code I…
huy
  • 4,782
  • 6
  • 36
  • 42
1
vote
1 answer

glReadPixel return fault result

I want to do the 3D-picking on OpenGl by the way of frame pick. On this way I need to use glReadPixel to get some information of the pixels on the screen currently, so I test it on the following way but get the wrong result. First , I use Callback …
ZjuTh
  • 13
  • 3
1
vote
2 answers

Creating a HBITMAP from glReadPixels

I need to create a HBITMAP from data returned by a glReadPixels() call: HDC hCompDC = CreateCompatibleDC(NULL); HDC hDC = GetDC(); m_hClipboardBitmap = CreateCompatibleBitmap(hDC, size.cx, size.cy); if ( m_hClipboardBitmap == NULL ) { throw…
user907285
  • 11
  • 3
1
vote
2 answers

glReadPixels - image looks dithered

I wish to capture an image I rendered rendered in openGL. I use glReadPixels and then save the image with CImg. Unfortunately, the result is wrong. See below. The image on the left is correct. I captured it with GadWin PrintScreen. The image on the…
ahoffer
  • 6,347
  • 4
  • 39
  • 68
1
vote
2 answers

glReadPixels read failed on second-time

Following code works fine const char *title = "glReadOutput"; Mat out1, out2; out1.create(screenHeight,screenWidth, CV_8UC3); out2.create(screenHeight,screenWidth, CV_8UC3); RenderObject(); glReadPixels(0, 0, screenWidth, screenHeight, GL_BGR,…
Rudi
  • 700
  • 1
  • 8
  • 19
1
vote
2 answers

glReadPixels returns wrong values

I try to get rendered pixels color. gl.glColor3f(1f, 0, 0); //draw gl.glReadPixels(lastX - pw / 2, MyCanvas.this.getHeight() - (lastY - ph / 2), pw, ph, GL.GL_RED, GL.GL_FLOAT, pixelBuffer); float r, g, b; r =…
michael nesterenko
  • 14,222
  • 25
  • 114
  • 182
1
vote
1 answer

How to draw the data (from gleReadPixels) onto the default (display) farmebuffer in OpenGLES 2.0

Sorry if I am asking something which is already available. So far I could not trace. I read details about FBO and got a fair idea about off-screen buffering. http://mattfife.com/?p=2813 is a nice little article on FBOs. In all the examples,…
1
vote
1 answer

SDL OpenGL screenshot is black

I create a screenshot of my opengl window with help of SDL library, but it was all black and i dont understand why. How to fix it? Code: SDL_Surface * image = SDL_CreateRGBSurface(SDL_SWSURFACE, current_w, current_h, 24, 0x000000FF, 0x0000FF00,…
EthanHunt
  • 473
  • 2
  • 9
  • 19
1
vote
2 answers

Problems with glReadPixels in android

I am trying to implement an opengl picking system I read about and have hit an issue with glReadPixels. Basically, every node in the scene gets a unique color and when a new touch happens, it renders the scene with nothing but the nodes painted with…
Jon Rose
  • 1,457
  • 1
  • 15
  • 25
1
vote
1 answer

Trying to get 3d point from 2d click on screen with openGL

i have a PyOpenGL project. i render a stadium and some pcd clouds. and i want to extract a point from the screen. i have the X,Y values and i am trying to use gluUnProject or glReadPixelsf to get the point in x,y,z. but i am getting weird numbers…
Bob Sfog
  • 105
  • 8