Add Frequency Bands to Your Qualcomm Device

Those of you who travel quite a bit undoubtedly own more than one device due to frequency band … more

More Android 5.0 Details Revealed, Microsoft Band Fitness Tracker – XDA TV

Google talks more about Android 5.0 Lollipop! That and much … more

Google Allows Search Queries To Interact With Apps

Android 5.0 Lollipop brings lots of new features that are quite useful for end users and … more

Lenovo Officially Owns Motorola, Following ~$3 Billion Deal

Google is now officially no longer the owner of American phone manufacturer … more
Post Reply

OpenGL ES 2.0 games possibility

OP MarcusMaximus04@gmail.com

27th January 2010, 08:42 PM   |  #51  
Junior Member
Thanks Meter: 1
 
29 posts
Join Date:Joined: Jan 2010
Quote:
Originally Posted by MarcusMaximus04@gmail.com

For the second-to-last bit, if I understand you correctly, wouldn't you have to deal with making everything thread safe then, and use semaphores/etc to make sure that you aren't reading the position/whatever variables for the display at the same time they're being altered by your control functions?.

yes. but its made a bit easier since the render thread will always only read the data. good point however.

I managed to compile, link, and run a wholly native GLES executable.
Unfortunately, it dies on the create Surface step.
It performed all eglInitialization calls all the way up to eglCreateWindowSurface():
with the listed results.
I have seen this on the iphone and on the beagleboard (TI OMAP/powervr) when I didnt get the exact color depth correct. still digging.

*** In any event you can see the version returned by eglInitialize()

Code:
int eglHelloInit()
{
  EGLDisplay eglDisplay;
  EGLSurface eglSurface;
  EGLContext eglContext;
  EGLint versMajor;
  EGLint versMinor;
  EGLBoolean result;

    eglDisplay = eglGetDisplay(0);
    if (eglDisplay == EGL_DEFAULT_DISPLAY)
      fprintf(stderr, "default display\n");
    else if (eglDisplay == EGL_NO_DISPLAY)
      fprintf(stderr, "no display\n");
    else
      fprintf(stderr, "other display\n");

    result = eglInitialize(eglDisplay, &versMajor, &versMinor);
    printf("GL version %d.%d\n", versMajor, versMinor);

    if (result)
    {
        EGLint numConfigs;

        if (eglGetConfigs(eglDisplay, 0, 0, &numConfigs))
        {
            printf("%d egl configs\n", numConfigs);

            EGLConfig configs[32];
            eglGetConfigs(eglDisplay, configs, 32, &numConfigs);

            int i;
            for (i = 0; i < numConfigs; i++)
            {
                EGLint redBits;
                EGLint greenBits;
                EGLint blueBits;
                EGLint alphaBits;

                EGLint bufferSize;
                EGLint depthSize;
                EGLint stencilSize;

                EGLint caveat;
                EGLint native;

                EGLint level;
                EGLint surfaceType;
                EGLint visualType;
                EGLint visualID;

                eglGetConfigAttrib(eglDisplay, configs[i], EGL_RED_SIZE,    &redBits);
                eglGetConfigAttrib(eglDisplay, configs[i], EGL_GREEN_SIZE,  &greenBits);
                eglGetConfigAttrib(eglDisplay, configs[i], EGL_BLUE_SIZE,   &blueBits);
                eglGetConfigAttrib(eglDisplay, configs[i], EGL_ALPHA_SIZE,  &alphaBits);

                eglGetConfigAttrib(eglDisplay, configs[i], EGL_BUFFER_SIZE, &bufferSize);
                eglGetConfigAttrib(eglDisplay, configs[i], EGL_DEPTH_SIZE,  &depthSize);
                eglGetConfigAttrib(eglDisplay, configs[i], EGL_STENCIL_SIZE, &stencilSize);
                eglGetConfigAttrib(eglDisplay, configs[i], EGL_CONFIG_CAVEAT, &caveat);
                eglGetConfigAttrib(eglDisplay, configs[i], EGL_NATIVE_RENDERABLE, &native);

                eglGetConfigAttrib(eglDisplay, configs[i], EGL_LEVEL, &level);
                eglGetConfigAttrib(eglDisplay, configs[i], EGL_SURFACE_TYPE, &surfaceType);
                eglGetConfigAttrib(eglDisplay, configs[i], EGL_NATIVE_VISUAL_TYPE, &visualType);
                eglGetConfigAttrib(eglDisplay, configs[i], EGL_NATIVE_VISUAL_ID, &visualID);
                printf
                (
                     "config %d: rgba=%d:%d:%d:%d(%d), ds=%d:%d, "
                     "caveat=%04x, native=%d, level=%d, surface=%04x, visual=%04x, id=%d\n",
                     i + 1,
                     redBits, greenBits, blueBits, alphaBits, bufferSize, depthSize, stencilSize,
                     caveat, native, level, surfaceType, visualType, visualID
                 );
            }

            EGLint configAttribs[] =
            {
                //EGL_RED_SIZE, 4,
                //EGL_GREEN_SIZE, 4,
                //EGL_BLUE_SIZE, 4,
                //EGL_ALPHA_SIZE, 4,
                //EGL_DEPTH_SIZE, 16,
                //EGL_BUFFER_SIZE, 16,
                EGL_NONE
                //EGL_BUFFER_SIZE, 32,
                //EGL_SURFACE_TYPE, EGL_WINDOW_BIT, // EGL_WINDOW_BIT, EGL_PIXMAP_BIT,
            };

            EGLConfig eglConfig = 0;
            if (!eglChooseConfig(eglDisplay, configAttribs, &eglConfig, 1, &numConfigs) || (numConfigs != 1))
            {
                printf("failed to find usable config =(\n");
            }
            else
            {
                GLint configID;
                eglGetConfigAttrib(eglDisplay, eglConfig, EGL_CONFIG_ID, &configID);
                printf("chose config %d\n", configID);
            }

            eglContext = eglCreateContext(eglDisplay, eglConfig, EGL_NO_CONTEXT, 0);
            if (eglContext == EGL_NO_CONTEXT)
                printf("failed to allocate context\n");

            eglSurface = eglCreateWindowSurface(eglDisplay, eglConfig, 0, 0);
            if (eglSurface == EGL_NO_SURFACE)
                printf("failed to create surface\n");

            return eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext);
        }
        else
            printf("GL get configs failed\n");
    }
    else
        printf("GL init failed\n");


  return(1);
}
Code:
Script started on Wed Jan 27 15:34:14 2010
sh-3.2$ adb shell
# cd /data
cd /data


# ./eg  hello-egl
./hello-egl


other display


GL version 1.4


GL version 1.4


44 egl configs


config 1: rgba=4:4:4:4(16), ds=0:0, caveat=3038, native=0, level=0, surface=0403, visual=0000, id=0


config 2: rgba=4:4:4:4(16), ds=16:0, caveat=3038, native=0, level=0, surface=0403, visual=0000, id=0


config 3: rgba=4:4:4:4(16), ds=24:8, caveat=3038, native=0, level=0, surface=0403, visual=0000, id=0


config 4: rgba=5:5:5:1(16), ds=0:0, caveat=3038, native=0, level=0, surface=0403, visual=0000, id=0


config 5: rgba=5:5:5:1(16), ds=16:0, caveat=3038, native=0, level=0, surface=0403, visual=0000, id=0


config 6: rgba=5:5:5:1(16), ds=24:8, caveat=3038, native=0, level=0, surface=0403, visual=0000, id=0


config 7: rgba=5:6:5:0(16), ds=0:0, caveat=3038, native=0, level=0, surface=0407, visual=0000, id=0


config 8: rgba=5:6:5:0(16), ds=16:0, caveat=3038, native=0, level=0, surface=0407, visual=0000, id=0


config 9: rgba=5:6:5:0(16), ds=24:8, caveat=3038, native=0, level=0, surface=0407, visual=0000, id=0


config 10: rgba=8:8:8:8(32), ds=0:0, caveat=3038, native=0, level=0, surface=0407, visual=0000, id=0


config 11: rgba=8:8:8:8(32), ds=16:0, caveat=3038, native=0, level=0, surface=0407, visual=0000, id=0


config 12: rgba=8:8:8:8(32), ds=24:8, caveat=3038, native=0, level=0, surface=0407, visual=0000, id=0


config 13: rgba=4:4:4:4(16), ds=0:0, caveat=3051, native=0, level=0, surface=0403, visual=0000, id=0


config 14: rgba=4:4:4:4(16), ds=16:0, caveat=3051, native=0, level=0, surface=0403, visual=0000, id=0


config 15: rgba=4:4:4:4(16), ds=24:8, caveat=3051, native=0, level=0, surface=0403, visual=0000, id=0


config 16: rgba=5:5:5:1(16), ds=0:0, caveat=3051, native=0, level=0, surface=0403, visual=0000, id=0


config 17: rgba=5:5:5:1(16), ds=16:0, caveat=3051, native=0, level=0, surface=0403, visual=0000, id=0


config 18: rgba=5:5:5:1(16), ds=24:8, caveat=3051, native=0, level=0, surface=0403, visual=0000, id=0


config 19: rgba=5:6:5:0(16), ds=0:0, caveat=3051, native=0, level=0, surface=0407, visual=0000, id=0


config 20: rgba=5:6:5:0(16), ds=16:0, caveat=3051, native=0, level=0, surface=0407, visual=0000, id=0


config 21: rgba=5:6:5:0(16), ds=24:8, caveat=3051, native=0, level=0, surface=0407, visual=0000, id=0


config 22: rgba=8:8:8:8(32), ds=0:0, caveat=3051, native=0, level=0, surface=0407, visual=0000, id=0


config 23: rgba=8:8:8:8(32), ds=16:0, caveat=3051, native=0, level=0, surface=0407, visual=0000, id=0


config 24: rgba=8:8:8:8(32), ds=24:8, caveat=3051, native=0, level=0, surface=0407, visual=0000, id=0


config 25: rgba=4:4:4:4(16), ds=0:0, caveat=3038, native=0, level=0, surface=0403, visual=0000, id=0


config 26: rgba=4:4:4:4(16), ds=16:0, caveat=3038, native=0, level=0, surface=0403, visual=0000, id=0


config 27: rgba=4:4:4:4(16), ds=24:8, caveat=3038, native=0, level=0, surface=0403, visual=0000, id=0


config 28: rgba=5:5:5:1(16), ds=0:0, caveat=3038, native=0, level=0, surface=0403, visual=0000, id=0


config 29: rgba=5:5:5:1(16), ds=16:0, caveat=3038, native=0, level=0, surface=0403, visual=0000, id=0


config 30: rgba=5:5:5:1(16), ds=24:8, caveat=3038, native=0, level=0, surface=0403, visual=0000, id=0


config 31: rgba=5:6:5:0(16), ds=0:0, caveat=3038, native=0, level=0, surface=0407, visual=0000, id=0


config 32: rgba=5:6:5:0(16), ds=16:0, caveat=3038, native=0, level=0, surface=0407, visual=0000, id=0


chose config 6


failed to create surface


Could not initialize egl 


# exit
exit


sh-3.2$ exit
exit

Script done on Wed Jan 27 15:34:32 2010
Last edited by d1mbu1b; 27th January 2010 at 08:51 PM.
27th January 2010, 09:03 PM   |  #52  
OP Senior Member
Thanks Meter: 9
 
1,075 posts
Join Date:Joined: Jun 2007
More
Oh by the way, I'm gonna be holding off on development for a while. For some reason my debugger completely ate it last night and now whatever I try to debug crashes immediately with a SegFault. I'm still trying to pin down the issue but so far rebooting the phone, uninstalling the app before trying to install over it and debug, restarting my computer, and reinstalling Eclipse on my computer hasn't worked.
27th January 2010, 09:58 PM   |  #53  
Junior Member
Thanks Meter: 1
 
29 posts
Join Date:Joined: Jan 2010
got my answer
turns out even when I hyjack the GLThread in the native code with a while (1) loop the frame rate is still 7 fps...

So I guess that the san-angeles demo is just slow go figure.

I wrapped the nativeRender call in app-android.c with a while (1) and added eglSwapBuffers at the end of the loop.

I compiled by adding the eglSwapBuffers prototypes and linking against a copy of n1:/system/lib/*GL*.so that I adb pulled from the device.
Hop this is worth while for somebody.
1st February 2010, 06:55 PM   |  #54  
OP Senior Member
Thanks Meter: 9
 
1,075 posts
Join Date:Joined: Jun 2007
More
Sorry guys, still no updates on the graphics stuff. I still can't debug on my phone and have no idea why. At this point, I think my only choice is to try to back everything up and reinstall Ubuntu entirely. I freaking hate using eclipse in ubuntu, it seems like something is always going wrong with it(Installing Eclipse from the Add/Remove programs screen makes it completely borked, had to just download it from the website and even then had weird UI problems and now can't debug. On my netbook, neither way of installing will let me install any plugins) but there's not much of a choice when it comes to using the NDK, outside of trying to fight with cygwin. Might try Mint or some other distribution if Ubuntu keeps giving me problems.
1st February 2010, 07:04 PM   |  #55  
Junior Member
Thanks Meter: 0
 
4 posts
Join Date:Joined: Dec 2007
If you're running 9.10 Eclipse was affected when they changed stuff in the new version of GTK, you need to export GDK_NATIVE_WINDOWS=1 before starting eclipse.

Also, are you having trouble with adb not finding the device? I always have to adb kill-server then sudo adb start-server for it to pickup my device and any update wants to kill the server and fire it up as a non-root user again.
1st February 2010, 07:10 PM   |  #56  
OP Senior Member
Thanks Meter: 9
 
1,075 posts
Join Date:Joined: Jun 2007
More
Quote:
Originally Posted by skysurfer27

If you're running 9.10 Eclipse was affected when they changed stuff in the new version of GTK, you need to export GDK_NATIVE_WINDOWS=1 before starting eclipse.

Also, are you having trouble with adb not finding the device? I always have to adb kill-server then sudo adb start-server for it to pickup my device and any update wants to kill the server and fire it up as a non-root user again.

Interesting. That'd probably solve the UI problems. ADB-wise: no problems. It finds my Nexus One perfectly. I figured out all the kill-server/start-server stuff a while ago. The problem is that when I try to debug(and this all the sudden started happening about a week or 2 ago) I get some massive SegFault-like crash while the debugger tries to connect. A couple times, it even caused my phone to reboot entirely. This happens with all apps(including trying to use one of Google's sample apps) and nothing I've tried so far has fixed it. I even tried reverting my phone to stock firmware and doing a full data wipe and it still happens. I can't see any other explanation other than it's something on my computer's side and deleting/redownloading both the Android SDK and eclipse haven't solved it.
1st February 2010, 07:20 PM   |  #57  
Junior Member
Thanks Meter: 0
 
4 posts
Join Date:Joined: Dec 2007
Does logcat give any clues to what the phone is going through when the debugger connects? Also, do you know if those wipes cleared the Dalvik cache? I wonder if something stale in there could cause such an issue.
1st February 2010, 07:24 PM   |  #58  
OP Senior Member
Thanks Meter: 9
 
1,075 posts
Join Date:Joined: Jun 2007
More
Quote:
Originally Posted by skysurfer27

Does logcat give any clues to what the phone is going through when the debugger connects? Also, do you know if those wipes cleared the Dalvik cache? I wonder if something stale in there could cause such an issue.

Ya, logcat gives a (very long) error message. Can't remember the contents that well but I think it was a segfault. Like I said, it only happens when it's trying to connect the debugger. I can just go in afterwards and run the same app that I was trying to debug and it runs perfectly. Can't remember where it occurred 'cause the stack trace went through like 50 different packages. Also, a wipe should erase the dalvik-cache(it clears the entire /data partition), but regardless, I tried doing so manually and it didn't solve the issue.
2nd February 2010, 06:00 PM   |  #59  
OP Senior Member
Thanks Meter: 9
 
1,075 posts
Join Date:Joined: Jun 2007
More
Hmm after reading the release notes for the latest cyanogen(beta 4), that problem with the debugger may have had to do with JIT in beta 3. I enabled it briefly before turning it off again, but from things I've heard earlier, it can cause problems even after being disabled. I'll try again tonight using beta 4. In case people are wondering why I'm still posting here, I'm going to try to get a texture loader header file written up and post it here along with my matrix functions, so we have a fully functioning OpenGL ES 2.0 implementation.
5th February 2010, 08:10 PM   |  #60  
OP Senior Member
Thanks Meter: 9
 
1,075 posts
Join Date:Joined: Jun 2007
More
I managed to get up and running and found my first real bug in the OpenGL ES 2.0 library. The info log always returns gibberish after you try to compile a shader, so we get no meaningful explanation of what error occurred. That'll make shader writing a heck of a lot harder for the time being.

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes