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 06-19-2009, 05:20 PM   #1 (permalink)
Registered Member
 
Join Date: Apr 2009
Posts: 23
Rozik is on a distinguished road
Default Multiple OpenGL Subviews?

Hello everyone,

I would like to have multiple openglViews in my application. even multiple openGl subviews on one parent view.

Everything works fine with one opengl view i add but every additional view i add wont render anything. I thought i would have to create a render buffer and framebuffer per subview but somehow that doesnt help or maybe doesnt happen.

Here is some code how i create my framebuffers and render buffers in each view:

Code:
- (BOOL)createFramebuffer {   
	
    glGenFramebuffersOES(1, &viewFramebuffer);
    glGenRenderbuffersOES(1, &viewRenderbuffer);
	
	NSLog(@"FRAMEBUFFER  : %i",viewFramebuffer);
	NSLog(@"RENDERBUFFER : %i",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;
}
Weird thing is for every view i create the values logged for the framebuffer and render buffer are 1 and 1

i tried this too:

Code:
    glGenFramebuffersOES(num_ofViews, &viewFramebuffer);
    glGenRenderbuffersOES(num_ofViews, &viewRenderbuffer);
but that didn't help either :-(

If anyone had some idea for me it would be much appreciated!

I have been stuck on this for 3 days now and cant figure it out:-(

Thx a lot in advance!

Wolfgang
Rozik is offline   Reply With Quote
Old 06-20-2009, 02:01 AM   #2 (permalink)
iPhone App Developer
 
chbeer's Avatar
 
Join Date: Sep 2008
Location: Berlin, Germany
Posts: 229
chbeer is on a distinguished road
Default

I am sure the iPhone can't handle more than one opengl view at once. Its graphics processor is not fast enough. Can you do that on a mac?
__________________
Learn vocabularies on iPhone? iVocabulary!
chbeer is offline   Reply With Quote
Old 06-20-2009, 02:18 AM   #3 (permalink)
Registered Member
 
Join Date: Apr 2009
Posts: 23
Rozik is on a distinguished road
Default

I am not sure if its possible to have more than one OpenGl subviews but it has to be possible to have more than one opengl view so you can load and unload them.

I dont want all of them animated at the same time. And if so i would run int all in one loop which should work fine.

The problem looks like the render and framebuffers get mixed up so only the first buffers i create are ever used.

Just for some more info, in my render method i set the open gl frame and render buffer to the render and frame buffer of that view. Which i thought should work but somehow all frame and renderbuffers in all views i create have the same value:-(

Thx for your response though
Rozik is offline   Reply With Quote
Old 06-20-2009, 03:54 AM   #4 (permalink)
Registered Member
 
Join Date: Apr 2009
Posts: 23
Rozik is on a distinguished road
Default

If anyone cares for some information:

i managed to create different buffer identifiers by moving the create framebuffer from layoutSubviews to viewDidLoad.

Which is one step in the right direction i think.

But now i get GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES when trying to create the framebuffer for every framebuffer but the first
Rozik is offline   Reply With Quote
Old 05-19-2010, 01:00 PM   #5 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 1
deciphermedia is on a distinguished road
Default

Quote:
Originally Posted by Rozik View Post
But now i get GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES when trying to create the framebuffer for every framebuffer but the first
Have you called glFramebufferRenderbufferOES to attach the new renderbuffer to your frame buffer? I had a similar problem to yours and that is what fixed it.

Code:
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, colorRenderbuffer);
Hope this helps someone !
deciphermedia is offline   Reply With Quote
Old 11-18-2011, 02:05 PM   #6 (permalink)
Registered Member
 
mediaspree's Avatar
 
Join Date: Sep 2011
Posts: 179
mediaspree is on a distinguished road
Default

Ressurecting this one from the dead, was there ever a solution to creating two opengl subviews in one view?
mediaspree is offline   Reply With Quote
Reply

Bookmarks

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: 334
8 members and 326 guests
chiataytuday, givensur, ipodphone, jbro, mtl_tech_guy, Punkjumper, vilisei, yomo710
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,649
Threads: 94,113
Posts: 402,881
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Anwerbl
Powered by vBadvanced CMPS v3.1.0

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