glTexSubImage2D slow

i am trying to display a sequence of bitmaps which i need to generate on the fly. However, when using the ofImage.draw(int,int) function i get very poor performance (about 5fps). Tracing through the code i found that the glTexSubImage2D call is taking the majority of time.

given that it’s possible to display video at 30fps i figure there must be a faster way. any ideas?

are you sure? the ofImage::draw() just draws the texture. the function you are talking about happens in ofTexture::loadData(), which doesn’t happen in the draw routine of ofImage.

It sounds like you have something wrong – can you check that you are not reloading the image repeatedly (ie, calling loadImage in update() or draw()) ? also, if you comment out the draw, do you see a huge speed increase?

if you are still having problems, you might post the code so we can take a look.

take care,
zach

ps: is this an iphone related post ?? wondering b/c you mention video playback speeds.

[quote author=“zach”]are you sure? the ofImage::draw() just draws the texture. the function you are talking about happens in ofTexture::loadData(), which doesn’t happen in the draw routine of ofImage.

It sounds like you have something wrong – can you check that you are not reloading the image repeatedly (ie, calling loadImage in update() or draw()) ? also, if you comment out the draw, do you see a huge speed increase?

if you are still having problems, you might post the code so we can take a look.

take care,
zach

ps: is this an iphone related post ?? wondering b/c you mention video playback speeds.[/quote]

hi zach

yes, my mistake, glTexSubImage2D doesn’t get called via draw.

however, it does get called via update() which i need to call everytime i modify the image. and since i need to change the image everytime i call draw, glTexSubImage2D gets called all the time.

i have commented out glTexSubImage2D in ofTexture.cpp and got a huge increase in speed (my app runs a 60fps).

and yes this is on the iphone.

thanks
mo

Hey Mo, yea glTexSubImage2D is usually quite slow, even on desktop systems if you try to upload a high resolution texture every frame you will see serious slow down (though most modern systems can handle pretty high res). What resolution is the data you are trying to send?

hey memo - i’d like to do it at full screen resolution. my thought is just that it must be possible to do this since videos can obviously be played in realtime on the iphone. any idea how this is accomplished. maybe there is a different opengl call i can use or an apple library call?