开发者

Android + GL ES 2.0 multi-colored code sample?

Years ago I learned a bit of OpenGL (version 2.0). The basic examples were all very easy. One could draw a colored triangle with a few batch commands (such as glVertex[...]).

Now I get to know, that OpenGL ES 2.0 deprecates the usage of such commands. All examples which I find contain custom shaders, written in some shader language. While it might be gr开发者_运维百科eat for writing high-customizable high-performance apps, it doesn't help a lot when you start learning GL ES 2.0.

Long story short: please provide link or code of the most simple Android GL ES 2.0 app which would draw a multi-colored triangle (and do nothing else).

Thank you!


The fixed-function pipeline APIs (glVertex, et al) are not allowed in OpenGL ES 2.0+.

Here's a link to a multi-colored triangle rendering sample, using OpenGL ES 2.0: http://www.badadev.com/opengl-es-2-0-on-bada-shaders-and-programs/

What differentiates the tutorial above from simpler 'hello world' ones is the slightly more complex vertex shader and how vertex colors are passed to the shader.

If you are working with the Android NDK, a good starting point is the 'hello-gl2' sample that comes with it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜