Login Action Required

The NinevehGL Forum uses a new concept of "socialized forum" or as we like to say "Tweet Forum".

Here is the deal:
  1. No new registration is required. Just sign in with your Twitter account and authorize the NinevehGL Forum.
  2. Once you’re in, you'll be able to "Follow a Thread", that means every time that thread receive a new post or update you'll receive a mention on your twitter.
  3. Besides, you can enable "Auto Share", then every new post and/or thread you make will be tweeted on your timeline. (By default, auto-share is enabled only for your threads)

Forum Rules:

1. We understand human comunication can become "hot" sometimes. So some insults and bad words ARE allowed. Just don't push too much being an asshole all the time.

2. SPAMMERS are not allowed. There are penalties for this kind of user and they can be banned forever.

3. You can report other users, if you judge necessary. An user reported many times by many people can also be banned forever. However you can also receive penalties for report deliberately for no apparent reason.

If there is a similar thread title, make sure the other one doesn't already have the answer you're looking for.

This forum uses the BBCode (Bulletin Board Code), here are some instructions:

Bold: [b]text[/b]
Italic: [i]text[/i]
Underline: [u]text[/u]

Code: [code]text[/code]

[ul] [*]item [/ul]
[ol] [*]item [/ol]



Embed (videos, code, 3D):

Welcome to the NinevehGL's world!
NinevehGL is a 3D engine forged with pure Obj-C.
Welcome to the
Hello, Guest.

Your current vote:

You can change your vote many times. But it's still one single vote.

Depth of field realization in NinevehGL
Vote this thread:

Mon, Aug 27 2012

I want to use depth of field effect realtime effect in my app.
Realization of this effect that I want to use consists of 4 shader programs.
Here is a link to that realization ( the article is on Russian , but I think the code is clear):
There is an algorithm for applying this effect:

void display() {
program1.bind ();
program1.setUniformFloat ( "focalDistance", focalDistance );
program1.setUniformFloat ( "focalRange", focalRange );
camera.apply ();

displayBoxes ();

program1.unbind ();
buffer.unbind ( true );

glBindTexture ( GL_TEXTURE_2D, buffer.getColorBuffer () );

program2.bind ();
buffer2.bind ();
startOrtho ( 512/4, 512/4 );
drawQuad ( 512/4, 512/4 );
endOrtho ();
buffer2.unbind ( true );
program2.unbind ();

glBindTexture ( GL_TEXTURE_2D, buffer2.getColorBuffer () );

blur.bind ();
buffer3.bind ();
startOrtho ( 512/4, 512/4 );
drawQuad ( 512/4, 512/4 );
endOrtho ();
buffer3.unbind ( true );
blur.unbind ();

glActiveTextureARB ( GL_TEXTURE1_ARB );
glBindTexture ( GL_TEXTURE_2D, buffer2.getColorBuffer () );

glActiveTextureARB ( GL_TEXTURE0_ARB );
glBindTexture ( GL_TEXTURE_2D, buffer.getColorBuffer () );

program3.bind ();
program3.setUniformFloat ( "radiusScale", radiusScale );
startOrtho ( 512, 512 );
drawQuad ( 512, 512 );
endOrtho ();
program3.unbind ();

glutSwapBuffers ();

First three renders render offscreen (each use its own shader program), and the last fourth render - renders onscreen (using the last program).
Can I do this in NinevehGL?
That is, on each frame in
-(void) drawView {
[_camera drawCamera];
renders to texture , than apply other programs to that texture, and then render final image to screen?
Is that way correct?
Are there more appropriate ways of realization real-time depth of field effect?
0% like this - 0/0


Posts: 571


Tue, Aug 28 2012

In response to: @PetrBodnar

Unfortunately NinevehGL just make render of objects, so you can't create an abstract render without object.

You can use OpenGL outside NinevehGL contexts. You can use the "drawTo..." methods to get a snapshot from the current frame.
0% like this - 0/0

Tue, Aug 28 2012

In response to: @dineybomfim

Thank you for very fast reply!
You wrote
"You can use OpenGL outside NinevehGL contexts."
I'm totally new to OpenGL, can you explain this a little more?
0% like this - 0/0


Posts: 571


Tue, Aug 28 2012

In response to: @PetrBodnar

Well buddy,

This is the main reason we created NinevehGL... there are so many things you must write just to render a simple plane on the screen that it doesn't worth.

I can't describe everything you need here, but the point is that you can create another context and starting doing your own stuff.
0% like this - 0/0


Posts: 4


Fri, Nov 2 2012

In response to: @PetrBodnar

Not sure how useful is this, but please check out this link:


in this site there are quite a lot of shader related articles.

Have fun!
0% like this - 0/0

NinevehGL is a 3D engine built right on top of OpenGL ES and it uses all the programmable pipeline power, making it easy for you to create great application with shaders.

Share on

Follow NinevehGL
Fastest way to contact us:

Copyright © 2011 db-in. All rights reserved.