Re: Fullscreen shaders and effects.
I updated MyGame example here : http://www.maratis3d.com/code/post-process/
It normally works cross-platform this time, I tested on iOS simulator.
You are not logged in. Please login or register.
I updated MyGame example here : http://www.maratis3d.com/code/post-process/
It normally works cross-platform this time, I tested on iOS simulator.
I got gray and black image (like stones or wall texture) both on Simulator and on the device.
I will try now to look whats wrong and debug opengl.
Last edited by Petr (2012-08-31 08:42:34)
strange, it works good for me,
did your previous modifications merge with mine ? Maybe try to restart from fresh with the svn version ?
I made checkout from svn and add last MyGame.h/.cpp,
and move
game = new MyGame();
engine->setGame(game);
after
[self loadMaratisProject:filename];
What version of Simulator/Device you use?
Last edited by Petr (2012-08-31 11:09:28)
I've got OpenGL error 0x500 in MyGame::MyGame() in
render->texImage(0, RESOL, RESOL, M_UBYTE, M_DEPTH, 0);
Also I've got OpenGL error 0x506 in MyGame::draw() in
render->clear(M_BUFFER_COLOR | M_BUFFER_DEPTH);
in if(camera) .. block.
Also I've got 0x506 in MyGame::draw() scene->draw(camera); in
glDrawElements(returnPrimitiveType(type), size, returnGLType(indicesType), indices);
Last edited by Petr (2012-08-31 12:00:50)
last two errors occurs on each frame
I think there is some errors in creation of depth attachment texture in my project.
I will try to research this now.
Last edited by Petr (2012-08-31 12:05:30)
I used simulator 4.3.
The errors looks like opengl is not initialized properly, something different to do with the more recent os ?
I installed Simulator 4.3, and program runs ok on it, without gl errors.
Before that, I ran the program on simulator 5.1
I used simulator 4.3.
The errors looks like opengl is not initialized properly, something different to do with the more recent os ?
Looks like so.
I will try to run program on 4.* devices, and on Simulator 5.0 (when I download it).
I will try to google that.
Last edited by Petr (2012-08-31 12:52:06)
thanks
On 4.3 devices all is ok.
On iPhone 4 (with retina display) image occupies a quarter of the screen (I think I must set contentScalFactor somewhere)
On iOS 5.* I also get 0x8cdd (GL_FRAMEBUFFER_UNSUPPORTED) in glCheckFramebufferStatus(GL_FRAMEBUFFER) in
- (BOOL) resizeFromLayer:(CAEAGLLayer *)layer;
in ES2Renderer.mm.
I not found the error for now.
I tried to compare initialization code in maratis ios project with initialization code in Cocos2D v 2.0.
In Cocos2d 2.0 init and creation of ramebuffer (with depth attachment) is ok both on 4.* and on 5.*.
Code in both projects looks equally, but in maratis I still have " Failed to make complete framebuffer object 8cdd" in glCheckFramebufferStatus(GL_FRAMEBUFFER).
I think that reason may be in maratis 3d code, which executed between calls to [ES2Renderer init] and [ES2Renderer resizeFromLayer:]
I will try to find it now.
I've found that
glCheckFramebufferStatus(GL_FRAMEBUFFER) returns error after
glBindRenderbuffer(GL_RENDERBUFFER, colorRenderbuffer);
[context renderbufferStorage:GL_RENDERBUFFER fromDrawable:layer];
in resizeFromLayer: in ES2Renderer.
I add glBindFramebuffer(GL_FRAMEBUFFER, defaultFramebuffer); at start of the resizeFromLayer: , and buffers are created on 5.*
Now I have to deal with 0x500 in render->texImage(0, RESOL, RESOL, M_UBYTE, M_DEPTH, 0); in MyGame.
I change M_UBYTE to M_UINT
render->texImage(0, RESOL, RESOL, M_UBYTE, M_DEPTH, 0); , and program began to work.
Now project works on 4.3.3 and 5.1 devices, and on simulator.
On Retina display, image takes only quarter of screen.
I will fix this now, and then I'll start to add Depth of Field to this app
Hi,
well done, thanks,
that's a bit strange they changed the support of this,
so it will also need to be changed in MiOSStandardRenderer.cpp for the shadow texture
Ok
For retina support I added
self.contentScaleFactor = [UIScreen mainScreen].scale;
in initRenderingContext in EAGLView,
#define SCREEN_WIDTH ( [UIScreen mainScreen].bounds.size.width * [UIScreen mainScreen].scale)
#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height * [UIScreen mainScreen].scale)
to MyGame , and change all occurrences of screenWidth/ screenHeight and RESOL macro with these macroses.
Its now works on Retina.
I've also found a bug on iPad 1 with iOS 4.3.3, where short after launches program crashes with EXC_BAD_ACCESS.
I will deploy my app on 5.* and newer firmwares, so I leave this bug for now.
Nice, thanks,
I'll try to modify all examples to use M_UINT to be cross platform.
I added post-process DoF to iOS example.
Cool ! can we see a screenshot ?
how is the performance ?
About performance - what is the best way to display FPS on screen?
I want to see it during development of my app.
Other statistics are also useful.
To draw text on top of your game you can use a text object (MOText) in a separate scene.
In cpp like this : http://www.maratis3d.org/?p=563
Or in script (it's a new feature) : http://wiki.maratis3d.org/index.php?tit
ameraLayer
Thanks!
From which object should I obtain the current FPS?
About post-processing:
Since I used SCREEN_WIDTH * SCREEN_HEIGHT (768 * 1204 on iPad , 640*960 on Retina iPhone ) as texture dimensions, I added
render->setTextureUWrapMode(M_WRAP_CLAMP);
render->setTextureVWrapMode(M_WRAP_CLAMP);
in
render->createTexture(&m_depthTextureId);
render->bindTexture(m_depthTextureId);
render->setTextureFilterMode(M_TEX_FILTER_NEAREST, M_TEX_FILTER_NEAREST);
render->texImage(0, SCREEN_WIDTH, SCREEN_HEIGHT, M_UINT, M_DEPTH, 0);
after render->bindTexture(m_depthTextureId);
Powered by PunBB, supported by Informer Technologies, Inc.
Currently installed 3 official extensions. Copyright © 2003–2009 PunBB.