Wednesday, June 16, 2010

[android-developers] blank screen with opengl

I got this, to show a rectangle:

private float[] sCoords = {
// X, Y, Z
GameRenderer.W/3, GameRenderer.H/3, 0,
GameRenderer.W/3, 20f, 0,
30f, 20f, 0,
30f, GameRenderer.H/3, 0
};

...

gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mFVertexBuffer);
gl.glEnable(GL10.GL_TEXTURE_2D);
gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, mTexBuffer);
gl.glDrawElements(GL10.GL_TRIANGLE_FAN, VERTS,
GL10.GL_UNSIGNED_SHORT, mIndexBuffer);

and previously:

public void onSurfaceChanged(GL10 gl, int w, int h) {
gl.glViewport (0, 0, w, h);
gl.glMatrixMode (GL10.GL_PROJECTION);
gl.glLoadIdentity ();
gl.glOrthox(0, w, 0, h, -1, 1);
W=w;
H=h;
rect = new Rectangle();
}


I should see a rectangle, but I only see a white screen.
Any help?
Simone

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment