im using the default es2 app generated by xCode. so i dont think i screwed up my openGL initialization. also im not doing anything weird with threads, and this is occuring at the very beginning of my program starting up, does anybody have a clue as to why my program is crashing? i cleaned / rebuilt and restarted the iphone simulator many times. the crash occurs at the first glMatrixMode call
Code:
// Create an OpenGL ES 2.0 context
- (id)init
{
if ((self = [super init]))
{
context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
if (!context || ![EAGLContext setCurrentContext:context] || ![self loadShaders])
{
[self release];
return nil;
}
// Create default framebuffer object. The backing will be allocated for the current layer in -resizeFromLayer
glGenFramebuffers(1, &defaultFramebuffer);
glGenRenderbuffers(1, &colorRenderbuffer);
glBindFramebuffer(GL_FRAMEBUFFER, defaultFramebuffer);
glBindRenderbuffer(GL_RENDERBUFFER, colorRenderbuffer);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorRenderbuffer);
}
glEnable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glBindFramebuffer(GL_FRAMEBUFFER, defaultFramebuffer);
glViewport(0,0,backingWidth,backingHeight);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
//glOrthof(0,backingWidth,0,backingHeight,-5.0,5.0);
//glMatrixMode(GL_MODELVIEW);
tex = LoadTexture("test");
GameInit();
return self;
}
*edit* oh yeah and gdb says Program received signal: “EXC_BAD_ACCESS”.
plus my call stack jumps to gliUnimplemented , bad driver?
Last edited by kajjait; 08-31-2010 at 08:07 PM.
Reason: forgot some stuff
ok so i'm pretty sure its because my frame buffer is not initialized properly now, i threw in a glCheckFramebufferStatusOES, and it is returning GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES ... so my assumption is that the interns over at apple are just a bunch of f'n noobs, and i need to write my own code
If you start a new project and select "OpenGL ES Application" does it run okay?
EDIT: Oops I missed you saying that you did. There should be no problem running the default template. What are you running it on? Simulator or hardware?
If you open EAGLView.m and comment out the line "renderer = [[ES2Renderer alloc] init];" does it work then? (ie. Force it to run in OpenGL ES 1.1 mode instead of 2.0)
If you start a new project and select "OpenGL ES Application" does it run okay?
EDIT: Oops I missed you saying that you did. There should be no problem running the default template. What are you running it on? Simulator or hardware?
If you open EAGLView.m and comment out the line "renderer = [[ES2Renderer alloc] init];" does it work then? (ie. Force it to run in OpenGL ES 1.1 mode instead of 2.0)
yeah it will run the es 1.1 code path and my shaders wont work. i think its something i screwed up now, becuase i noticed i had some old es 1.1 includes in my texture loader, and that was using the es1.1 loadidentity and matrix mode functions, and now it doesnt even know what matrixmode or load identity are.... arghh, embedded development is a bitch! i think im just going to revert back to writing 1.1 code and that way my game will run on all iWhatever devices. i'll come back to the shaders at a later date and hopefully get it right. im wasting too much time trying to figure this out and tried everything shy of rewriting all my code.
so i get implicit declaration of LoadIdentity and CheckFramBufferStatusOES. but thats absolutely hilarious to me because load identity is a KEY function call in any version of opengl why does it not know what that is!?!? if i can solve that i'm sure it will fix everything else
that fixes the implicit declaration warning, but my program still crashes on glLoadIdentity , and glMatrixMode. and my framebuffer is still "incomplete attachment", shouldnt the es2 headers have these functions declared? also i'm running on the simulator untill i get my iphone 4. sorry man i'm pulling my hair out on this one i dont think its worth the effort anymore just to have custom shaders
im using the default es2 app generated by xCode. so i dont think i screwed up my openGL initialization. also im not doing anything weird with threads, and this is occuring at the very beginning of my program starting up, does anybody have a clue as to why my program is crashing? i cleaned / rebuilt and restarted the iphone simulator many times. the crash occurs at the first glMatrixMode call
Code:
// Create an OpenGL ES 2.0 context
- (id)init
{
if ((self = [super init]))
{
context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
if (!context || ![EAGLContext setCurrentContext:context] || ![self loadShaders])
{
[self release];
return nil;
}
// Create default framebuffer object. The backing will be allocated for the current layer in -resizeFromLayer
glGenFramebuffers(1, &defaultFramebuffer);
glGenRenderbuffers(1, &colorRenderbuffer);
glBindFramebuffer(GL_FRAMEBUFFER, defaultFramebuffer);
glBindRenderbuffer(GL_RENDERBUFFER, colorRenderbuffer);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorRenderbuffer);
}
glEnable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glBindFramebuffer(GL_FRAMEBUFFER, defaultFramebuffer);
glViewport(0,0,backingWidth,backingHeight);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
//glOrthof(0,backingWidth,0,backingHeight,-5.0,5.0);
//glMatrixMode(GL_MODELVIEW);
tex = LoadTexture("test");
GameInit();
return self;
}
*edit* oh yeah and gdb says Program received signal: “EXC_BAD_ACCESS”.
plus my call stack jumps to gliUnimplemented , bad driver?
Actually, OpenGL ES 2.0 does NOT support glMatrixMode.