Commit 297a36484574f3551f2e6ac5c29ea835709100e1
- Diff rendering mode:
- inline
- side by side
doc/src/examples/hellogl_es.qdoc
(0 / 23)
|   | |||
| 64 | 64 | the OpenGL ES window within the native window manager. In | |
| 65 | 65 | QGLWidget::initializeGL() we initialize OpenGL ES. | |
| 66 | 66 | ||
| 67 | \section1 Using OpenGL ES rendering commands | ||
| 68 | |||
| 69 | To update the scene, we reimplment QGLWidget::paintGL(). We use OpenGL ES | ||
| 70 | rendering commands just like we do with standard OpenGL. Since the OpenGL | ||
| 71 | ES common light profile only supports fixed point functions, we need to | ||
| 72 | abstract it somehow. Hence, we define an abstraction layer in | ||
| 73 | \c{cl_helper.h}. | ||
| 74 | |||
| 75 | \snippet examples/opengl/hellogl_es/cl_helper.h 0 | ||
| 76 | |||
| 77 | Instead of \c glFogxv() or \c glFogfv() we use \c q_glFogv() and to | ||
| 78 | convert the coordinates of a vertice we use the macro \c f2vt(). That way, | ||
| 79 | if QT_OPENGL_ES_CL is defined we use the fixed point functions and every | ||
| 80 | float is converted to fixed point. | ||
| 81 | |||
| 82 | If QT_OPENGL_ES_CL is not defined we use the floating point functions. | ||
| 83 | |||
| 84 | \snippet examples/opengl/hellogl_es/cl_helper.h 1 | ||
| 85 | |||
| 86 | This way we support OpenGL ES Common and Common Light with the same code | ||
| 87 | and abstract the fact that we use either the floating point functions or | ||
| 88 | otherwise the fixed point functions. | ||
| 89 | |||
| 90 | 67 | \section1 Porting OpenGL to OpenGL ES | |
| 91 | 68 | ||
| 92 | 69 | Since OpenGL ES is missing the immediate mode and does not support quads, |

