gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Non Square Textures

#58317 - blaisef01 - Sat Oct 22, 2005 4:10 pm

I seem to have problems loading in non-square textures.
The textures just come out mangled.
I'm currently trying to load in a 128x32 texture.
Is anyone else having the same problem if not, how did you solve it?

Cheers

#58592 - dovoto - Mon Oct 24, 2005 7:40 pm

On hardware or an emulator? How is it garbled?
_________________
www.drunkencoders.com

#58718 - blaisef01 - Tue Oct 25, 2005 3:47 pm

It seems that my mangled textures are down to my own failure.
I failed to realise that S and T coordinates seem to be flipped on the DS.
So I have to rotate my image by -90 degrees before export
and swap S and T values when using glTexCoord or whatever.

Cheers anyway Dovoto

Now if i can only understand the secret black art which is paletted textures on 3D objects....

#58721 - dovoto - Tue Oct 25, 2005 3:57 pm

It is possible that it is me that has them swapped and that you are correct. It is amazing how close you can come to porting openGL without really knowing how it works :)
_________________
www.drunkencoders.com

#58789 - czc - Wed Oct 26, 2005 1:34 am

Hi blaisef01, i couldn't help you about your question, but now i see you figured it out
I'll need your help on Bright Star Catalogue, i need to apply a small texture (a star) to a triangle.
I just need to know what tool to use to convert that texture, and then, a paste of your triangle texturing code in that thread.

Thanks

#58790 - dovoto - Wed Oct 26, 2005 1:37 am

there is texuring example in the examples folder you should have grabbed when installing libnds/devkitpro. It is under 3D nehe (I forget which lesson). It uses a pcx file direcly for the texture (keep in mind the floating point version of glTexCoord only work on 128x128 textures and you should use the fixed point versions instead)
_________________
www.drunkencoders.com

#58791 - blaisef01 - Wed Oct 26, 2005 1:44 am

Hi czc,

I used my own tool to convert textures a made up NDS format, at the moment though it only currently converts 32 bit tga textures. I need to work on that and try and get palleted textures working too.

Hit me up on msn @ blaisef01@hotmail.com and i'll explain it and chuck u a version of my exporter. I warn u though it's well ropey

Blaise

#71211 - Dark Knight ez - Sat Feb 11, 2006 12:51 am

dovoto wrote:
there is texuring example in the examples folder you should have grabbed when installing libnds/devkitpro. It is under 3D nehe (I forget which lesson). It uses a pcx file direcly for the texture (keep in mind the floating point version of glTexCoord only work on 128x128 textures and you should use the fixed point versions instead)

Sorry for bringing up an old topic, but this is the proper place to ask my question, I believe.
I've been trying to get nehe's lesson06 example to get to work with different sized textures as well, but I can not get it to work with the fixed point version of glTexCoord.
I replaced "glTexCoord2f" with "glTexCoord2f32" and made the arguments present in those function calls wrapped in a "floattof32(...)" so to speak.

With the fixed point version of glTexCoord, I can see the cube only when I set the size of the texture used (in the function call glTexImage2D) to 128x128, but then it is only displayed as a blue cube it seems without any form of texture.
Is there an example available which I could check out on how to get different sized textures to work?

Btw, I did get my own 128x128 texture working with the floating point version of glTextCoord, so I'm pretty sure it's got nothing to do with a faulty pcx-file or the likes.


Oh, and one more question... is there a more elegent way to use fixed point values then by converting from a float? I have never used fixed point values before, and upon reading some information regarding this, it seems the "dot" is imaginary, so I haven't got a clue how to use it properly without using a function which uses another type and converts it to fixed point.

#71214 - tepples - Sat Feb 11, 2006 1:48 am

If the function to convert from float to fixed is marked static inline and __attribute__((const)), then the compiler will convert them at compile time if possible.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#71216 - ishraam - Sat Feb 11, 2006 2:40 am

This leads me to other tricky questions :
1. is it possible to store fixed point values in a binary file?
2. And then, is it possible to take a binary file full of floats (mesh data e.g.) and convert the data to fixed point format, and then store it to another file ?

#71217 - josath - Sat Feb 11, 2006 3:00 am

ishraam wrote:
This leads me to other tricky questions :
1. is it possible to store fixed point values in a binary file?
2. And then, is it possible to take a binary file full of floats (mesh data e.g.) and convert the data to fixed point format, and then store it to another file ?

1. yes
2. yes

it is actually pretty simple if you know how to read and write to files. depends on how complicated the file formats are, and if you can make up your own, or you have to follow some standard