Wednesday, February 12, 2014

opengl es problem (solved soon) seeking help


posts by hbm717 on 2013-08-11 10:15:37 Edit
I use eclipse opengl es2.0 real machine running, but just open withdrew

Breaking open in the debugger automatically GLSurfaceView $ GLThread.run, can not show GLSurfaceView.class code

Seek expert help ............

The main problem :: 0: buffer_sunxi_init:.. Generic buffer formats must be registered first Re-order your gralloc constructors

Source:

Main activity
 public class MainActivity extends Activity 
{
GameView mGame;
protected void onCreate (Bundle savedInstanceState)
{
super.onCreate (savedInstanceState);
mGame = new GameView (getApplication ());
setContentView (mGame);
}

protected void onPause ()
{
super.onPause ();
mGame.onPause ();
}

protected void onResume ()
{
super.onResume ();
mGame.onResume ();
}
}



GLSurfaceView inherited class
 public class GameView extends GLSurfaceView 
{
Renderer mRenderer;
public GameView (Context context)
{
super (context);
setEGLConfigChooser (8,8,8,8,16,0);
setEGLContextClientVersion (2);
mRenderer = new Renderer ();
setRenderer (mRenderer);
}

private static class Renderer implements GLSurfaceView.Renderer
{
private float red = 0f;
private float green = 0f;
private float blue = 0f;

private ShortBuffer indexBuffer;
private FloatBuffer vertexBuffer;
private short [] indicesArray = {0, 1, 2};
private int numberOfVertices = 3;

private float angle;

private void initTriangle () {
ByteBuffer vbb = ByteBuffer.allocateDirect (numberOfVertices * 3 * 4);
vbb.order (ByteOrder.nativeOrder ());
vertexBuffer = vbb.asFloatBuffer ();

ByteBuffer ibb = ByteBuffer.allocateDirect (numberOfVertices * 2);
ibb.order (ByteOrder.nativeOrder ());
indexBuffer = ibb.asShortBuffer ();

float [] coords = {-0.5f,-0.5f, 0f, 0.5f,-0.5f, 0f, 0f, 0.5f, 0f};

vertexBuffer.put (coords);
indexBuffer.put (indicesArray);

vertexBuffer.position (0);
indexBuffer.position (0);
}

public void onSurfaceCreated (GL10 gl, EGLConfig config) {
gl.glEnableClientState (GL10.GL_VERTEX_ARRAY);
initTriangle ();
}

public void onSurfaceChanged (GL10 gl, int width, int height) {
gl.glViewport (0, 0, width, height);
}

public void onDrawFrame (GL10 gl) {
gl.glClearColor (red, green, blue, 1.0f);
gl.glClear (GL10.GL_COLOR_BUFFER_BIT);
gl.glRotatef (angle, 0f, 1f, 0f);
gl.glColor4f (0.5f, 0f, 0f, 0.5f);
gl.glVertexPointer (3, GL10.GL_FLOAT, 0, vertexBuffer);
gl.glDrawElements (GL10.GL_TRIANGLES, numberOfVertices, GL10.GL_UNSIGNED_SHORT, indexBuffer);
}
}
}



The following error message
08-10 13:34:43.683: D / OpenGLRenderer (28904): Enabling debug mode 0
08-10 13:34:43.693: W / dalvikvm (28904): threadid = 11: thread exiting with uncaught exception (group = 0x41781300)
08-10 13:34:43.703: E / AndroidRuntime (28904): FATAL EXCEPTION: GLThread 1278
08-10 13:34:43.703: E / AndroidRuntime (28904): java.lang.RuntimeException: createContext failed: EGL_BAD_CONFIG
08-10 13:34:43.703: E / AndroidRuntime (28904): at android.opengl.GLSurfaceView $ EglHelper.throwEglException (GLSurfaceView.java: 1193)
08-10 13:34:43.703: E / AndroidRuntime (28904): at android.opengl.GLSurfaceView $ EglHelper.throwEglException (GLSurfaceView.java: 1184)
08-10 13:34:43.703: E / AndroidRuntime (28904): at android.opengl.GLSurfaceView $ EglHelper.start (GLSurfaceView.java: 1034)
08-10 13:34:43.703: E / AndroidRuntime (28904): at android.opengl.GLSurfaceView $ GLThread.guardedRun (GLSurfaceView.java: 1401)
08-10 13:34:43.703: E / AndroidRuntime (28904): at android.opengl.GLSurfaceView $ GLThread.run (GLSurfaceView.java: 1240)
Reply:
My virgin posted so heavy. . Reconciled ah. . . .
Reply:
Ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah ah

I became a virgin stickers affixed to get points ah ah ah ah
Reply:
First come first served ......
Reply:

Reply:
references, 4th Floor guoyoulei520 reply:

Master ...... tell me I did not configure the context, and then give you a minute ......
Reply:
references, 5th Floor hbm717 reply:
Quote: references to the 4th floor guoyoulei520 reply:


Master ...... tell me I did not configure the context, and then give you a minute ......

No configuration context
Reply:
God landlord. .
Reply:
@ Shen6983846 two goods
Reply:
Various regressed stickers. .
Reply:
reference to the 8th floor li_zhu_7520 reply:
@ shen6983846 two cargo

Who did not pull your pants zipper exposed. .

No comments:

Post a Comment