0
votes

I am pretty proficient in OpenGL and GLSL, although I've currently only written either in C++ for OpenGL / GLUT, or GLMan for GLSL. I have been looking into OpenGL on mobile devices, specifically Android, and had just a few questions about it.

First, I know you have to "program the whole pipeline" in ES 2.0, but I believe that's what I've been doing all along, in GLSL, right? Creating .vert and .frag files, and so on?

Secondly, I've been looking at this tutorial, and it seems helpful, but the first thing that hung me up was the vertex / fragment shader code. Is there a way to just specify that as a file? I can't imagine having to write shaders in that horrid string concatenation format.

Next, what is, first, the best reference for looking up things / learning things like precision mediump float, as I've never seen that kind of thing before, and secondly, does there exist a resource for drawing parallels between the aforementioned declaration, and things I'm more used to, like uniform float x and varying vec3 y?

Finally, can anyone suggest a good book for learning OpenGL ES 2.0, taking into consideration that I should have at least some parallel knowledge?

1

1 Answers

3
votes

Re: programming the whole pipeline; it may be what you've been doing all along with shaders but won't necessarily be. When they introduced shaders on the desktop they put a whole bunch of backward compatibility stuff in place, as exemplified by ftransform. In ES 2.0 that isn't the case. Amongst other differences, there's no matrix stack whatsoever and no predefined attributes or uniforms. So you have to program even more of the pipeline than you strictly had to under desktop GL 2.0, though not necessarily more than you were.

Re: keeping shaders in a separate file; that's definitely not a problem. Just load your Strings from files. Any old Java method will do, e.g. this one.

Re: references; the absolute best thing is the OpenGL ES 2.0 API Quick Reference Card (a PDF). It's all of OpenGL ES 2.0 in just four pages. Regarding the specific thing you're asking for, see the precision qualifiers on the third page (which is the first page of the GLSL section). I'm not aware of a resource directly for drawing parallels, but just searching that document for any unexpected syntax should do. The unusual things, like the precision qualifiers, are all minor adjustments that you can make easy sense of by looking up in and of themselves.

Re: a book; I'm not directly aware of anything. I guess the default recommendation would be the blue book.