I am new to cocos2d framework but I have good experience in iPhone application programming. We can draw lines between 2 points using ccDrawLine command. What I need to do is draw a Rope which connects the two points similar to ccDrawLine
The rope is straight.
I have a png of the rope image which is horizontal.
What I thought was using Open GL Texture to create a Texture which has the above mentioned image and then drawing line with the same. But I donno where to start and how to proceed. Please Help
Check out this tutorial in Cocos2d site: http://www.cocos2d-iphone.org/archives/1112, which shows you how to setup ropes between two points using a custom class called VRope. You should be able to download the code, and replace the rope.png with your texture.
Cheers,
Pras.
Related
I am extending an existing OpenGL project with new functionality.
I can play a video stream using OpenGL with FFMPEG.
Some objects are moving in the video stream. Co-ordinates of those objects are know to me.
I need to show tracking of motion for that object, like continuously drawing a point or rectangle around the object as it moves on the screen.
Any idea how to start with it?
Are you sure you want to use OpenGL for this task? Usually for computer vision algorithms, like motion tracking one uses OpenCV. In this case you could simply use the drawing functions of OpenCV as documented here.
If you are using OpenGL you might have a look at this question because in this case I guess you draw the frames as textures.
I have just started using sprite sheets in Cocos2D in an attempted to better utilize the texture memory and the artist generating my assets has a script that he used for some previous games in Unity3D. The tool takes a number of images, removes the transparent and white space and stuffs them into atlases. It returns the "position" and "uvs" for each sprite in a text file. One thing the tool does that we can't seem to disable is that it transposes some of the sprites to fit them better.
I want to load the animations from a plist file in Cocos2D. Is there any way to transpose them back to normal while loading the frames into the Texture cache? If not how would I transpose the individual frames after I've loaded them into a CCAnimation?
If none of this works I'll just cut and paste all of the transposed sprites into more atlases and deal with using a little extra texture memory.
I can only recommend to use one of the texture tools available for cocos2d. There's Zwoptex, and I personally would recommend TexturePacker. You'll get a lot more options out of it and don't have to worry about any of these issues.
You can use Sprite Master. You can export your spritesheet in png,tiff format and also it supports Cocos2D spritesheet .plist format. You can export to Corona, LibGDX, Sparrow game engines and additionally it exports CSS for web developers.
With this solution, It doesn't matter what game engine you are using.
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.
Imagine I have a video playing.. Can I have some sort of motion graphics being played 'over' that video.. Like say the moving graphics is on an upper layer than the video, which would be the lower layer..
I am comfortable in a C++ and Python, so a solution that uses these two will be highly appreciated..
Thank you in advance,
Rishi..
I'm not sure I understand the question correctly but a video file is a sequence of pictures that you can extract (for instance with the opencv library C++ interface) and then you can use it wherever you want. You can play the video on the sides of an opengl 3D cube (available in all opengl tutorials) and other 3D elements around it.
Of course you can also displays it in a conventional 2D interface and draw stuff on top of it, but for this you need a graphical ui.
Is it what you thought or am I completely lost?
I would like to know how to create 'cylinder effect', like the top site feature in safari 4, here is a picture
http://www.macworld.com/article/139022/2009/02/safari4firstlook.html
Can you tell me what should i learn , how to get started?
I would start by working through the OpenGL tutorials on NeHe's website. You might also want to invest in the Red Book. Topics you'll be interested in: Geometry and texture mapping. I think NeHe even has an example of texture mapping on a cylinder.
Depending on what you hope to accomplish, you might be able to use the Visualization Toolkit to draw a texture on a cylinder in 100 lines of code or less. There's a bit of a learning curve to VTK (and OpenGL for that matter), but the vtkTextureMapToCylinder class and the TCL example of how to use it are good places to get started.
Please download iCarousel. It has many types of cylindrical effects in it.Use whichever is useful for you.