EasyGame Lesson01 – OpenGL Framework for WindowXP, Ubuntu and Android

This sample shows us how to build a OpenGL framework for windows, ubuntu and android with C++. Before you could use the source code here, you need to make sure that you already have installed Visual Studio IDE (for windows XP), Android SDK & NDK successfully. For the Ubuntu OS, you need to install the gcc, cmake, OpenGL library, XLib(I did not use the Qt to create windows, because I do not like using timer to update the game frame rate)

 

 OpenGL Framework on windows
lesson01_screen_shot 
It seems everything touch on the windows OS, the situation becomes very easier. There are a lots of tutorial on the Internet that tell you how to create a win32 window, choose a proper pixel format and create a correct render context on the current display device. Here are several message or event you need to handle to make the whole things work. Most of them are platform dependent, to accomplish it, fixed workflow much be needed. That it is. The first time you come across win32 code, you will be so confused. But that is not the situation. if you were interesting on it, you could deep it. Otherwise, you could let it alone, and keep on the OpenGL part or game part.

 

OpenGL Framework on Android Device
screen_shot
Here, it seems all thing become even more easier. I put all rendering staff under the ‘Render’class (A android java library class that already write a surface renderer for us, we do  not need to set up the render context now). What we need to it initialize our render staff when the render surface was created (in function “onSurfaceCreated”),  and update and draw them under the “onDrawFrame”function.

 

OpenGL Framework on Ubuntu
Lesson01_GLFramework

After you have experienced set up OpenGL context on the windows, you will feel that both of those two process were very similar. We need to do all most the same thing to make them works. The most difficulty thing was that you are not family with the Linux C++ coding, you could not find some IDE as convincement as Visual Studio. And the GCC compiler will do some more strict checking than VS compiler, and VS compiler is a gent man and much more tolerant.
The best document about a software is the source code, and you could find the full document from here.

posted @ 2012-12-27 23:32  opencoder  阅读(257)  评论(0编辑  收藏  举报