Go Back   Android Forums > Android Development > Application Development
Application Development Dev lounge for our application developers.

New Forums: Nexus Player | Nexus 9
test: Reply
 
LinkBack Thread Tools
Old March 1st, 2011, 03:43 PM   #1 (permalink)
New Member
Thread Author (OP)
 
Join Date: Jan 2011
Posts: 5
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default setEGLContextClientVersion(2) causes a crash

I am trying to make an OpenGL ES2 application. As a start, I just copied the demo BasicGLSurfaceView from the API level 11 samples.

After it crashed no matter what I changed, I made a very stripped version which basically just creates the surface. After many testing and finally trying out the debugger, it seems like calling setEGLContextClientVersion() with 2 causes an exception in GLThread:

PHP Code:
Thread [<1main] (Running)    
Thread [<8Binder Thread #2] (Running)    
Thread [<7Binder Thread #1] (Running)    
Thread [<9GLThread 10] (Suspended (exception IllegalArgumentException))    
    
GLSurfaceView$GLThread.run() line1122 
This is my first try at an Android application, so I have no idea what this means. Tried to find what GLThread is, but it isn't documented in the API.

This is the current - very simple - code (taken from here):

PHP Code:
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

import android.app.Activity;
import android.opengl.GLSurfaceView;
import android.os.Bundle;

public class 
Test extends Activity {
    @
Override
    
protected void onCreate(Bundle savedInstanceState) {
        
super.onCreate(savedInstanceState);
        
mGLView = new GLSurfaceView(this);
        
mGLView.setEGLContextClientVersion(2);
        
mGLView.setRenderer(new ClearRenderer());
        
setContentView(mGLView);
    }

    @
Override
    
protected void onPause() {
        
super.onPause();
        
mGLView.onPause();
    }

    @
Override
    
protected void onResume() {
        
super.onResume();
        
mGLView.onResume();
    }

    private 
GLSurfaceView mGLView;
}

class 
ClearRenderer implements GLSurfaceView.Renderer {
    public 
void onSurfaceCreated(GL10 glEGLConfig config) {
        
    }

    public 
void onSurfaceChanged(GL10 glint wint h) {
        
    }

    public 
void onDrawFrame(GL10 gl) {
        
    }

When I run either this or the demo without the debugger, they crash.

Any ideas why this happens?

Oh and I am currently using the level 9 API, but I tried with both 10 and 11 too to no avail, so I guess that's not the issue.

Thanks for any help

Advertisements
wolfscaptain is offline  
Last edited by wolfscaptain; March 1st, 2011 at 03:50 PM.
Reply With Quote
sponsored links
Old March 2nd, 2011, 12:56 PM   #2 (permalink)
New Member
Thread Author (OP)
 
Join Date: Jan 2011
Posts: 5
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default

I finally copied the GLES20 demo that sets the renderer based on a function that checks if ES 2 is supported.

Since I can't find a way to sort of "show" things (I always loved the console that comes with any C/C++ application...), I just commented the check and noticed that apparently ES 2 is simply not supported by the emulator.

A google search on that question turned out to be true, but it is 3 months old.
Is there no way to use ES 2 on the emulator? What's the point of the emulator if you can't do on it what you can do on an actual device?
Since I don't have a device yet (waiting for an Android 3 tablet), I can't actually write anything... (not really happy about writing a lot of code and then later on trying to debug it without ever using it...)
wolfscaptain is offline  
Reply With Quote
Reply


Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 04:51 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.