1. Outline Recently, many developer use OpenGLES 2.0 to make a 2d graphics game. But it have little difficult because of OpenGLES1.0 & OpenglES 2.0 graphic-pipeline difference. Especially, when we meet GLSL shader first-time, it give little fear of programming. Follow writing show shader for someone who want to make 2d graphic game or app. 2. Vertex Shader vertex shader handle each vertex infos ..
1. outline OpenGLES 2.0 don't support glLightf. So developer have to make light effect using glsl shader. Following content don't explane about OpenGL2.0 functions like glGetUniformLocation, glGetAttribLocation, ect. 2. Light formula Below formual show graphics expression of light in 3D graphics. I = Global Ambient + Emission + Ambient + Diffuse + Specular = Ga + Me + 1/a+bD+cD^2(Ka*Ia + Kd*Id(N..
OpenGLES2.0 not support glFog. So If you want fog effect, you have to a code using glsl. 1. Calculate GL_FOG_MODE have 3 modes. GL_LINEAR : f = (end - z)/(end - start) GL_EXP : f = exp(-density*z) GL_EXP2 : f = exp2(-(density*z)*(density*z)) Color = Color_source*f + (1-f)Color_fog start - fog start distionce(usually 0.0f) end - fog's end distance (usually 1.0f) Color_source is fragment color. Co..