Conflicting Types for '-(int)resizeFromLayer:(CAEAGLLayer *)layer' Warning

Discussion in 'iOS Programming' started by MachCUBED, Feb 14, 2011.

  1. MachCUBED macrumors newbie

    Apr 22, 2010
    Hello everyone, I just got a strange warning that I can't trace. here goes:

    #import <Foundation/Foundation.h>
    #import "EAGLView.h"
    #import "Sprite3D.h"
    #import "Camera.h"
    #import "Particle.h"
    #import "Ring.h"
    #import "ESRenderer.h"
    @interface RingsState : EAGLView <UIAccelerometerDelegate, ESRenderer> {
    	EAGLContext *context;
    	GLint screenX;
    	GLint screenY;

    - (BOOL)resizeFromLayer:(CAEAGLLayer *)layer
    //---warning: Conflicting Types for '-(int)resizeFromLayer:(CAEAGLLayer *)layer'
    	// Allocate color buffer backing based on the current layer size
        glBindRenderbuffer(GL_RENDERBUFFER, colorRenderbuffer);
        [context renderbufferStorage:GL_RENDERBUFFER fromDrawable:layer];
    	glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &backingWidth);
        glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &backingHeight);
    	glBindRenderbuffer(GL_RENDERBUFFER, depthRenderbuffer);
    	glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, backingWidth, backingHeight);
        if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
            NSLog(@"Failed to make complete framebuffer object %x", glCheckFramebufferStatus(GL_FRAMEBUFFER));
            return NO;
        return YES;	

    #import <QuartzCore/QuartzCore.h>
    #import <OpenGLES/EAGL.h>
    #import <OpenGLES/EAGLDrawable.h>
    @protocol ESRenderer <NSObject>
    - (void)render;
    - (BOOL)resizeFromLayer:(CAEAGLLayer *)layer;
    //---warning: Previous Declaration of '-(BOOL)resizeFromLayer:(CAEAGLLayer *)layer'
    EAGLView.h is modified to inherit from a new class called GameState.

    @interface EAGLView : GameState
    GameState inherits from UIView, just as EAGLView used to.

    @interface GameState : UIView {
    	GameStateManager* gsManager;
    resizeFromLayer: is not defined with the return type int in any of my source files. What's going on?
  2. RonC, Feb 14, 2011
    Last edited: Feb 14, 2011

    RonC macrumors regular

    Oct 18, 2007
    A couple of things to check

    I'm not an expert on this area, but it smells like a type mismatch. It's either the return value or the parameter list.

    I suspect that BOOL and int are the same thing internally - int - so that's not the problem. Since this only has one parameter, it must be there.

    Where is CAEAGLLayer defined? According to the documentation, it's in CAEAGLLayer.h. Does that get included in ESRenderer.h?

    If it does, then I'm lost.

    Ron C
  3. MachCUBED, Feb 15, 2011
    Last edited: Feb 18, 2011

    MachCUBED thread starter macrumors newbie

    Apr 22, 2010
    POD File not Rendering in OpenGL ES 2.0, glClearColor working fine

    That's ok, the above problem turned out not to be the best way to solve my problem. This is all part of a huge graphics programming project. I'm basically trying to update the project at to ES 2.0 and its a huge mess. I basically did some code surgery using the OpenGL template, and the menu works fine. However, the game environment isn't being rendered because I haven't figured out how to pass all the relevant stuff to my ES2Renderer.

    UPDATE: I took a totally new approach, using the OpenGL ES template. This time, I've made a subclass of ES2Renderer called PlayTest. I then initialized it as my ES2Renderer in my EAGLView class. Everything compiled just fine, but the object was not rendered on the screen. However, glClearColor worked as it should have. Thus, I now have the relevant classes on


    GameState protocol:

    #import <UIKit/UIKit.h>
    @protocol GameState
    -(void) updateLoop;
    -(BOOL) handleEvent:(void*)event;
    Please bear in mind that to compile this program, you need to download the PowerVR SDK from and copy the main source files to your project directory. Also, GLCommon.h is included in Jeff LaMarche's example project available from this blog post.

    Moderator, please change the topic of the thread to the title of this post.
  4. MachCUBED, Feb 18, 2011
    Last edited: Feb 18, 2011

    MachCUBED thread starter macrumors newbie

    Apr 22, 2010
    deleted due to code being moved to
  5. chown33 macrumors 604

    Aug 9, 2009
    Put the code on pastebin (or a similar site), then paste the URL here.

    If anyone is going to attempt to answer the question, they'll have to grab enough code to compile it themselves. Scrolling through multiple posts here isn't really helping them obtain the code, and it certainly isn't clarifying what the problem is.

    I'm not even sure what the unanswered question is. Oh, wait, I see it buried in post #3. Or maybe not, since there's an Update there that ends by saying "this was fixed". So I still ain't sure what the question is.

Share This Page