Comments (4)
Hi.
I solved a second problem(cannot free from memory), but I have still a first problem(memory size).
Please, help.
from glview.
Are you loading the animation images by passing an array of strings to the GLImageView, or are you passing an array of images that you've loaded using GLImage?
Also, what format are your images (e.g. PNG, PVR) and how are you loading them?
from glview.
My code ::
NSMutableArray *_frames = [[NSMutableArray alloc] initWithCapacity:1];
GLImageView *_imageView = [[GLImageView alloc] initWithImage:[[GLImage alloc] initWithContentsOfFile:imagePath]];
....
[self loadWildCardFiles:_imageSource inDirectory:_directory toFrames:_frames];
_imageView.animationDuration = _duration;
_imageView.animationRepeatCount = _repeatCount;
_imageView.animationImages = _frames;
[_imageView startAnimating];
- (void)loadWildCardFiles:(NSString *)source inDirectory:(NSString *)directory toFrames:(NSMutableArray *)frames
{
NSString *wildCardPath = [directory stringByAppendingPathComponent:source];
NSString *targetSource = [wildCardPath lastPathComponent];
NSString *targetDirectory = [wildCardPath stringByDeletingLastPathComponent];
NSArray *components = [targetSource componentsSeparatedByString:@"*"];
NSString* file;
NSDirectoryEnumerator* enumerator = [[NSFileManager defaultManager] enumeratorAtPath:targetDirectory];
while (file = [enumerator nextObject])
{
NSUInteger lastRange = 0;
BOOL found = YES;
for(NSUInteger i=0; i<components.count; i++)
{
NSString *component = [components objectAtIndex:i];
if(component.length > 0)
{
NSRange range = [file rangeOfString:component];
if((range.length > 0) && ((range.location == lastRange) || (i > 0 && range.location > lastRange)))
lastRange = range.location + range.length;
else
{
found = NO;
break;
}
}
}
if(!found || (lastRange < file.length))
continue;
NSString *path = [targetDirectory stringByAppendingPathComponent:file];
GLImage *image = [GLImage imageWithContentsOfFile:path];
if(image)
[frames addObject:image];
}
}
image format : png(and pvr is same)
And I just changed from GLImage to UIImage and from GLImageView to UIImageView, checked memory.
from glview.
Sorry, I forgot to follow up on this. Basically to reduce memory, store the array of image paths in your frames array, not the array of GLImages, like this:
NSString *path = [targetDirectory stringByAppendingPathComponent:file];
[frames addObject:path];
For this to work fast enough for real-time, you will probably also need to use PVR images instead of PNG, but you can try it with PNG (it may be fast enough).
from glview.
Related Issues (20)
- How to rotate a GLImageView HOT 1
- How to rotate 3D Model in GLModel Sample ? HOT 1
- Unable to find interface declaration for 'UIColor' HOT 5
- Texture files not fitting properly ? HOT 4
- How to scale the obj file automatically ? HOT 6
- Specifications of creating compatible 3D models ? HOT 1
- 如果修改绘制图片的清晰度呢?
- Please help me import this object and texture. HOT 5
- Antialiasing of the rendered view
- how to rotate and zoom
- EXC_BAD_ACCESS (code=1, address=0x11f0)
- Different transforms, rotations and scales for different objects plus unable to load texture file
- Display vertex colors from OBJ file
- Draw model from OBJ file with MTL and texture file HOT 5
- error when cast type HOT 9
- obj model texture from mtl and png files. HOT 5
- Obj model pivot is not centered
- exc_bad_access
- Have no idea why GLModelView only displays half of the model HOT 5
- Model not displaying
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from glview.