[android-developers] OpenGL - Works on Emulator, - Not on Phone

2011-03-18 Thread Terje Olsen
Hello.

I'm writing a simple game with OpenGL.

I've been using the emulator to test it up until now, and it has
worked fine there. Today I deployed it to my phone, and some parts of
the rendering was not working.

I load textures with the following settings.

gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER,
GL10.GL_NEAREST);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER,
GL10.GL_LINEAR);


gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_REPEAT);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_REPEAT);

GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);

Now, rectangles textures with a 1:1 size works on the phone. (A
rectangle of dimension 16*16 with a texture of dimension 16*16 for
example).

However, my background, which utilizes the GL_REPEAT parameter to
texture a a larger surface does not work. Neither does a background
overlay which is essentially a vertex array of ~2000 vertices.
Everything's just black.

Are there any gotcha's I'm missing, or does anyone have an inkling as
to why this is the case?

Both Emulator and Phone are Android 2.1-Update 1.

-Terje

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: OpenGL texture display properly on my phone. But 'white box' on some device?

2011-03-18 Thread Terje Olsen
It seems like you are setting color to be completely transparent. Try
setting alpha to 1.0 instead of 0.0? Also make sure that depth to -9 is
visible. Quickly test with -1 for example.

17. mars. 2011 21.23 Robert Green rbgrn@gmail.com:

Debug the actual bitmap dimensions after you decode it.  It could be
getting scaled if you don't have it in drawable-nodpi.

I also remember something about clamp vs repeat with non-square power-
of-two textures on some chips, but that may be for something else.  I
see you're not using mips here but if you do, remember they must be
square, not just PoT.

What dir is the texture file you're loading in?


On Mar 17, 11:41 am, Kakyoin lgmc...@gmail.com wrote:
 *** Update ***

 Today I just updated m...

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: OpenGL - Works on Emulator, - Not on Phone

2011-03-18 Thread Terje Olsen
I forgot to say that the textures are all of power of 2.

2011/3/17 Terje Olsen terje...@gmail.com:
 Hello.

 I'm writing a simple game with OpenGL.

 I've been using the emulator to test it up until now, and it has
 worked fine there. Today I deployed it to my phone, and some parts of
 the rendering was not working.

 I load textures with the following settings.

 gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER,
 GL10.GL_NEAREST);
 gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER,
 GL10.GL_LINEAR);


 gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, 
 GL10.GL_REPEAT);
 gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, 
 GL10.GL_REPEAT);

 GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);

 Now, rectangles textures with a 1:1 size works on the phone. (A
 rectangle of dimension 16*16 with a texture of dimension 16*16 for
 example).

 However, my background, which utilizes the GL_REPEAT parameter to
 texture a a larger surface does not work. Neither does a background
 overlay which is essentially a vertex array of ~2000 vertices.
 Everything's just black.

 Are there any gotcha's I'm missing, or does anyone have an inkling as
 to why this is the case?

 Both Emulator and Phone are Android 2.1-Update 1.

 -Terje


-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en