Game Development Reference
In-Depth Information
This example opens a window with a red background and prints lines similar to:
Using glCreateContext()
Using wglCreateContextAttribsARB()
OpenGL version: 3.2.0
OpenGL renderer: GeForce GTX 560/PCIe/SSE2
OpenGL vendor: NVIDIA Corporation
The OpenGL context version matches the version speciied in the call to
glCreateContextAttribsARB() .
There's more…
Setting a pixel format of a window more than once is not allowed in WinAPI. Hence, we
use a temporary invisible window to create the irst rendering context and retrieve the
extensions. Check out the ile OpenGL3.cpp from the 1_OpenGL3 example for further
implementation details.
See also
F Unifying the OpenGL 3 core proile and OpenGL ES 3
Initializing OpenGL ES 2 on Android
Initialization of OpenGL on Android is straightforward when compared to Windows. There
are two possibilities to create an OpenGL rendering context in the Android NDK: use EGL API
( http://en.wikipedia.org/wiki/EGL_(API) ) from NDK directly, or create a wrapper
Java class based on android.opengl.GLSurfaceView . We will choose the second option.
Getting ready
Make yourself familiar with the interface of the GLSurfaceView class at http://
developer.android.com/reference/android/opengl/GLSurfaceView.html .
How to do it…
1.
We extend the GLSurfaceView class in the following way:
public class GLView extends GLSurfaceView
{
 
Search WWH ::




Custom Search