Posts RSS Comments RSS Digg Technorati Blinklist Furl reddit 89 Posts and Comments till now
This wordpress theme is downloaded from wordpress themes website.

Camera integration


Basically what I did was just to integrate the camera from this tutorial/project (and GLM) into my cross-platform SDL2 OpenGL project.  This is also a good tutorial series to review basics (concepts, code) using modern OpenGL 3 & 4 style:

Screen shots on Windows 7 shows… Window resize (notice the cubes are no longer stretched / distorted).  Keyboard controls to walk around (WASD, QE turn left/right):
image image image image

Here are screen shots on Android (Nexus 7, DroidAtScreen) in portrait and landscape modes:

image image

For Android screen rotation to work properly, I added this to AndroidManifest.xml –> <manifest> –> <application> –> <activity>:

The WASD camera controls are time independent because I use use Simulate(Uint32 dt) as described in an earlier post:
const Uint8 *state = SDL_GetKeyboardState(NULL);
const float moveSpeed = 0.01f;
if (state[SDL_SCANCODE_W]) {
    g_Camera.offsetPosition(dt * moveSpeed * g_Camera.forward());

Once I got my code to work on Windows and Android, it also worked on OS X and iOS:
image image image

I haven’t tried this on Linux yet because I’m planning to build a separate desktop computer to build & test for Linux support (my experience with Ubuntu Linux on VMWare Player was that OpenGL 2 support worked but not OpenGL 4).

Trackback this post | Feed on Comments to this post

Leave a Reply