开发者

Convert Lunar Lander to use Opengl

I modeled my game after the Lunar Lander demo that Google provides, and it uses Canvas and onDraw() methods, but I want to get better performance by using Opengl.

How much work is it to convert it to Opengl? Can I just replace the ondraw methods with opengl's texture methods or something? Or do I have to completely recreate the game?

Cause I already have surfaceview implemented and I thought I read somewhere that Opengl uses this as well.

Sorry I'm totally new at Opengl. If anyone could point me into the right direction I would appreciate it!

I have looked at

http://nehe.gamedev.net/

http://blog.jayway.com/author/pererikbergman/开发者_开发技巧

But these are all 3d, im looking to implement a way to draw 2d graphics.


There is no distinction between 2D and 3D in openGL : If you can draw any polygon in 3D, you can draw them so that they are aligned with the screen.

Take a look at NeHe's tutorial on 2D text. Remove all the 3D part. Change the code to display only quads, not display lists, each with its own texture. Cleanup the code as much as you can, there should be really few lines remaining. Add some code to be able to rotate each quad.

I suggest you don't try to develop on an embedded device (even with the emulator. It's still quite a pain) before.

Once you're done, create a tiny openGL application from the demos. You have to deal with the following parts : windowing, input and display.

When you have done this, you will find porting Lunar Lander quite easy (I think)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜