Glesgae


Stuckie

Member
Joined
Apr 7, 2004
Messages
492
Age
38
Location
Tired, and sleeping in the basement...
Website
www.stuckieworld.net
Well, I started this back in February, and only really just have stuff coming up on the screen!
Not that there's masses of code or anything, or pages and pages of tutorial stuff.. just lack of time as with everything else, sadly.

Anyway, since February, I've been plugging away at a little engine designed primarily for handheld devices such as the Pandora ( and Caanoo, Wiz, iThings, and Androids ) that can handle some form of GLES.
Having had recently done a lot of graphics programming at work at the time, I wanted to increase my knowledge further and spawn my own little engine for fiddling with graphics from scratch, rather than in the confines of a large scale production engine ( whereby fiddling about too much would get my knuckles wrapped should I break things! )

Seeing as it would probably be a good idea to document this process a bit so I understand what I'm doing, I decided to start writing down notes. Then after seeing some GLES gibberings in IRC, I thought perhaps tidying them up and stuffing them on the Wiki would be useful to other people - which is what I've been doing since. This is effectively the reason for "yet another engine" in that I'm trying to document and explain things a bit rather than just giving out a code dump. This is as much for my benefit than yours so I can satisfy myself in understanding what's going on.

So, this gives us GLESGAE - The GL ES Game and Application Engine. Both a mnemonic that works, and a Glaswegian colloquialism for Glasgow ;) ( though I suppose that technically they drop the last 'e' but meh.. close enough! )

At the moment, it literally just renders a coloured quad to the screen, but can do so either via a fixed function pipeline, or a shader based pipeline... and it's mostly the shadery stuff I'll be concentrating on.
I'll also be looking at other bits - audio, networking, physics, scripting, entities, etc... - the further along I get. This is essentially my replacement engine for what I had been dragging around for several years.

My somewhat sane ordering is as follows ( though note that I can, and probably will move things about, expand things, and otherwise manipulate this ordering as I go along! I originally just had all Rendering Contexts as one "Chapter" for instance. )

  • Part One - Setup Stuff!
    1. GLESGAE Overview
    2. Engine Design Overview
    3. Environment Setup
    4. Setting up a Window and Context
    5. The Event and Input Systems
  • Part Two - Show me Stuff!
    1. Making a Mesh
    2. Fixed Function Rendering Contexts
    3. Shader Based Contexts
    4. Dealing with Textures
    5. Making another Mesh with Vertex Buffers
    6. Dealing with Matrices
    7. Fun with Maths
  • Part Three - Manage my Stuff!
    1. Managing Resources
    2. State Management
  • Part Four - Make it do Stuff!
    1. Logic Processing Overview
    2. Dealing with Entities
    3. Playing with Scripts
  • Part Five - Push Stuff around!
    1. Physics Processing Overview
    2. Implementing Box2D Physics
    3. Implementing Bullet Physics
  • Part Six - Make Stuff squeak!
    1. Sound Processing Overview
    2. Implementing OpenAL
  • Part Seven - Poke Stuff from afar!
    1. Networking Overview
    2. A Basic Networking System
[edit]
Actually, you should probably ignore that list and use the Wiki Table of Contents instead: http://pandorawiki.org/GLESGAE#Table_of_Contents
[/edit]

Currently, I'm around Part 2.3 .. I just have to clean up the code a bit better, commit it, and redo the Shader Context guide as I've recently done a fair amount of cleaning to the engine.

While I'm not really going to go taking requests as to what to focus on, if there's enough interest in a particular area, I can have a look into it; but primarily, the engine is meant more as a testing ground for me to fiddle with graphic techniques and shaders on GL ES platforms, and replacing my ancient engine with something more usable.

I will be building a game alongside this as well ( actually, a couple of games; Core 24 - a sortof more action orientated Tower Defence that borrows more from 1998's Battlezone than the usual Tower Defence mould and a lot of arcade sensibilities, and finally getting around to some serious work on Tiny Critters ) to ensure I don't just start making fancy engine features that won't be used ( as what happened last time. )

So, is it useful to others at the moment in it's current state?
Probably not.. but thought that I'd post about it anyway so people can start following along with what I'm up to.. I can also post here when I've done a new part, rather than just sticking it up on the Wiki for the brave to find.

I shall post again once I've finished cleaning up the Shader Based Contexts guide, and committed all the Rendering Context code which I'm aiming to have done by the end of the week. There's quite a fair bit of it, but the parts that are up already should give you a good head start as to what's going on, and some feedback is always nice :) Just remember that effectively, it's all "first draft" stuff for the moment, so there might be a few things wrong as I quickly threw stuff up on the Wiki, however once Part Two has been completed, it should start to become somewhat usable and I'll do an audit over everything I've written so far.

You can access it all from here: http://pandorawiki.org/GLESGAE
 
Sounds exciting and the stuff in the Wiki looks good to me so far. :) Also I'd like a nice tower defense game so let's see what you make of it! :)
 
Just committed the render context stuff ( and updated the relevant pages, ) so a fullscreen coloured quad in both Fixed Function and Shader Based Rendering Contexts is yours for the taking!
I swizzle the Shader Based one too, so it's got slightly different colours in the corners than the Fixed Function version, though it's essentially the same data.

It's a toss up between Texturing ( which'll require a Texture Loader to be written ) or the Transform Stack ( which requires some Maths code to be written ) next... Texturing obviously allows us to load and display images, but the Transform Stack allows us to move things about properly, rather than having just fullscreen quads and triangles.

Shall have a think over the weekend, unless anyone has a preference?
I suppose moving about vertex coloured objects is a bit more useful than fullscreen textured quads though.
 
I forgot to mention that the code repository does have lots of little todos scattered around the place.

These are intentional, for the most part! Think of them as little exercises to do on your own :) none of them are really all that hard - mostly catching errors and acting on them, for example.
The one biggie that springs to mind is in the Shader system, whereby it can load shaders by being passed a string, but it won't load shaders from file as the function is just a stub. Seeing as one part is already done, it'd be rather trivial to put some File I/O in there to load up the shader from any file you like :)

Some of them, however, are todos which shall be fixed in later additions.. this includes Mesh cleanup for example, which requires a working resource management system.

The next part is another multi-parter, dealing with aspects of The Transform Stack.
This'll cover some maths, what the Transform stacks are in a Fixed Function pipeline, how you need to deal with them in a Shader based pipeline, and we then segue into Dealing with Matrices and the whole Model, View and Projection matrix stuff.. rounding it off with the standard Orthographical and Perspective camera set, and some flying boxes.

I decided that moving stuff about is a bit more useful than another means of drawing something, or pulling in Textures... these'll be covered next though, and I shall finish off Part Two with some maths and a quick Shader guide on Uniforms before moving onto Part Three, and planning out what'll be covered in the Managing Resources overview.

That sounds like a fairly decent plan of action!
Work permitting, I aim to get Part Two finished up by the end of the month.
No promises, however! Work has a habit of throwing spanners in my best laid plans ;)
 
Well, getting stuff done for the end of last month didn't happen, did it? ;)

Either way, I've documented the fixed function transform matrix stuff now, and it's up on the wiki, with new code in the repository for playing with.

One word of warning, my Right vector is different to what OpenGL expects.. this is because I haven't quite settled on a mesh format yet, so I created the matrices in a format I would understand and was easier to explain.

Anyway new parts are here :
http://pandorawiki.org/GLESGAE:The_Transform_Stack
http://pandorawiki.org/GLESGAE:Fixed_Function_Transformations

Shader stuff is next.. it's more fun as I need to develop the shader system a bit more.
 
And the shader based transform stuff has now been finished.

http://pandorawiki.org/GLESGAE:Shader_Based_Transformations

Beware the headaches that the cameras can cause ;)
I *highly* suggest you read through all three parts in order... so you can get a good understanding to what OpenGL actually does to your matrices, as it's not exactly what you think; as you'll see when we get to the shader based stuff, doing what we think GL is doing turns out to bugger us up pretty well!
Of course, what we *think* it's doing is faster than what it's *actually* doing, so we change the Fixed Function stuff slightly so the end result becomes the same.

And if you learn nothing else from reading them, just remember than when dealing with matrices, A * B is not necessarily B * A - be that multiplying matrices together, or matrices and vectors!

Think I'll do textures next.. this coloured quad's reign of terror must end soon!
 
I seem to be on a roll with updating stuff, just now.

I've added Texture support into GLESGAE now.
It's really easy, and it was five minutes to do so..
Wiki Page: http://pandorawiki.org/GLESGAE:Dealing_with_Textures
Code: http://svn3.xp-dev.com/svn/glesgae/trunk

Goodbye randomly coloured quad, and hello Mr Smiley Face ;)
 
I've put up the last part of the "Show me Stuff!" section to the Wiki and SVN now; drawing using VBOs instead of the original Vertex Array implementation.

With Part 2 finished, GLESGAE can now render in both Fixed Function and Shader Based modes, it has a basic camera system, it can load textures and display them, and it can handle shaders where needed. All very basic still, but it leads us on to organising things so we can tackle more advanced topics such as resource management, fixing up the shader-based texture pipeline, implementing some state management for our code, and then getting into the fun stuff of actually making games!

So yes, wiki page here: http://pandorawiki.org/GLESGAE:Making_another_Mesh_with_Vertex_Buffers
SVN here: http://svn.xp-dev.com/svn/glesgae/trunk/

If I've glossed over anything too quick, or there's some other basic graphic thing you think I should go over before starting the Resource Management stuff, post here and I'll get to it :)

I'll be putting GLESGAE on hold till the end of the month to focus on Debian tinkering, for now.
 
Right...

Resources were an arse, and I spent literally months getting them right ( and two test projects were used in fixing them too! )
In the intervening time, I also drastically rewrote the entire Graphics System to be much more configurable and, hopefully, as platform independent as possible.

I'm still writing up the Resources bits.. there'll be a quick bit on what was tried and the ensuing mess, before going about how they were done properly.
I'll then do a recap over the Graphics System with what I did to it - and what I've still to do to it - then do some utility classes (Logger and HashString) and start on something completely different - Scripting.

Usually, I go for Lua, and I wasn't going to be any different here.. but I has a plan.
I'm integrating JavaScript using JavaScriptCore ( the JavaScript part of WebKit. )
The reason of which shall become apparent as we go through it.

Anyway, bleedin' edge "you're on your own" code is up on github: https://github.com/stuckie/glesgae though should always compile ( on Linux anyway, not necessarily on the Pandora... )
Cleaned up, "used for tutorial" code will remain on the SVN: http://svn.xp-dev.com/svn/glesgae/trunk/
Both use the LGPL 2.1 for now.
 
Hmm.. maybe, when I've got some time.
Having just had a quick look over there, it seems somewhat more full of ranting about things at the moment.

When I've got something actually ready for release, I'll perhaps do it.. but till then, I've not got a great deal of time, so if things stay quiet while I hack about, all the better for me as I might actually get it done for a change! :D

-edit-

And the Resources tutorial is finished.. though the code has not yet been committed, as I need to get my Pandora to charge a bit to test it properly.
 
Just to update here as well ( I have started updating more on the other board for GLESGAE at the moment, primarily as I'm targeting Linux and Pandora for now, ) most work has been going on in the github repository: https://github.com/stuckie/glesgae

Primarily, I've been working on binding up JavaScriptCore to use JavaScript as a scripting language ( Lua will come later. )
With this, I've got some basic support for Canvas to get sprites and things drawn on the screen, and a reasonable range of input options to detect and use the Pandora controls - or any other controls that I write the code to read that correspond to button pad, joystick, pointer or keyboard devices.

I've a few more Canvas related binds to do, then some Audio work, and I'll be ready to start a game using the binds as a demonstration.
There's a quick and dirty example that shows reading a sprite, drawing it, copying it, modifying the buffer, detecting input, and blitting the whole mess to the screen. Though the getImageData and putImageData functions seem to leak memory - something to do with Garbage Collection I think - so be warned.
 
Back
Top