

How to manipulate colors in your game by using ramp textures.How to create and use your own shaders in Cocos2D.The basics of GLSL (OpenGL Shading Language).In this tutorial, you’ll learn how to create and use shaders with the help of Cocos2D. If you aren’t using shaders yet, you will be after reading this tutorial!Ĭocos2D is one of the best iOS game frameworks available at the moment, and fortunately for us, Cocos2D 2.X now supports OpenGL-ES 2.0 and shaders. They allow programmers to create completely new effects and take full control of what’s seen on the screen. Shaders may very well be the biggest step forward in computer graphics since the introduction of 3D into games. Public class GameRenderer implements GLSurfaceView.Learn how to make cool effects like this with Cocos2D 2.0 shaders! Related classes I didn't think were relevant enough to post:įPSCounter - outputs the average FPS to logcat every 100 frames. Sprite - creates a square and draws a texture on itĪlso, I'll post my vertex and fragment shader source.

GameRenderer - the renderer for my GLSurfaceView And if it's not immediately apparent what I'm doing wrong, perhaps some advice on how to figure it out? Thanks in advance for looking through all the code I'm about to post. I'm going to dump all the relevant code here and hopefully somebody can give me an answer or some advice as to what I'm doing wrong. I'm exhausted trying to figure out what I'm doing wrong, but I have a strong feeling it has to do with my shaders.

I got this much working fine and well with ES 1.0, but now that I've switched to 2.0, I am getting a black screen with no errors. To practice, I have two Sprite objects that are drawn alternating in the same place. I am starting off by creating a "Sprite" class that creates a plane and renders a texture to it.

I'm new to OpenGL and I'm teaching myself by making a 2D game for Android with ES 2.0.
