Merge change 20898
* changes:
The triumphant return of the shell scripts, with bugreports, less code dup, and enhanced readability.
diff --git a/opengl/tests/filter/filter.cpp b/opengl/tests/filter/filter.cpp
index 82aafbf..2351909 100644
--- a/opengl/tests/filter/filter.cpp
+++ b/opengl/tests/filter/filter.cpp
@@ -10,6 +10,8 @@
using namespace android;
+#define USE_DRAW_TEXTURE 1
+
int main(int argc, char** argv)
{
if (argc!=2 && argc!=3) {
@@ -45,9 +47,9 @@
dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(dpy, &majorVersion, &minorVersion);
if (!usePbuffer) {
- surface = eglCreateWindowSurface(dpy, config, window, NULL);
EGLUtils::selectConfigForNativeWindow(
dpy, s_configAttribs, window, &config);
+ surface = eglCreateWindowSurface(dpy, config, window, NULL);
} else {
printf("using pbuffer\n");
eglChooseConfig(dpy, s_configAttribs, &config, 1, &numConfigs);
@@ -63,6 +65,12 @@
eglQuerySurface(dpy, surface, EGL_HEIGHT, &h);
GLint dim = w<h ? w : h;
+ glViewport(0, 0, w, h);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrthof(0, w, 0, h, 0, 1);
+
+ glClearColor(0,0,0,0);
glClear(GL_COLOR_BUFFER_BIT);
GLint crop[4] = { 0, 4, 4, -4 };
@@ -128,14 +136,55 @@
break;
}
- glDrawTexiOES(0, 0, 0, dim, dim);
+ //glDrawTexiOES(0, 0, 0, dim, dim);
+
+ const GLfloat vertices[4][2] = {
+ { 0, 0 },
+ { 0, dim },
+ { dim, dim },
+ { dim, 0 }
+ };
+ const GLfloat texCoords[4][2] = {
+ { 0, 0 },
+ { 0, 1 },
+ { 1, 1 },
+ { 1, 0 }
+ };
+
if (!usePbuffer) {
eglSwapBuffers(dpy, surface);
- } else {
- glFinish();
}
+ glMatrixMode(GL_MODELVIEW);
+ glScissor(0,dim,dim,h-dim);
+ glDisable(GL_SCISSOR_TEST);
+
+ for (int y=0 ; y<dim ; y++) {
+ //glDisable(GL_SCISSOR_TEST);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ //glEnable(GL_SCISSOR_TEST);
+
+#if USE_DRAW_TEXTURE && GL_OES_draw_texture
+ glDrawTexiOES(0, y, 1, dim, dim);
+#else
+ glLoadIdentity();
+ glTranslatef(0, y, 0);
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ glVertexPointer(2, GL_FLOAT, 0, vertices);
+ glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
+ glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+#endif
+
+ if (!usePbuffer) {
+ eglSwapBuffers(dpy, surface);
+ } else {
+ glFinish();
+ }
+ }
+
eglTerminate(dpy);
return 0;
}