OpenGL ES 2.0 Programming Guide

Author: Aaftab Munshi, Dan Ginsburg, Dave Shreiner
All Stack Overflow 14
This Year Stack Overflow 2

OpenGL ES 2.0 Programming Guide


Review Date:


by anonymous   2017-08-20

This is a hard question, what you want is a 2D Graphics or Game engine that uses OpenGL ES 2.0. I don't know any, but i will give you the tools you need.

You should get the book OpenGL ES 2.0 Programming Guide, it contains everything about OpenGL ES 2.0. You will have to use shaders since ES 2.0 doesn't contain any fixed function pipeline. That book contains basic shaders you can use.

This other question here contains tutorials and sample code for OpenGL ES 2.0

This should be enough for you to learn how to draw more complex primitives as circles and lines.

To draw pixels on the screen, use a 2D texture. Painting pixel-by-pixel is going to be very slow.

I hope this helps you. Remember, OpenGL ES 2.0 is very different to OpenGL ES 1.1 and OpenGL!

by anonymous   2017-08-20

Check out the OES_depth_texture extension. With this you can

// generate and bind a new Framebuffer object
glGenFramebuffers( ... );
glBindFramebuffer( ... );

// create a depth texture
glTexImage2D(...,  GL_DEPTH_COMPONENT, ...);

// and attach it to the Framebuffer with     
glFramebufferTexture2D(..., GL_DEPTH_ATTACHMENT, ...);

Without OpenGL extensions there is no perfect solution. You can write depth values into the color buffer, but you will have limited precision there.

This SO thread covers the same question for WebGL which suffers from the same problem.
The GLES2 book covers Framebuffer Objects and Renderbuffer Objects, including extensions, in chapter 12.

by anonymous   2017-08-20

This book is pretty awesome for learning Opengl ES 2.0. It does a great job of teaching the ins and outs of opengl es in a platform agnostic POV. From that point the OpenGL/interface examples for the android sdk/ndk should get you where you need to go!

by anonymous   2017-08-20

You haven't said how experienced you are with OpenGL and/or Android in general, but I'll assume that you are familiar with the basics.

In that case, the two books in this series both have significant coverage of OpenGL, which you can see by looking inside at their table of contents:

Those, together with a reference book on standard OpenGL ES 2.0 should be all you need for a long, long time.

by anonymous   2017-08-20

The Solution to this Particular Issue:

So, I added this line to my fragment shader:

precision mediump float;

to give us:

Fragment Shader

precision mediump float;

uniform vec4 vColor;

void main() {
    gl_FragColor = vColor;

Why this worked, I'm embarrassed to say that I do not know. If anybody is willing to elaborate further, please do I am curious. I'm still learning OpenGL ES 2.0. In my reading of OpenGL ES 2.0 Programming Guide (Good Book), I came across that line. And they noted, "In OpenGL ES 2.0, nothing can be drawn unless a valid vertex and fragment shader have been loaded." The Android tutorial also included this line, so I know it's critical.