Sign in to follow this  
  • entries
    455
  • comments
    639
  • views
    421712

Bonsai part something or the other

Sign in to follow this  
_the_phantom_

69 views

After yesterdays Cartoon time out I've sat down and implimented the timer function.

It's infact split into two phases;

A 'SystemStartup()' function has been added which will do platform specific things on startup. In the case of Win32 it sets the timer resolution for timeGetTime() to 1ms.

After that the main function getSystemTimeMillis() function (might get renamed) which lives in the main bonsai namespace returns the current time in milliseconds.

I've also rehashed the texture loading a bit. The current function was a bit of a hackjob as it passed width, height and a pointer to the pixel data to a function which did the texture setup. However, this was daft as I had a GTL::ImagePtr object I could pass in instead, which gives the texture creation routine more context.

The reason it was setup like it was before was to decouple Bonsai and a texture loader, however I decided that was just silly, more so when the Font layer had to use a texutre loader anyways, which was of course going to be GTL.

This change of function, giving more information, allowed a couple of changes to be made, mostly correct handling of texture formats (the previous example had one function for the RGB textures on the quad and one for the RGBA font texture), so now we can deal with RGBA, DXT1,3,5 and RGB, with and without mipmaps.

It also sanely handles Non-POT textures now;
- if the img is NPOT and we don't have OGL2.0 or the NPOT texture extension we bail and give a 0 texture handle (invalid/proxy texture in GL)
- if the img is NPOT and we have GL2.0 or greater but not the NPOT extension then we assume the hardware can handle NPOT but not with any sort of filtering, so filtering is set to GL_NEAREST
- If the umg is NPOT and we have the NPOT extension then we enable linear filtering
- otherwise we enable linear filtering apart from when the image has mipmaps

There might be a need to override some of that as there are times when you might want to force nearest filtering.

Next on the list is to create a stub application which hosts Lua and kicks off the process of running the application; in part because I'm sick of compiling the DLL, copying it to the Lua5.1 directory, running Lua and seeing if things work. Being able to wack 'run' will be sooooo much nicer [grin]
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now