Z Order + Palette Swap

Previous topic - Next topic

quick2code

One thing I haven't figured out yet is how Z-Order works with images in GlBasic. How do you put one image in front of or behind the other?

Also this may be a silly question but I was wondering if palette swapping can be done with GlBasic. This is the function in old school arcade games where sprites were different colors on different levels by loading a different palette for each. I heard this wasn't possible with 16 bit color and up but the Allegro library and SDL can do this. Thanks.

Moru

The images are drawn in the order you program does it. If you want something to be on top you draw it last.

quick2code

Strangely, I actually figured as much. Problem is there may be situations where you want a more dynamic action. Not having a simple function to alter makes it a bit tricky in some circumstances.

One more thing. What's up with the screen tearing in windowed and full screen? I couldn't find a V-Sync option. None of my 2D games have this problem but BlitzMax does. Is it an OpenGL thing? Thanks for your help.

Moru

You can make your own sort routine, there is some examples in the forum of how to sort an array. That way you can use your own z-ordering.

If you set the LIMITFPS to something other than -1 it should sync automatically. I'm not sure this works in windowed mode though, at least I haven't seen any games that can do that. On the other hand I haven't been playing the sort of games that bother with that for a while now :-)

Kitty Hello

#4
V6 has a SORTARRAY function, that can sort an array of types e.g.
Alternatively you can use 3D and X_SPRITE instead.

quick2code

Awesome!!

Not to be rude or nothing, but what about the Palette Swapping? I just figure since Allegro and SDL can do it, it's possible.

Kitty Hello

There's no "palette" in GLBasic.