I'm looking to draw a custom shape (say, a solid rectangle) using openGL ES in an iOS game built upon the Cocos2d framework. In another StackOverflow question, I saw a suggestion to use [CCDirector sharedDirector].openGLView; however, I am unsure as to how to go about this. Perhaps someone can provide an example or point me to some sample code?
Thanks in advance!
There are two tutorials I can recommend for doing this, depending on what exactly you are trying to achieve.
Generating Textures using CCRenderTexture - here
Generating Textures using OpenGL - here
Related
I'm working on a project and one of the features is to play a video from a rtmp path. I'm trying to find the best way to draw the frames. Right now I'm using a UIImageView and works, but It's not very elegant nor efficient. OpenGL might do the trick but I've never used it before. Do you have some ideas what should I use? If you agree with OpenGL can you give me a code snippet that I could use for drawing the frames?
Thank you.
I'm planning on making a simple 2D game (I'm leaning towards an endless runner) for the iPhone and am using cocos2d and I can make stand alone images in Photoshop or Illustrator but I'm not sure what the best way to animate them is??
I don't know if I should animate a character running in flash then save each frame as a png and then use something like texture packer to make a sprite sheet or loop the png's together in cocos2d?? I don't know what works well with cocos2d and how to optimize the animation to run smoothly and reduce memory. I'm aware it maybe a broad question but any help or guidance would be appreciated.
You should use sprite sheet and animate the frames using cocos2d.
Here are the tutorials by Ray Wenderlich
Here is the official coco2d video tutorial and sample
Plenty of tutorials out there. Your question is probably going to be flagged and closed in the near future. Try googling your questions first next time.
I've already published a 2D game on the App Store, but I've noticed that when I add too many objects, the fps drop down, and it's a quite simple game, so I believe it shouldn't happen.
So I think that I'm not rendering the graphics properly.
What should I use, OpenGL ES, Quartz 2D, ...?
I've been reading Apple's documents about OpenGL ES for iOS, but they hardly ever mention 2D, so I'm not sure if it can be used for this.
I'm now using Quartz 2D, (I guess it's UIView, UIImages, UIImageViews), but in fact, I'm not using the drawRect method of the views, ever. I create the images or graphics within the init function of the view, and a save them into a variable if I need to modify their properties later.
Any suggestion, recommendation, pdf would be highly appreciated! :)
PS: Here's a link to the game, if you want to have a better idea about it: http://itunes.apple.com/es/app/kipos/id494638587?mt=8
I recommend you use Cocos2D. Its features will make game development a lot easier for you. If you think you're up for a challenge, try OpenGL ES. I'll warn you though: it has a very steep learning curve.
I have been using Corona SDK for almost a year, and have a couple simple games developed. What I am looking for now is some way to create 3D illusions in Corona SDK. If anyone has any experience with 3D in Corona, I would appreciate any advice. I've tried several game engines, but they either don't work with Corona, or cost way too much.
You can create a 3D model in Sketchup, export an image, and add it to your Corona app.
If you want animations, you can also export a bunch of sprites from Sketchup (sort of) and use the movieclip library to play the animation.
Check out LIME library for Corona sdk, you can simulate 3D effect with parallax or orthogonal view. And there is some code in code sharing section of corona, but i dont know if that can be useful:
http://developer.anscamobile.com/code/texturemapped-raycasting-engine
http://developer.anscamobile.com/code/raycasting-engine
new to IOS OpenGL programming. I have worked through a few tutorials that talk about the basics of OpenGL ES and been able to create a small demo program that draws cubes in a scene at positions I want. Id like to apply a texture to the faces of the cube but for some reason this seems to be a near impossible task to figure out. Im using GLKit , Ive searched all over and can't find a dead simple tutorial on how to do this without a lot of other fluff. Can anyone point me in the correct direction or have a tutorial on this? It doesn't seem like this should be hard thing to do. I must be missing something..
Go here for many tutorials bout this http://www.raywenderlich.com/
or here
http://www.raywenderlich.com/5223/beginning-opengl-es-2-0-with-glkit-part-1
this one explains about textures in detail:
http://db-in.com/blog/2011/02/all-about-opengl-es-2-x-part-23/
Id recomend not to use glkit directly (maybe some helper methods) since even tho it is easier as it works like opengl 1 most of the tutorials for gl es 2.0 wont use it and you will get confused.
Use this one for glkit to load textures
https://developer.apple.com/library/ios/#documentation/GLkit/Reference/GLKTextureLoader_ClassRef/Reference/Reference.html#//apple_ref/doc/uid/TP40010922
Try google with something like glkit texture example
this is what i got :
https://github.com/jlamarche/iOS-OpenGLES-Stuff/blob/master/GLKit%20Stuff/GLKBaseEffect%20Drawing%20Example%20with%20Texture/blah/MCViewController.m
around line 119 you can see how to use the texture, i havent checked it but it seems valid. I usually prefer to just use normal opengl since even when you have a simple program the shader file is ridiculously simple, (like less than 10 lines).