Re: Pointers and NSImages
Re: Pointers and NSImages
- Subject: Re: Pointers and NSImages
- From: Lorenzo <email@hidden>
- Date: Fri, 03 Nov 2006 02:17:22 +0100
Hi Eric,
I wrote that way just to semplify the concept... but I noted that I got a
bad result. Indeed myPict is an NSObject containg an openGL texture which
has a lot of parameters, memory blocks, repeating blocks, pointers to
bind...
There are GL_TEXTURE_2D and GL_TEXTURE_RECTANGLE_EXT textures, image and
movie textures, with hundreds variables and 72 methods.
So the best way to get rid of it is to deallocate it at all. That's why I
lose the pointer. Of course I know that NSImage* is a pointer.
The problem is that I have to centralize all the available textures so all
the geometric objects can use the same texture. No problem, when I link a
texture to the geometric object I retain it once more, so when all the
geometric objects have been released the retain count of the texture go to
zero. It works well for years.
And I don't' want to use a c-array to gather all the textures. I would
prefer an NSDictionary, which is easier for many reason. But I have to use a
pointer to acceed to the bind-texture variable. I cannot acceed to the
bind-texture by a NSString key because it is too slow in a 60 FPS refresh
rate.
Actually I just rebind all the geometric objects to the (eventually) new
texture any time I replace one. But it's not practical. There are many kinds
of objects from different subclasses and I don't want to implement the same
method to all the classes because it should be redundant.
Anyway I am going to explore the way to reload the texture without
deallocating the NSObject. It's a jungle but maybe it's the best way.
Thanks.
Best Regards
--
Lorenzo
email: email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden