EasyGame Lesson01 – OpenGL Framework for WindowXP, Ubuntu and Android

本文详细介绍如何使用C++构建适用于Windows、Ubuntu及Android设备的OpenGL框架。文章涵盖从环境搭建到具体实现步骤,包括Visual Studio IDE安装、Android SDK与NDK配置、Ubuntu下gcc、cmake及OpenGL库的使用等。特别关注各平台特性,如Windows消息处理、Android SurfaceRenderer应用及Ubuntu的Linux C++编程技巧。

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.

转载于:https://www.cnblogs.com/open-coder/archive/2012/12/27/2836590.html

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值