Dreamcast: VQ Texture Examples

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
Light-Dark
Dreamcast Developer
Dreamcast Developer
Posts: 307
Joined: Sun Mar 13, 2011 7:57 pm
Current Project: 2D RPG & NES Platformer
Favorite Gaming Platforms: NES,SNES,N64,Genesis,Dreamcast,PC,Xbox360
Programming Language of Choice: C/++
Location: Canada

Dreamcast: VQ Texture Examples

Post by Light-Dark »

So lately I've been working on compressing textures for the Dreamcast build of my engine and I noticed while hunting for examples that there is really only 1 example of VQ texture compression provided with KOS that is made for KGL (the OpenGL PVR wrapper). So I decided to make a couple KGL free examples that just use PVR for rendering and are free to use/modify for people who don't want to slap together their own KGL-less solution. There are currently two examples: one for the textured triangle strip and one for the textured sprite.

https://github.com/Light-Dark/dcvqtex

These examples use the following libraries/tools that should be included with your standard KOS install:

-KMG library
-oggvorbisplay library
-vqenc tool (in utils folder)

I have the Makefiles output scrabmled bin's so if you're using a coder's cable or BBA you may have to modify a couple of lines in the Makefiles to get just an ELF. I've also included the Make_ISO tool so if you're like me and use the Dreamcast SD Card Reader and Dreamshell to test your programs you should also be good to go :D

To compress the texture simply type "make vq"

If you're not using a texture with an alpha channel remove the -a flag passed to vqenc in the makefile and in the Load_VQTexture function change this
text->fmt = PVR_TXRFMT_ARGB4444 | PVR_TXRFMT_VQ_ENABLE | PVR_TXRFMT_TWIDDLED;
to this:
text->fmt = PVR_TXRFMT_RGB565 | PVR_TXRFMT_VQ_ENABLE | PVR_TXRFMT_TWIDDLED;
If you don't want twiddling, simply remove the -t flag and remove the pvr twiddling flag.

Lastly before anyone asks yes that song choice was totally intentional. Enjoy.


EDIT:

As of right now I've added an example that uses the texconv tool made by Tvspelsfreak instead of vqenc.
<tpw_rules> LightDark: java is a consequence of inverse moore's law: every 18 months, the average program will be twice as slow. therefore, computers always run at the same percevied speed. java's invention was a monumental step
Image
Post Reply