Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Can I use glTexImage2D() and / or glTexSubImage2D() (or maybe there's some other method I don't know about) with an already existing block of memory, instead of always uploading the changed pixels? I already have the changed pixels somewhere in memory, and I'd like to send a pointer to that location if possible.

The problem is that I'm likely going to update a large amount of pixels, and uploading all of them introduces a lot of overhead and wasted memory. And since the application will only run on a mobile device without dedicated GPU memory, all I'm doing now is copying a big chunk of memory to another location of the same memory...

Also, I'm looking for a solution that would work on iOS devices, since the application will only run on iOS.

share|improve this question

1 Answer 1

Yes, you can. But not with glTexImage2D, as the just uploads image data to the gpu.

What you can do however, is by binding the texture to a pixel buffer, and then mapping the pixel buffer to memory by using glMapBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, ID).

This will give you a point to the pixel data.

share|improve this answer
    
Be aware that using a PBO will also give you a 2x memory overhead - once for the PBO and once for the texture. Also beware of pipeline stalls when mapping. –  Darth Satan May 20 '12 at 18:28
    
Unfortunately, this won't work on iOS (which implements OpenGL ES 2.0). –  rid May 22 '12 at 12:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.