OpenGL or OpenGL ES [duplicate]

2019-04-06 01:33发布

问题:

This question already has an answer here:

  • OpenGL ES versus OpenGL 12 answers

What should I learn? OpenGL 4.1 or OpenGL ES 2.0?

I will be developing desktop applications using Qt but I may start developing mobile applications in a few months, too. I don't know anything about 3D, 3D math, etc and I'd rather spend 100 bucks in a good book than 1 week digging websites and going through trial and error.

One problem I see with OpenGL 4.1 is as far as I know there is no book yet (the most recent ones are for OpenGL 3.3 or 4.0), while there are books on OpenGL ES 2.0.

On the other hand, from my naive point of view, OpenGL 4.1 seems like OpenGL ES 2.0 + additions, so it looks like it would be easier/better to first learn OpenGL ES 2.0, then go for the shader language, etc

Please, don't tell me to use NeHe (it's generally agreed it's full of bad/old practices), the Durian tutorial, etc.

Thanks

回答1:

Yes, definitely start with OpenGL ES 2.0. In fact, I would say start with WebGL (which is almost like OpenGL ES 2.0). The public wiki over here is a good place to start. The nice thing about WebGL is that you don't have to deal with things like compiling/linking and you avoid a lot of boilerplate code to setup a lot of stuff. So you get to focus on the actual drawing (which really is the fun bit :) ). If you have an OpenGL ES 2.0 book, that should still map over well to WebGL.

Plus there are a lot of demos in the repository which you can run immediately (and click your browser's 'View Source' to jump right into the code). Start with the simple ones like: image-texture-test, Colored Box, Textured Box

Those examples, together with your OpenGL ES 2.0 book, should get you started right away. Have fun!

EDIT: I should probably also point out that if you do decide to go the OpenGL 4.1 route, you probably don't need to wait for an OpenGL 4.1 book. An OpenGL 3.3 or 4.0 book would do just fine.



回答2:

OpenGL versions generally add new functionalities to previous versions, so I'd say that learning OpenGL 4.1 is in fact learning OpenGL 3.0, as the base is the same, especially if you're beginning 3d programming.

OpenGL ES 2.0 is a kind of subset of OpenGL 3.x.

With these 'facts' in mind, I'd say that learning OpenGL 3+ or OpenGL ES 2+ is about the same, with differences in details.

Note that depending on your desktop platform (OS, graphics card), you may not have access to an OpenGL 3 implementation.

An implementation of OpenGL ES 2 on desktop may also not be available.

Shezan Baig suggestion to startin with WebGL may help you with this, as it delegates the OpenGL init. problem to the browser - some even implement WebGL over DirectX to improve its availability.

My suggestion is that, while you learn, you focus on 3d principles, algorithms, and maths. These are the hardest to get right. Implementation 'details' don't vary much with OpenGL (ES or not) or DirectX, or whatever.

More precisely, I'd suggest that you start in the programming language you're most familiar with. I'd go with OpenGL 1.x/2.x in this language : these 'old' versions of GL contain lot of helper functions (glBegin/glVertex/glEnd ; glMultMatrix ; etc.) that are 'deprecated' in 3.x+. Using these, you'll be more 'productive' for testing algorithms.

There are many things in 3d programming, you can find reference books that have become freely available, and select what information is interesting for your use-case.



回答3:

Yes use GLES2.

1) Its portable.

2) Even for the PC follow the GLES2 way of doing things. (Unless your advanced and need GL3/4 features).

3) You want to use shaders period and GLES2 is good for learning the proper way.

Keep in mind OpenGL sucks on windows. The drivers are usually crap. Take the netbook, it support hlsl 2.0 but doesn't support GLSL shaders and only runs GL-1.3