Is it possible to store NSBitmapImageRep
copy to NSMutableDictionary
or NSMutableArray
? I need to save copy of OpenGL texture somewhere so, that I could use it later. So if I would do glReadPixels
, store readed pixels to NSBitmapImageRep
and somehow store it to NSMutableDictionary
or NSMutableArray
will it work? Or maby there are some other ways to do it?
Asked
Active
Viewed 77 times
0

hockeyman
- 1,141
- 6
- 27
- 57
-
1`NSBitmapImageRep` is an object. What's wrong with just putting it in an array? – sudo rm -rf Sep 10 '12 at 13:33
-
I'm just asking if it would work. Thank you for answer. I'll check it out just right now – hockeyman Sep 10 '12 at 13:34
-
By the way, doesn't array stores only pointers to objects? – hockeyman Sep 10 '12 at 13:35
-
1Yes, you can store any `NSObject` descendant in an array or dictionary. That's what they're for. Are you having trouble doing this? *What have you actually tried*? – Jonathan Grynspan Sep 10 '12 at 13:39
-
1For clarification, you can add your object to an array or dictionary for later reference, but this will not create a copy of the object. – waldrumpus Sep 10 '12 at 13:48
1 Answers
1
Yes, you can store it in an array / dictionary. If you specifically want to make a copy of the bitmap rep before you put it in an array, you can do so.
[array addObject:[bitmapRep copy]];

sudo rm -rf
- 29,408
- 19
- 102
- 161