opengles學習筆記

2021-08-11 03:05:59 字數 934 閱讀 4207

glsl語言裡面的
attribute和uniform型別的變數,在程式中通過gles20.glgetattriblocation和gles20.glgetuniformlocation獲取,
這裡獲取類似取到了他的位址一樣,
就像是指標,然後在程式裡面可以通過指標改變這些變數的值,怎麼改變呢?
1.通過gles20.glenablevertexattribarray(***handle);來啟用這些變數控制代碼
2.通過gles20.glvertexattribpointer來傳入頂點矩陣或者顏色矩陣等等,顏色矩陣和頂點座標是我們定義的,
這樣就和glsl裡面的變數關聯起來了
private final string vertexshadercode=

"attribute vec4 vposition;"+

"void main() ";

static float ********coords=;

private int mpositionhandle;

//獲取頂點著色器的vposition成員控制代碼

mpositionhandle=gles20.glgetattriblocation(mprogram,"vposition");

//啟用三角形頂點的句

gles20.glenablevertexattribarray(mpositionhandle);

//準備三角形的座標資料

gles20.glvertexattribpointer(mpositionhandle,coords_per_vertex,

gles20.gl_float,false,

vertexstride,vertexbuffer);

OpenGL ES 2 0 學習筆記 四

從零開始學opengl,這裡對學習過程作記錄,包括學習資料,內容,基本知識。學習資料 opengl es 2.0 for android,網路 內容 1 基本概念 frustum 視錐體 focal point 視點或觀察者位置 field of vision 視野 目前看起來只能理解個大概,深入理...

OpenGL ES錯誤筆記

執行glbind 這類方法,在處理完對應的內容後,需要繫結回之前的狀態。例如 gles20.glbindbuffer gles20.gl array buffer,mvbo 繫結vbo gles20.glbufferdata gles20.gl array buffer,mvbosize,null,...

OpenGL ES 2 0 渲染管線 學習筆記

圖中vertex shader和fragment shader 是可程式設計管線 vertex array buffer objects 頂點資料 這時渲染管線的頂點輸入,通常使用 buffer objects效率更好。vertex shader 頂點著色器通過矩陣變換位置 計算照明公式來生成逐頂點...