Jump to content
  • Advertisement
Sign in to follow this  

OpenGL [OpenGL ES] Rendering vertices work on emulator but not on actual phone.

This topic is 3174 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everybody. I'm currently working on a game for Android phone using OpenGL ES. The only problem I'm currently having is the rendering of the vertices. When I render everything and run the game on emulator to emulate Android 1.5 or 1.6 platform the game works like a wonder and everything runs swell. But when I upload the game to my own phone which runs Android 1.5(HTC Hero) and the vertices don't appear on screen anymore. Any ideas what's going on? Code is roughly as follows:
                // VERTICE SETUP IN INIT
		int one = 65536;
		int half = one / 2;
		int vertices[] = {
		// FRONT
		-half, -half, half, half, -half, half,
		-half, half, half, half, half, half

		ByteBuffer vbb = ByteBuffer.allocateDirect(vertices.length * 4);
		mVertexBuffer = vbb.asIntBuffer();

		gl.glVertexPointer(3, GL10.GL_FIXED, 0, mVertexBuffer);
		gl.glColor4f(1, 0, 0, 1);
		gl.glScalef(50, 50, 1);
		gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4);
I have tried using glDrawArrays() too and they work on the emulator too but not on the actual phone. What's going on? If it matters at all, I'm using 2D projection via GLU.gluOrtho2D() to match the world coordinates to screen coordinates. I'm pretty much lost with this one. I mean.. I'm emulating the 1.5 Android with the Android SDKs emulator and it should be the same thing as the actual device but when I upload it to my HTC Hero 1.5 it just... does not work. The program starts and all other stuff works but rendering of vertices does not work, the gl.glClear() command works fine. It clears the screen to given colour but it just does not render the vertices. Anyone got any tips what to try or what might be wrong? Cheers. [Edited by - Skyy on November 8, 2009 6:01:14 PM]

Share this post

Link to post
Share on other sites
try anything else than GL_TRIANGLE_STRIP.
Just in case, have you enabled the vtx/color-arrays?
Android's GL implementations are more of a mine-field than most phones, I've seen even basics of basics failing miserably there ...
There's usually at least one usage-path that works correctly, so try to find it. And meanwhile do post bug-reports (which may get fixed in a new firmware after a few months ...)

(Welcome to my dev-world :( )

Share this post

Link to post
Share on other sites
Haha, thank you. :) I'm enjoying the development so far, it's a bit annoying but once I nail the "one and correct" road it should be .. well, maybe not a smooth ride but some what enjoyable road. And I will do more tests based on your tip and see what happens and report back.

I have enabled the vertex and texture arrays. Currently only using vertex arrays since I haven't gone through the trouble of bringing in the sprites just yet since my phone doesn't even like the vertices so... But it's strange that it works perfectly fine on the emulator.

But yeah, going to try that out what you suggested later when I get back home.
If anyone has more tips what to do / try out, I'm open for them.


// Skyy

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!