glCopyTexSubImage2D

pkraft
Unregistered
 
Post: #1
Can I use glCopyTexSubImage2D to grab only the alpha buffer into a GL_ALPHA8 texture?

ie if my texture, which I set up already in a different call, is not RGBA, will the copy automatically know to only copy the components that the texture supports, or will it try to mangle the original RGBA data and squeeze it into the texture?

Also, do you know if glCopyTexSubImage2D uses the CPU to copy the data or does it do it with the GPU? (NVidea GeForce 4MX)

Thanks
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #2
It works when copying into luminance textures, so I don't see why not. However I don't think that it's very efficient. If the source and destination factors aren't the same it will have to convert/unpack the bits, presumably with the processor and not the video card.

Experts?
Quote this message in a reply
Member
Posts: 47
Joined: 2004.07
Post: #3
It's a fairly safe bet that you will get CPU conversion of colors when packing. What you likely want to do is to copy it as RGBA - that will get you the fast GPU path. Then you just ignore the RGB components when you use the texture....

Nicholas Francis
http://www.otee.dk
Quote this message in a reply
pkraft
Unregistered
 
Post: #4
Hmm, now that is good to know. I did try it with grabbing into a GL_ALPHA texture. I mean, it's faster than doing a glReadPixels and glDrawPixels. But still noticeably slow. I will definitely have to try it with RGBA format and see if that improves the speed.
Quote this message in a reply
Post Reply