GLKit + Cocos2d 2.0? - cocos2d-iphone

I am trying to use the GLKBaseEffect (from GLKit) to create a light effect on a CCSprite inside my game based on Cocos2D 2.0.
I read a lot of threads and articles and unfortunately GLKit and Cocos2D 2.0 are never used together.
Could someone please just show me the direction to integrate a simple GLKBaseEffect (e.g. the light effect) on a CCSprite of Cocos2D 2.0?
Thank you.

GLKit and Cocos2D are never used together because they're both OpenGL wrappers. You can't combine, mix or share them or their functionality. Each uses their own OpenGL context.
If you want particle effects in cocos2d, you'll have to use a Particle Design tool or write shaders for more elaborate effects.

Related

way to have 3d animated/rigged character in Opengl

If I want a 3D animated/rigged character in OpenGL game how i would have it in OpenGL?If i make a animated/rigged character in 3Ds max is it possible to have that character in OpenGl?would be helpful if someone gives a proper way or a tutorial link to export animated model from 3d software to open GL
OpenGL is a very simple 3D framework which only offers the bare bones. OpenGL can display triangles and fill them with color and that's about it. It comes with some helper functions to manipulate point clouds but it's really very basic.
Animation and rigging are way beyond what it can do. What you need is a framework which supports animation and rigging which then uses OpenGL to display the result.
Since you don't specify any requirements, it's hard to say which one would be good for you. Blender is probably a good place to start. It's game engine runs on many platforms, supports OpenGL, animation and rigging.

Particle interaction with environment and objects in scene

I've create a ParticleSystem in Ogre so that my object emitt, suppose, a lot of star.
My question is: how can I realize the interaction of this stars with the environment and the objects in the scene too? but more importantly, can I do this issue with ParticleSystem?
Any help will be appreciated!
update
I'm trying to use inside my particle file:
affector DeflectorPlane {
....
}
A DeflectorPlane supports as the name suggests only a single plane of which particles can bounce of (see entry in Ogre manual).
Having particles bounce of arbitrary surfaces involves a lot of heavy collision detection and is therefore a task that is not in the responsibility of a rending but a physics engine, hence Ogre3D has no out-of-the-box support for this requirement.
But there are four different options in terms of already existing Ogre3D physics engine wrappers: Newton, Bullet, PhysX and ODE. Each of the wrappers has its own dedicated section in the Ogre Addons forum with further information and links.

Lighting and shadows with Cocos2D and Box2D

I am currently developing a game for iPad & iPhone using Cocos2d with Box2d.
It would have been majorly cool to achieve a lighting effect like the one in this video:
http://www.youtube.com/watch?v=Elnpm-gNI04
and on this link:
http://www.catalinzima.com/2010/07/my-technique-for-the-shader-based-dynamic-2d-shadows/
I could have a go at trying to replicate the effect with Cocos2d and Box2d from the description in the link, but I am unsure if I would be able to get very far. It looks pretty advanced and heavy.
How can I achieve this in an "easy" way? Does anyone know of a Cocos2d-version of something like this, or do anyone have some pointers to point me in the right direction?
http://code.google.com/p/box2dlights/
I have succesfully made dynamic light library that use box2d geometry and rayCasting. My library work under gles1.0 and gles2.0 and use libgdx as framework. This is peformant enough for giving dynamic real time lights to 2d games for mobile devices. I can help with porting that to Cocos2D. Basics are darn simple. It was under 100 lines when I first hacked it working for my own game.
Example:
Point light shoot from center n number of rays around it and record the closest collision points. These collision points are used for mesh that is colored with gradient and drawed with additive blending.
Try to look at this link.
http://www.cocos2d-iphone.org/forum/topic/27856
He successfully added simple dynamic light using cocos2d + chipmunk following the technique that Catalin Zima used.
Please note if you download his project and try to compile iOS build, then remove "Run Script" build phase as you may experience script didn't found error. More info to remove such phase can be seen here.

Can Cocos2D handle these graphic requirements?

I'm wanting to build a game with some simple effects.
I want to add the warping effect that you see in games like geometry wars and geodefence. I know how to implement this effect in OpenGL ES. Would I be able to add this to a Cocos2D created app?
I want to have a 3D model that only moves on a 2D plane. It may rotate. First, can I add OpenGL shading to the model? Second, can I have Box2D physics applied to it like it was a 2D sprite?
That's about it. Those are the main functionality I'm hoping I can add to a Cocos2D application and am trying to figure out if I can before I spend a lot of time learning how to use the game engine.
1) Yes, you can intermix Cocos2D and OpenGL ES together - you can override the CCNode's "draw" method and do just about anything you'd like in there (such as rotating, scaling, etc in OpenGL with the texture).
2) You can add the model, and you can shade the model - yes. If you create the body fixtures for the model from Box2D, but treat the Model as if it were a '2d sprite' (has set width/height) - yes, you can use Box2D - but understand that it will only react within the 2D Physics World, and won't have any depth applied to it.
It should be noted though, that though these are possible, you will still need to implement the code to do so on your own.

How to convert OpenGL code to JOGL?

I have an application using OpenGL code. Now I want to convert it into JOGL code. Is it possible to convert OpenGL code to JOGL? What are the changes we have to do?
There are the famous suit of Nehe Tutorials for OpenGL, as mentioned above. The best part of this tutorial is that you can view JOGL and Ogl side by side. In Jogl you basically get a thin wrapper around OpenGL with Java syntax, garbage collection and all other libraries available. Making streaming objects and textures over the net and rendering them via OpenGL a breeze, you can also play around with shaders and perform array calculations faster in java using Jogl.
This tutorial might be handy. Basically you need to make all the OpenGL global function calls into calls on the proper object instance. This goes for constants too:
glBegin(GL_WHATEVER);
becomes
gl.glBegin(GL.GL_WHATEVER);
Most opengl functions are named the same in jogl and reside in the GL class. If you know opengl then it will be very easy for you to port it to jogl.
the first steps are:
GL gl = arg0.getGL();
GLU glu = arg0.getGLU();
Have a look at some tutorial on the web which will help you to get started.