qq_28058879
2015-05-15 06:50openscenegraph 3 cookbookz这本书的第八章的云的例子,懂得进来看看
const char* vertCode = {
"uniform sampler2D defaultTex;\n"
"uniform int width;\n"
"uniform int height;\n"
"varying float brightness;\n"
"void main()\n"
"{\n"
" float row = float(gl_InstanceID) / \
float(width);\n"
" vec2 uv = vec2(fract(row), floor(row) / \
float(height));\n"
" vec4 texValue = texture2D(defaultTex, uv);\n"
// Read and specify the position data from texture
" vec4 pos = gl_Vertex + vec4(texValue.xyz, 1.0);\n"
// Use alpha of the texel as the brightness value
" brightness = texValue.a;\n"
" gl_Position = gl_ModelViewProjectionMatrix * pos;\n"
"}\n"
};
什么意思???
- 点赞
- 回答
- 收藏
- 复制链接分享