Re: FxTexture: -textureId returns zero?
Re: FxTexture: -textureId returns zero?
- Subject: Re: FxTexture: -textureId returns zero?
- From: Steve Christensen <email@hidden>
- Date: Mon, 24 Mar 2008 13:11:07 -0700
On Mar 24, 2008, at 9:36 AM, Darrin Cardani wrote:
On Mar 24, 2008, at 8:19 AM, Steve Christensen wrote:
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.
Well, now that I know I can at least deal with it.
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.
I've filed a couple of bugs:
rdar://5816382 - request to flesh out the FxTexture documentation in
particular and the SDK documentation in general, both headers and
HTML/PDF docs
rdar://5816484 - feature request to add a new initializer to
FxTexture that does actually create a texture
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Pro-apps-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden