#101030 - Rajveer - Fri Sep 01, 2006 8:52 pm
hi guys, quick question. i want to load 16bit textures for my skybox, at the moment im using the following code to load 8-bit files
Code: |
vramSetBankB(VRAM_B_TEXTURE);
loadPCX((u8*)front, &pcx);
image8to16(&pcx);
glGenTextures(1, &texture[0]);
glBindTexture(0, texture[0]);
glTexImage2D(0, 0, GL_RGB, TEXTURE_SIZE_128 , TEXTURE_SIZE_128,
0, TEXGEN_TEXCOORD, pcx.data8);
glBindTexture(0, 0);
imageDestroy(&pcx);
|
how would i load 16bit textures? also, the image8to16 command makes 8-bit textures "work", why when it converts them to 16bit?
cheers :)
#101032 - Sausage Boy - Fri Sep 01, 2006 9:04 pm
You are in fact already using a 16 bit texture, you can tell with the GL_RGB. The 8 bit stuff is just a different way of accessing the data.
_________________
"no offense, but this is the gayest game ever"
#101042 - Rajveer - Fri Sep 01, 2006 9:47 pm
im confused. when i create the texture in adobe, i set it to 8-bit and saved it as a pcx file. also, with 16 bit images, i cant save them as pcx files. whats even stranger is that they only work when i create an 8-bit bmp in paint, load that into photoshop, paste the original image into this file (so it "converts" it to 8-bit) and save it as a pcx file.
how would i code using an 8-bit texture? (would i just change the size in glTexImage?) and how would you recommend me saving 16-bit files so i can use them?
cheers
EDIT: one more thing, anybody got any tutorials on textures on the ds? or is it much simpler than im thinking?
#101047 - Sausage Boy - Fri Sep 01, 2006 10:16 pm
I've been working on a texture converter, you can get a test release at http://www.gasp.boxgamex.net/?p=14.
Use it with
TexMex -7 your_image.png
That will hopefully give you a your_image.dta (data). Rename it to your_image.dta.bin and drop in in the data directory of your project.
Include it with
#include "your_image_dta_bin.h"
And then, change the glTexImage2D line to
Code: |
glTexImage2D(0, 0, GL_RGB, TEXTURE_SIZE_128 , TEXTURE_SIZE_128, 0, TEXGEN_TEXCOORD, (u8*)your_image_dta_bin); |
Of course you replace your_image with the name of your image. This will convert almost any image you throw at it, so save your data as whatever you want, I use regular png's. Please tell me if you have any problems!
_________________
"no offense, but this is the gayest game ever"
#101048 - Rajveer - Fri Sep 01, 2006 10:22 pm
looks like i asked at just the right time :) cheers for the link and your time, ill try it out and let you know how it goes/feedback on your tool.
thanks :)
#101054 - Sausage Boy - Fri Sep 01, 2006 10:46 pm
No problem, let me know how it works out.
_________________
"no offense, but this is the gayest game ever"
#101113 - Rajveer - Sat Sep 02, 2006 7:02 pm
hey tried it out, works great!
few things: have to rename the file to filename.bin not filename.dta.bin, and i had to replace filename_dta_bin with just filename (not even with filename_bin). but now ive learned, its great :)
one thing, using bin textures pushed the size of the file from 160~k to over 350, this normal with 6 16bit textures?
#101126 - Sausage Boy - Sat Sep 02, 2006 9:55 pm
I assume pcx is compressed, so a size increase is probably normal. Also, if you don't remove the .pcx files from that data directory, they'll get compiled in as well. The size of your textures in kilobytes can easily be calculated with (width*height*2)/1024, you can always make sure they get correctly converted.
In a future version of my tool, I'd like to support compression as well.
_________________
"no offense, but this is the gayest game ever"
#101133 - Rajveer - Sat Sep 02, 2006 10:47 pm
great, cheers for the reply. im replacing the pcx files, not adding the bin files with the pcx files, so pcx files are probably compressed. nevertheless ive not been able to use 16bit textures without your tool, not sure what im doing wrong, so cheers for the help, and im impressed with your tool :)
well done on the tool once again, its coming along nicely :)