Nav Link On

iPhone Dev Forums > General Development > OpenGL ES Development > glTexSubImage with pitch/stride?

Reply

 

LinkBack Thread Tools Display Modes
Old 03-17-2010, 09:43 AM   #1 (permalink)
Junior Member
Default Avatar
 
Join Date: Mar 2010
Posts: 1
Default glTexSubImage with pitch/stride?

Hi,

I'm working on an application where it's necessary to update sub rectangles of a big master texture. I basically have a software generated image buffer of say 1024x512 where I need to update say 128x64 subrects every now and then.

in OpenGL I can use this code:

char *data = image.data + (x + y * image.width) * 4;
glPixelStorei(GL_UNPACK_ROW_LENGTH, image.width);
glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, GL_RGBA, GL_UNSIGNED_BYTE, data);

How do I go about doing this in ES efficiently?

All I can think of is to either copy the new data to a temporary buffer and update, or to update it line by line. Neither of these seems very efficient. Is there a better way?

Thanks,
Peter
ppettersson is offline   Reply With Quote
Old 04-05-2010, 12:19 PM   #2 (permalink)
Junior Member
Default Avatar
 
Join Date: Apr 2010
Location: Bangalore
Posts: 3
Default

Go For RenderToTexture technique. Its the best approach and will give fastest performance for this task.

u need to create a separate framebuffer and a texture and bind them together.
rajavanya is offline   Reply With Quote
Reply

iPhone Dev Forums > General Development > OpenGL ES Development


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0 RC1