Wednesday, June 16, 2010

Re: [android-developers] blank screen with opengl

Could be anything. Make sure you have a glGetError in your render loop
someplace as it might indicate a problem. Also check for EGL errors.
Maybe your texture isn't being loaded correctly. Try starting with
clearing the screen to pink to be sure your rendering context is
working. Then move on to a colored triangle.

Leigh

On 6/16/2010 1:14 PM, Simone wrote:
> 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
>
>

--
Leigh McRae
www.lonedwarfgames.com

--
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