Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 08-31-2010, 07:54 PM   #1 (permalink)
Registered Member
 
Join Date: Aug 2010
Posts: 4
kajjait is on a distinguished road
Default crash on glMatrixMode !?!?

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
kajjait is offline   Reply With Quote
Old 08-31-2010, 11:02 PM   #2 (permalink)
Registered Member
 
Join Date: Aug 2010
Posts: 4
kajjait is on a distinguished road
Default

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

Last edited by kajjait; 08-31-2010 at 11:05 PM.
kajjait is offline   Reply With Quote
Old 09-01-2010, 01:41 AM   #3 (permalink)
Registered Member
 
headkaze's Avatar
 
Join Date: Feb 2010
Posts: 359
headkaze is on a distinguished road
Default

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)

Last edited by headkaze; 09-01-2010 at 01:44 AM.
headkaze is offline   Reply With Quote
Old 09-02-2010, 02:07 AM   #4 (permalink)
Registered Member
 
Join Date: Aug 2010
Posts: 4
kajjait is on a distinguished road
Unhappy

Quote:
Originally Posted by headkaze View Post
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

Last edited by kajjait; 09-02-2010 at 02:13 AM.
kajjait is offline   Reply With Quote
Old 09-02-2010, 02:18 AM   #5 (permalink)
Registered Member
 
headkaze's Avatar
 
Join Date: Feb 2010
Posts: 359
headkaze is on a distinguished road
Default

Try adding

Code:
#include <OpenGLES/ES1/gl.h>
#include <OpenGLES/ES1/glext.h>
headkaze is offline   Reply With Quote
Old 09-02-2010, 02:22 AM   #6 (permalink)
Registered Member
 
Join Date: Aug 2010
Posts: 4
kajjait is on a distinguished road
Default

Quote:
Originally Posted by headkaze View Post
Try adding

Code:
#include <OpenGLES/ES1/gl.h>
#include <OpenGLES/ES1/glext.h>

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

Last edited by kajjait; 09-02-2010 at 02:27 AM.
kajjait is offline   Reply With Quote
Old 09-21-2010, 04:56 PM   #7 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 5
RanReloaded is on a distinguished road
Default

Quote:
Originally Posted by kajjait View Post
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.

I am having the same problem with a call to :
Code:
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
RanReloaded is offline   Reply With Quote
Reply

Bookmarks

Tags
glmatrixmode, opengl

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 355
7 members and 348 guests
dre, freewind, hain, HemiMG, lendo, Newbie123, oceanlablight
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,118
Posts: 402,894
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:01 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0