Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have with me an iOS app for iPad which creates a few fire simulations over a png.Well,its working well exactly how we wanted it but when we are testing it on a device,we get an extra fire simulation.Heres the screen:

iPad Simulator:

This is how it should display (iPad simulator)

iPad Device:

This is how it's displaying (iPad device)

EDIT:

Thanks for your responses.I hoped that the response here wouldn't be strong enough so i didn't place the code previously.Apologies.

This is a snippet from my FireplacesAnimation.m which is responsible for generating the emitter

-(ParticleEmitter *)generateParticle
{
Texture *particleTexture = [[Texture alloc] initWithName:@"particle.png"]; 
return [[ParticleEmitter alloc] initParticleEmitterWithTexture:particleTexture
                                                      position:Vector2fMake(0, 0)
                                        sourcePositionVariance:Vector2fMake(100, 10)
                                                         speed:5.25f
                                                 speedVariance:0.2f
                                              particleLifeSpan:0.75f    
                                      particleLifespanVariance:0.25f
                                                         angle:90.0f
                                                 angleVariance:0
                                                       gravity:Vector2fMake(0.0f, 0.5f)
                                                    startColor:Color4fMake(1.0f, 0.0f, 0.0f, 1.0f)
                                            startColorVariance:Color4fMake(0.2f, 0.2f, 0.2f, 1.0f)
                                                   finishColor:Color4fMake(1.0f, 1.0f, 0.3f, 0.0f)  
                                           finishColorVariance:Color4fMake(0.4f, 0.4f, 0.4f, 0.0f)
                                                  maxParticles:500
                                                  particleSize:20
                                          particleSizeVariance:50
                                                      duration:500.0f
                                                 blendAdditive:YES];}

and i am using the following code to create the frame buffer:

(BOOL)createFramebuffer {

glGenFramebuffersOES(1, &viewFramebuffer);
glGenRenderbuffersOES(1, &viewRenderbuffer);

glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
[context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:(CAEAGLLayer*)self.layer];
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, viewRenderbuffer);

glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);

if (USE_DEPTH_BUFFER) {
    glGenRenderbuffersOES(1, &depthRenderbuffer);
    glBindRenderbufferOES(GL_RENDERBUFFER_OES, depthRenderbuffer);
    glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH_COMPONENT16_OES, backingWidth, backingHeight);
    glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES, GL_RENDERBUFFER_OES, depthRenderbuffer);
}

if(glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES) != GL_FRAMEBUFFER_COMPLETE_OES) {
    NSLog(@"failed to make complete framebuffer object %x", glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES));
    return NO;
}

return YES;

}

aand.. drawview:

(void)drawView {
if(fireStopcount > 75){    
self.alpha = 1.0;
static BOOL viewInitialized = NO;
static CFTimeInterval lastTime;

CFTimeInterval time;
time = CFAbsoluteTimeGetCurrent();

float delta = (time - lastTime);
lastTime = time;    
// Replace the implementation of this method to do your own custom drawing

[explosion1 update:delta];
[explosion2 update:delta];
[explosion3 update:delta];

[EAGLContext setCurrentContext:context];
//NSLog(@"Draw Animation Fire Places View");
glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);

if(!viewInitialized)
{
    //viewInitialized = YES;
    glViewport(0, 0, backingWidth, backingHeight);

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();

    glOrthof(0.0f, 320.0f, 0.0f, 480.0f, -100.0f, 100.0f);
    glMatrixMode(GL_MODELVIEW);

    glDisable(GL_DEPTH_TEST);
    glEnable(GL_TEXTURE_2D);
    glEnable(GL_BLEND);

}

glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);

if(explosion1.active != YES)
{
    explosion1.angle = 90.0f;
    explosion1.particleSize = 20.0f;
    explosion1.sourcePosition = [self firstFirePlacePoint];
    explosion1.active = YES;
    explosion1.duration = rand() % 2 + 1;
    explosion1.sourcePositionVariance = Vector2fMake(20,20);
}    

if(explosion2.active != YES)
{
    explosion2.angle = 90.0f;
    explosion2.sourcePosition = [self secondFirePlacePoint];
    explosion2.active = YES;
    explosion2.duration = rand() % 2 + 1;
    explosion2.sourcePositionVariance = Vector2fMake(20,20);
}

if(explosion3.active != YES)
{
    explosion3.angle = 90.0f;
    explosion3.sourcePosition = [self thirdFirePlacePoint];
    explosion3.active = YES;
    explosion3.duration = rand() % 2 + 1;
    explosion3.sourcePositionVariance = Vector2fMake(20,20);
}

[explosion1 renderParticles];
[explosion2 renderParticles];
[explosion3 renderParticles];

glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
[context presentRenderbuffer:GL_RENDERBUFFER_OES];
} 
else
{
fireStopcount++;
}}

Thanks for your time guys.

share|improve this question
2  
Your image links seem broken. Without code, how are we supposed to be able to help you? –  ashes999 Jun 23 '12 at 14:19
    
supplied the code.I was not allowed to place images.So i linked them instead.Awaiting response.. –  Nezam Jun 25 '12 at 13:47
    
Oh, didn't realize you need permissions for images. I have updated your post to include the images instead of links. –  ashes999 Jun 25 '12 at 14:08
add comment

1 Answer

I can't comment on your method of producing fire as you haven't shared any code, so I'm going to suggest a new one for creating fire.

http://particledesigner.71squared.com/

Download that and take a look at the fire animations on there. In the meantime edit your answer with some code and a little bit more about the framework you're using (if you're using one), for example cocos2d.

share|improve this answer
    
edited with code.While you look at it,i shall look at your link inshallah.Using opengl with quartz framework. –  Nezam Jun 25 '12 at 13:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.