Cocos2d How to draw 3D images and rotate? - iphone

i am new in objective c and in my application i have to draw the 3D image(like carton boy) and rotate it in X axis,Y axis and z axis by using OpenGL ES framework How can i draw the images.someone help me thanks in advance.

If you are making a 3D game in cocos2d project then the 3D parts will have to be loaded using either another framework (like cocos3d) or like you said using OpenGL framework.
cocos3D http://brenwill.com/cocos3d/ works easily with cocos2d and will allow you to load 3d objects and use them in the way you want.
OpenGL framework will be more difficult to understand and use but will give you more flexibility depending on the results you want.
I would solve your question by creating 3D objects in a open source (and free) software like Blender and load them in a cocos3d project, from there, the way to manipulate them the way you want is fairly easy.

Related

Qualcomm SDK customization?

I am trying to edit multi targets and image targets sample app of qualcomm sdk so that instead of using openGL , I can only overlay UIKit contents such as buttons text etc just for a simple demo. But I am unable to do so till now.
Please guide me where to make any changes or how to go about it?
I have also referred to the forums and tried to examples but they all are using openGL which i want to get rid of.
Please help me out
The main duty of the QCAR is to give you a 4x4 matrix called ModelView matrix with which you can superimpose your graphics. This is an OpenGL matrix and I don't think that you would be able to use that matrix in UIKIT.
If you only want to overlay some UIs stuff when a target is detected then you don't need that matrix. But the UIs will be on the screen in 2D (not on the target image in 3D scene) and tha't not AR at all.
Another option is to incorporate a rendering engine with QCAR to avoid using pure OpenGL ES APIs. For iPhone I think OpenFramework should do the business.

Is there a 3D library for objective-c like papervision or away3D for actionscript

Is there a 3D library for objective-c like papervision or away3D for actionscript?
To clarify, I'm writing the app in objective-c.
All I really need to do is contruct a 3D sphere programmically and attach raster images and buttons around the inside of the sphere.
Many thanks in advance.
cocos3d is a nice, idiomatic Objective-C library for rendering 3D on iOS platforms.
OpenGL would be the best way to do 3D I would imagine.
OpenGL ES Programming Guide for iOS

How to create wolf 3D kind of basic 3D walls in openGL

I was trying to figure out how I can create simple 3D walls like this in openGL. I dont want to create any fancy stuff just a basic 3D wall where i can move fwd and backwards imagine it as Wolf 3D game with only map no killing etc.
Is there any framework which I can use to do this?? I want to do it in openGL so that I can create/render this thing on my iphone.
Thanks
Pranay
If any body can point me to some sample source code it will be helpful.
As a non-OpenGL alternative, you can construct such a maze and move through it using only Core Animation. The textured wall segments would be CALayers containing images that had been transformed in 3-D to face the appropriate directions. The maze could be translated relative to the camera to cause the user to move through the area. The code for this would be significantly simpler than an equivalent OpenGL ES implementation written from scratch.
An example of this is presented by John Blackburn in his article here.
If you want to use OpenGL, then you have to create everything yourself. But there are several nice 3D engines.
Free:
oolongengine,
Ogre iPhone
Payed (but very powerful):
Shiva3D,
Unity3D
Creating a walk-throug in a 3D space from scratch, isn't basic stuff. It's actually a lot of math.
You will start with the 3D model of the world and in order to put yourself in the perspective of the viewer you have to transform this 3D model with a series of transformations:
The World transformation - Moves the world map
The View transformation - Transforms vertices into camera space
Perspective transformation - Maps 3D space into 2D
Each of those transformations will be defined as a 4x4 matrix. Hope this helps you for a start.

Is there an tutorial on loading an 3D model in openGL ES on the iPhone?

I've started to play around with some 3d modelers a while ago. Now I'm curious: How can I bring such an 3D model to the iPhone or iPad, so that I can see it on screen and maybe even rotate it with gestures?
1) What's the best file format for the 3D models?
2) How would I load a particular 3D model file into openGL ES and then render it?
3) How would I apply an material to the polys, i.e. to make the model appear red?
4) Does the model have some sort of center or pivot point where I can rotate it easily around? Or do I need incredible freakin' math skills to transform all the vertecies in 3D space myself? How hard is it to rotate something?
5) Can I scale models or fit them into the camera viewport? How hard is that to do? Freakin' awesome math skills needed?
5) Does openGL ES support some kind of shader tree model with gradients and effects that can be applied to the model or material?
Would be so happy if someone can point out an quick starting guide for people who know 3D, but don't know OpenGL ES. Maybe someone already made a great tutorial on this topic?
How about Using 3D Models from Blender in OpenGL ES.

Core Animation or OpenGL ES?

I want to do the following:
Tap the screen and draw 3 cricles around the the tapped point.
Is it better to do this with Core Animation or OpenGL ES?
Where do I start?
My experience is this: the more complex my app became, the more I realized I should have had used OpenGL ES for what I was trying to do.
So, for your situation, If what you described is all there is, sure, Core Graphics does the trick. But, I'm guessing there's more to it than three circles.
With no experience with OpenGL at all, the learning curve for ES was about 20 days.
Thus, my advice is: OpenGL ES for pretty much every frame-to-frame graphics based app.
As mentioned, the Core Graphics framework is probably what you want. A good way to go about it would be to subclass UIView, then override the two methods drawRect: and touchesEnded:withEvent:.
When a touch event ends on the UIView, you can get the point of the last touch from the event passed to touchesEnded:withEvent:, and store it somehow in the instance of your subclassed UIView.
Then, in your implementation of drawRect:, you'll get the stored last touch point, and draw three circles around it using three calls to CGContextAddEllipseInRect, as discussed here: Quartz 2D Programming Guide: Paths (registration as Apple Developer required).
The advantage of learning OpenGL ES is that the time you put in to learn it will serve you well in the future on iPhone Apps and on other devices.
In OpenGL ES, there's no built-in way to draw a circle, so use sine and cosine to build your circles out of line segments.
Core Graphics is definitely simpler, and better for 2D. OpenGL ES is made for 3D, but can also be used for 2D. Both can be used, so if you already know one, use that. It shouldn't really matter that much.
I already knew OpenGL, so I tend to use OpenGL ES even for 2D, but if you haven't used either before, go with Core Graphics.
This could best be done with Quartz 2D (also known as Core Graphics)
See Apple's Quartz programming guide