Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MachCUBED

macrumors newbie
Original poster
Apr 22, 2010
11
0
Hello everyone, I just got a strange warning that I can't trace. here goes:
RingsState.h

Code:
#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;
	
	...
}	

...

RingsState.mm

Code:
...
- (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);
	
	// ADDED DEPTH BEGIN
	glBindRenderbuffer(GL_RENDERBUFFER, depthRenderbuffer);
	glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, backingWidth, backingHeight);
	// ADDED DEPTH END
	
    if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
	{
        NSLog(@"Failed to make complete framebuffer object %x", glCheckFramebufferStatus(GL_FRAMEBUFFER));
        return NO;
    }
	
    return YES;	
}
...

ESRenderer.h

Code:
#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'

@end

EAGLView.h is modified to inherit from a new class called GameState.

Code:
...
@interface EAGLView : GameState
{    
	...
}
...

GameState inherits from UIView, just as EAGLView used to.

Code:
...
@interface GameState : UIView {
	GameStateManager* gsManager;
}
...

resizeFromLayer: is not defined with the return type int in any of my source files. What's going on?
 
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
 
Last edited:
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 http://sourceforge.net/projects/iphonegamebook/files/iPhoneGameBook_CH5/ 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 Pastebin.com:

ES2Renderer.h
ES2Renderer.m
PlayTest.h
PlayTest.mm
Ship.h
Ship.mm
Sprite3D.h
Sprite3D.mm
Model.h
Model.mm
GLProgram.h
GLProgram.m

GameState protocol:

Code:
#import <UIKit/UIKit.h>


@protocol GameState

-(void) updateLoop;

@optional
-(BOOL) handleEvent:(void*)event;

@end

Please bear in mind that to compile this program, you need to download the PowerVR SDK from imgtec.com 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.
 
Last edited:
deleted due to code being moved to Pastebin.com
 
Last edited:
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.