겨울팥죽 여름빙수
article thumbnail
OpenGLES 2.0,GLSL lighting code

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..

article thumbnail
GLSL, OpenGLES2.0 glFog

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..