Page 1 of 1

Texture Creation (PCX) Problem

Posted: Sat Feb 21, 2009 10:57 pm
by AlbinEng
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.

Re: Texture Creation (PCX) Problem

Posted: Sun Feb 22, 2009 7:07 am
by weirdfox
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.

Re: Texture Creation (PCX) Problem

Posted: Sun Feb 22, 2009 2:41 pm
by AlbinEng
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.