Multiple textures in Glide3x (Newbie-question)

Started by
4 comments, last by Neophyte 24 years, 1 month ago
I''m pretty new to Glide-programming, but I''m starting to get the hang of at least some of the subtleties. I have, however, not been able to successfully load and display multiple textures. I think my problem is that I am unable to properly figure out the texture''s size after loading it, and also not being able to point Glide to the correct address in the TMU''s. Is there anybody out there who can help me accomplish this? (Source-code would be /extremely/ welcome). -Neophyte ~Death awaits you all, with nasty, big, pointy teeth.
Advertisement
Hey ya''..

Check out these sites:
http://www.ve3d.net/glide3tutorial/
http://welcome.to/3dfxPS

Don''t forget about the links sectino under the Glide Tutorial section... More links here:
http://www.ve3d.net/glide3tutorial/wwwboard/messages/365.html

If you still need help... message me or e-mail me...
smacknrat@geocities.com

But the best thing to do is to post it here.. =)

--SR

----------------------------
"To err is human... To really foul things up requires a computer.."
----------------------------
----------------------------"To err is human... To really foul things up requires a computer.."----------------------------
Well, I've already looked at the tutorials at voodooextreme/glide3tutorials, and I couldn't get it up and working anyway (that might be just me being dense, of course ) I also looked at those links, and they weren't very helpful to my current problem either.

So I think it's time I clarified where the problem actually lies

Loading a texture from file is no problem. Neither is loading it into video-memory. But I can't seem to load the texture anywhere but at the very beginning of a TMU's texture-memory! Which means that if I load more textures than I have TMU's (which is kinda absolutely necessary) I overwrite some texture I loaded earlier.


-Neophyte

~Death awaits you all, with nasty, big, pointy teeth.

Edited by - Neophyte on 3/14/00 7:13:35 AM
"The trick of loading multiple textures is to load a texture to a specific address, calculate the memory it used, and add this number the address where the texture was loaded to, and you have the start address for the next texture."

So make sure you are specifying a new mem addy for the data..

void grTexDownloadMipMap (
GrChipID_t tmu,
FxU32 startAddress,
FxU32 evenOdd,
GrTexInfo *info
)

I hope thiat showed up right.. =) startAddress is the offset in the memory to put the texture at..

Tell me how it goes...

--SR


----------------------------
"To err is human... To really foul things up requires a computer.."
----------------------------
----------------------------"To err is human... To really foul things up requires a computer.."----------------------------
I''ve tried using the following code to place the texture correctly in memory:

grTexInfo tex0, tex1;
FxU32 startTex = grTexMinAddress (GR_TMU0);
// Load first texture from file, and then to TMU0 at
// startTex. Putting texture-info to tex0

FxU32 nextTex = startTex + grTexTextureMemRequired
(GR_MIPMAPLEVELMASK_BOTH, &tex0);

// Here I load the texture2 from file, putting the
// texture-info into tex1, and then:

grTexDownloadMipmap (
GR_TMU0,
nextTex,
GR_MIPMAPLEVELMASK_BOTH,
&tex1);



The problem seems to be that the grTexTextureMemRequired ()
returns 0, and so nextTex is equal to startTex...

I''m loading the texture from file with the function:

void guLoadTexture(char* filename, GrTexInfo &bgDecal)
{
Gu3dfInfo bgInfo;

gu3dfGetInfo( filename, &bgInfo );
bgInfo.data = (char*)malloc( bgInfo.mem_required );
gu3dfLoad( filename, &bgInfo);
bgDecal.smallLodLog2 = bgInfo.header.small_lod;
bgDecal.largeLodLog2 = bgInfo.header.large_lod;
bgDecal.aspectRatioLog2 =
bgInfo.header.aspect_ratio;
bgDecal.data = bgInfo.data;
bgDecal.format = bgInfo.header.format;
}



Am I screwing up the use of grTexTextureMemRequired somewhere here? It''s about all I can think of that I''m doing wrong.

Do you have some (preferrably simple) source-code that loads multiple textures that I could look at?
If you do, feel free to e-mail it (bendikv@online.no)


Thanks,
-Neophyte

~Death awaits you all, with nasty, big, pointy teeth.
Sorry about the really awful spacing in the above post, but I''m not very familiar with using this board, so although it looked fine when I posted it it came out crap.
Sorry.
Hope you still understand what''s in there...


-Neophyte

~Death awaits you all, with nasty, big, pointy teeth.

This topic is closed to new replies.

Advertisement