Texture Creation (PCX) Problem

Post Reply
AlbinEng
Posts: 6
Joined: Sat Feb 21, 2009 10:50 pm

Texture Creation (PCX) Problem

Post by AlbinEng » Sat Feb 21, 2009 10:57 pm

Hello nds comrades!

I have a problem regarding a function I made:

Code: Select all

void CreateTexturePCX(const u8 *imagedata, int &texture)
{
	sImage pcx;
	
	loadPCX((u8*)imagedata, &pcx);
	
	image8to16trans(&pcx, 255);

	glGenTextures(1, &texture);
	glBindTexture(0, texture);
	
	glTexImage2D(0, 0, GL_RGBA, TEXTURE_SIZE_256 , TEXTURE_SIZE_256, 0, TEXGEN_TEXCOORD, pcx.image.data8);

	imageDestroy(&pcx);
}
This function is meant to create a texture for useage, but it only works the first call. :/
I can't figure out why right now.. maybe anyone can share some of their knowledge? :)

Here's the calls:

Code: Select all

CreateTexturePCX(lagualogo_pcx, lagualogo_texture);//<--Works
CreateTexturePCX(tilemap_level01_pcx, tilemap);//<--Not
I thank you for sharing your wisdom!

EDIT:
Oh, if I switch place between the calls the first call works and the other doesn't so there's nothing wrong with the input data.

weirdfox
Posts: 29
Joined: Thu Feb 19, 2009 8:45 am
Location: Montreal, Canada
Contact:

Re: Texture Creation (PCX) Problem

Post by weirdfox » Sun Feb 22, 2009 7:07 am

What's the size of your textures (width x height) and how may VBANK did you set as TEXTURE memory ?

Each of the first 4 VBANK can hold 128k (131,072 bytes) and each texture in RGB/RGBA will take up to (w x h x 2) bytes.

You might need more texture VRAM banks or smaller textures.
try, crash, debug and learn :)

AlbinEng
Posts: 6
Joined: Sat Feb 21, 2009 10:50 pm

Re: Texture Creation (PCX) Problem

Post by AlbinEng » Sun Feb 22, 2009 2:41 pm

That explains it, the size of the textures is 256x256.

It works now!

Thank you very much wierdfox :).
I'll be sure to mention you in the credits if I even finish this game.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 8 guests