Re: FxTexture: -textureId returns zero?
site_archiver@lists.apple.com Delivered-To: pro-apps-dev@lists.apple.com On Mar 24, 2008, at 8:19 AM, Steve Christensen wrote: Darrin -- Darrin Cardani dcardani@apple.com _______________________________________________ Do not post admin requests to the list. They will be ignored. Pro-apps-dev mailing list (Pro-apps-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/pro-apps-dev/site_archiver%40lists.ap... I'm calling [[FxTexture alloc] initWithInfo:textureInfo] to create a FxTexture, which succeeds. When I then call -textureId, it returns zero. Yet when I call -textureId on the input texture, I get a non- zero value. Am I missing something? The documentation on FxTexture is pretty much non-existent so I don't know what I'm doing wrong or what more I should be doing. Sorry about the poor documentation. I had to actually look at the source to figure out what's going on. FxTextures are a very thin wrapper around OpenGL textures. The framework attempts to make no assumptions about what you are trying to do with the texture, so it doesn't do anything more than what you tell it. As such, there are no methods which will create the texture ID for you. Because FxTextures don't take ownership of the OpenGL resources, there's no way for it to safely do that. So what it's expecting you to do is create the texture yourself and tell it what the texture ID is. There are a couple ways you can do that. You can create the texture ahead of time by calling glGenTextures () and passing the resulting texture ID to [-FxTexture initWithInfo:AndTextureID:]. Or you can call [-FxTexture initWithInfo:] and later call [-FxTexture setTextureID:]. But whatever you do, it's up to you to create the texture ID and tell the FxTexture object about it. (You'll also need to tell it which target you uploaded the texture to by calling [-FxTexture setTarget].) Would you find it useful if we had a method which created the texture ID for you? We might be able to add something like that in the future if there's a lot of need for it. This email sent to site_archiver@lists.apple.com
participants (1)
-
Darrin Cardani