diff --git a/opengl/tests/tritex/Android.mk b/opengl/tests/tritex/Android.mk index 76fd8dddc5335..6db3f49a99e13 100644 --- a/opengl/tests/tritex/Android.mk +++ b/opengl/tests/tritex/Android.mk @@ -2,7 +2,7 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_SRC_FILES:= \ - tritex.c + tritex.cpp LOCAL_SHARED_LIBRARIES := \ libcutils \ diff --git a/opengl/tests/tritex/tritex.c b/opengl/tests/tritex/tritex.cpp similarity index 88% rename from opengl/tests/tritex/tritex.c rename to opengl/tests/tritex/tritex.cpp index 60a7feb9b8404..629b53cbe1e26 100644 --- a/opengl/tests/tritex/tritex.c +++ b/opengl/tests/tritex/tritex.cpp @@ -6,10 +6,16 @@ #include #include +#include + +#include +#include #include #include #include + +using namespace android; EGLDisplay eglDisplay; EGLSurface eglSurface; @@ -117,6 +123,7 @@ int init_gl_surface(void) EGLConfig myConfig = {0}; EGLint attrib[] = { + EGL_SURFACE_TYPE, EGL_PBUFFER_BIT|EGL_WINDOW_BIT, EGL_DEPTH_SIZE, 16, EGL_NONE }; @@ -132,15 +139,12 @@ int init_gl_surface(void) printf("eglInitialize failed\n"); return 0; } - - if ( eglChooseConfig(eglDisplay, attrib, &myConfig, 1, &numConfigs) != EGL_TRUE ) - { - printf("eglChooseConfig failed\n"); - return 0; - } + + EGLNativeWindowType window = android_createDisplaySurface(); + EGLUtils::selectConfigForNativeWindow(eglDisplay, attrib, window, &myConfig); if ( (eglSurface = eglCreateWindowSurface(eglDisplay, myConfig, - android_createDisplaySurface(), 0)) == EGL_NO_SURFACE ) + window, 0)) == EGL_NO_SURFACE ) { printf("eglCreateWindowSurface failed\n"); return 0; @@ -239,12 +243,12 @@ void render(int quads) 0, FIXED_ONE }; - const GLushort template[] = { 0, 1, 2, 0, 2, 3 }; + const GLushort quadIndices[] = { 0, 1, 2, 0, 2, 3 }; - GLushort* indices = (GLushort*)malloc(quads*sizeof(template)); + GLushort* indices = (GLushort*)malloc(quads*sizeof(quadIndices)); for (i=0 ; i