Official Penjin Development Thread


I'll try again in the evening. So if I want my project to work on both pandora and PC I should stick to non-OpenGL stuff for now? Which modules should I omit to avoid OpenGL headers from being included? Any idea how much work switching to OpenGL rendering later will be?

EDIT: By dependencies I meant internal module dependencies to get around the OpenGL-dependant parts.
 
Yes for 100% usability on Pand you should currently use SDL.
Classes and components you should avoid:
Code:
AABB
ASCII_Title
Audio
Billboard
HeightMap
IntVector2d (deprecated)
KeyBoardDefines (deprecated)
KeyDefines (deprecated)
Model3D
Model3dBase
Model3ds
ModelAdjacency
ModelObj
Quaternion
SkyBox
Video
WiiJoy (deprecated)
The deprecated stuff are due to be deleted or refactored, the other stuff are either exclusive for 3D work or still contain early university coding which was GL specific.

RE how much work? I'm trying to keep drawing commands across renderers to perform the same tasks. Penjin specific code should "just work" once I have finished the GLES initialisation and made sure that all GL code is compatible with ES. If you use any SDL specific code directly, then you would have to manually convert this to something equivalent for GLES... But Any Penjin GFX commands will generally work regardless of renderer. just use PENJIN_SDL,PENJIN_GL,PENJIN_ES to compile for that renderer.
 
Here's what I came up with:

Hello Penjin

It is a very quick and simple program that shows a moving image.

Important files/directories:
  • penjin_hello/CMakeLists.txt: CMake control file. Defines how the app is built. Uses penjin_hello/penjin/CMakeLists.txt.
  • penjin_hello/FindSDL_gfx.cmake: CMake module. Adds SDL_gfx support.
  • penjin_hello/_main.cpp: Main source file.
  • penjin_hello/MyGame.h: Game class header file.
  • penjin_hello/MyGame.cpp: Game class source file.
  • penjin_hello/StateTest.h: Hello World state class header file.
  • penjin_hello/StateTest.cpp: Hello World state class source file.
  • penjin_hello/penjin: checkout of the Penjin SVN repository.
  • penjin_hello/penjin/CMakeLists.txt: CMake control file. Defines how the Penjin library is built.
  • penjin_hello/penjin/userStates.h: Header file. Includes and defines state classes.
  • penjin_hello/penjin/version.h: Header file. Defines program version.
To compile, type:
Code:
cd penjin_hello
cmake .
make

To run, type:
Code:
./PenjinTest

Notes:
  • I tried to separate the Penjin files from the app-specific ones by having Penjin in its own directory. This is why userStates.h includes stuff from its parent directory.
  • Version.h is just a copy of some version of PandoraPanic's. I was lazy.
  • Obviously, you need CMake to use the CMake building.
Comments?
 
Hey, just to add another option to building Penjin stuff; someone mentioned SCons on the #openpandora IRC channel and it sounded cool so I took a shot at it. Here's what I slapped together:

Code:
  import os.path
  
  CPP_DEFINES = ['PENJIN_SDL', 'PLATFORM_PC']
  SDL_LIB_PATHS = ['/usr/lib']
  SDL_LIBS = ['SDLmain', 'SDL', 'SDL_mixer', 'SDL_image', 'SDL_ttf', 'SDL_gfx']
  PENJIN_DIR = 'penjin'
  PENJIN_BLACKLIST = ['AABB.cpp', 'ASCII_Title.cpp', 'Audio.cpp', 'Billboard.cpp', 'Camera.cpp', 'HeightMap.cpp', 'IntVector2d.cpp', 'Model3dBase.cpp', 'Model3d.cpp', 'Model3ds.cpp', 'ModelAdjacency.cpp', 'ModelObj.cpp', 'Quaternion.cpp', 'SkyBox.cpp', 'Video.cpp', 'WiiJoy.cpp']
  PENJIN_BLACKLIST = [os.path.join(PENJIN_DIR, filename) 
                              for filename in PENJIN_BLACKLIST]
  
  src = Glob('*.cpp')
  penjin_src = Glob(os.path.join(PENJIN_DIR, '*.cpp'), strings=True)
  penjin_src = filter(lambda x: x not in PENJIN_BLACKLIST, penjin_src)
  libs = ['penjin'] + SDL_LIBS
  lib_paths = ['.'] + SDL_LIB_PATHS
  
  env = Environment(CPPDEFINES=CPP_DEFINES)
  env.Library(target='penjin', source=penjin_src)
  env.Program(target='PenjinTest', 
                source=src,
                LIBS=libs,
                LIBPATH=lib_paths)

Put that into a file named "SConstruct" in the penjin_hello directory and remove any indentation from the lines not clearly indented intentionally (the code tag is messing with my code) and type the command "scons" to build the application. This seems like an even nicer build method than cmake at least for smaller projects. I don't know how well this scales. Another plus side with the above config file is that you don't need to type in your source files, as they are included automatically. Just keep your source directory clean :)

I promise I won't start littering this thread with build config files. This one just seemed like a very good option to cmake. :D

EDIT: The build configuration would be a lot nicer if I didn't need to blacklist stuff ;) (no pressure intended)

EDIT2: This reply editor added some strange indentation to the code section. Kinda bad as the code is python.

EDIT3: And again!
 
B-ZaR said:
Funky alternate build stuffs
No worries, I'm actually wondering if you would like commit access so you can add your Hello_Penjin example to the Penjin repo? I can add in the CBP file later, etc.

EDIT:
Just a note that I'm trying to push the GLES support forward it's been held out of my focus with working on PandoraPanic!
 
Last edited by a moderator:
PokeParadox said:
B-ZaR said:
Funky alternate build stuffs
No worries, I'm actually wondering if you would like commit access so you can add your Hello_Penjin example to the Penjin repo? I can add in the CBP file later, etc.

EDIT:
Just a note that I'm trying to push the GLES support forward it's been held out of my focus with working on PandoraPanic!

Sure. If my current plans for penjin go as planned I might make some small contributions to the engine itself as well as I go.
 
Last edited by a moderator:
GLES support is progressing well, I've had some GLES 1.1 stuff displaying on the Pandora with Penjin. The current problem is that SDL_input doesn't play nice like this, so I will have to write some linux input handling stuff in order for GLES stuff to be useful.

Once I have working GLES 1.1 support, I'll then look into GLES 2.0 and shaders and how it may benefit us. One step at a time here, of course.
 
Nice work PokeParadox, GLES will make the engine even better! Thanks again for making and improving it, it's because of Penjin/you I can make games for the pandora :) :D !

Okay, now I'll get back to waiting for my Pandora... :p
 
Now we have direct linux input handling and PENJIN_ES support comparable to that of PENJIN_GL... so not quite ready but it "works"!
I can now hack away at the GL code until both ES and GL are working how they should be.

UPDATE: OMG... I just compiled Panjoust in PENJIN_ES and it mostly works!!! O_O
What's surprising is now my PENJIN_ES target is working better than my PENJIN_GL target since the same code would not display anything in-game on my PC.
 
Hi

I managed to install Penjin on my lucid lynx (at least i hope...) and am trying to get the TestSuite running.

I got the penjinbase and testsuite files from the svn checkout but i have an error when compiling the project :
g++: obj/lin/Release/PenjinBase/KeyMapSDLKey.o: no such file or directory

I investigated a bit, and it seems that KeyMapSDLKey.h & .cpp do not exist; although they appear in the manager of codeblocks in penjinbase/keymapper

Ideas ?
 
Reyhn said:
Hi

I managed to install Penjin on my lucid lynx (at least i hope...) and am trying to get the TestSuite running.

I got the penjinbase and testsuite files from the svn checkout but i have an error when compiling the project :
g++: obj/lin/Release/PenjinBase/KeyMapSDLKey.o: no such file or directory

I investigated a bit, and it seems that KeyMapSDLKey.h & .cpp do not exist; although they appear in the manager of codeblocks in penjinbase/keymapper

Ideas ?
Yes sorry... this is because now KeyMapSDLKey has changed to KeyMapKey since it doesn't only deal with SDL keys. You just have to removed the dead files from the project and then add the correct KeyMapKey files from your PenjinBase.

Then it should work! :)
 
Last edited by a moderator:
Another mini update:
Work has continued on the GL/ES rendering, I'm now focussing on getting a usable 3D engine running - something I have kept putting off due to lack of time. I currently have a simple first-person camera, 3DS and Obj model loaders somewhat working and also replacement functions for gluPerspective and gluLookat.
My third-person camera is giving me a few issues, which is frustrating when I'm trying to make a game similar to the Star Fox games...
Anyway I will continue to try and get a basic 3D game engine going with some simple collision testing and from there develop a map system.

The good news is that foxblock is getting more comfortable diving into Penjin code and is fixing/improving things leaving me free to focus on these advancements. (thanks foxblock!)
 
Back
Top