views:

198

answers:

4
glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const ovid *pixels);

Is there a function like this, except instead of accessing CPU memory, it accesses GPU memory? [Either a texture of a frame buffer object]

+1  A: 

If it is in a texture:

  • set up orthographic frustum
  • disable blending, depth test, etc.
  • bind texture
  • draw screen-aligned textured quad with correct texture coordinates

I use this in for example in Compositor::_drawPixels

eile
A: 

glDrawPixels can read from a Buffer Object. Just do a

glBindBuffer(GL_PIXEL_UNPACK_BUFFER, XXX)

before calling glDrawPixels.

Caveat: glDrawPixels is deprecated...

Bahbar
@Bahbar what is the non-deprecated solution?
anon
A: 

Use glBlitFramebuffer, which operates on frambuffer objects (Link). Ans this is not deprecated.

You can take advantage of format conversion, scaling and multisampling.

Luca
A: 

Maybe glCopyPixels?

Ben Voigt
reason for downvote?
Ben Voigt