2013年10月23日 星期三

compiler第九章Machine-Independent Optimization

code optimization分成兩種 local和global

local code optimization在section 8.5

大多數的global optimization是data-flow analysis

9.1 The Principal Sources of Optimization

Semantics-Preserving Transformations
1)common-subexpression elimation
2)copy propagation
3)dead-code elimination
4)constant folding
5)code motion
6)induction variables and reduction in strength

2013年9月8日 星期日

GL_TRIANGLES和GL_TRIANGLE_FAN

有六個點
{ 0.0, 0.0 }, { 1.0, 0.0 }, { 1.0, 1.0 } ,{0.0,1.0},{2.0,1.0},{2.0,2.0}

GL_TRIANGLES

 glDrawArrays(GL_TRIANGLES, 0, 6);

畫兩個三角形



GL_TRIANGLE_FAN
glDrawArrays(GL_TRIANGLE_FAN, 0, 6);

第三個點共點

2013年9月5日 星期四

動態改變glsl uniform的time值

Uniforms[4].value[0]+=0.01;    //time
SetUniformValue(Uniforms);

glUseProgram(p,Uniforms);

2013年6月26日 星期三

Javascript cookie

   function SetCookie(name,value){
                        var NameString = name + "=" + value;
                                document.cookie = NameString;
                        }

    function GetCookie(name) {
                        var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
                        if(arr != null) return unescape(arr[2]); return null;
                        }