Skip to main content
gamedev.net
🔒 Locked

multiple textures

Started by kudi Jan 4, 2002 at 5:53 AM 0 replies 200+ views
Original Post
kudi
kudi
Hi I want different textures on my terrain. Anywhere I have read that I can do this when I just draw the terrain twice like this:
  
lpD3DDevice->SetTexture(0,lpRock);
Landscape->Render(lpD3DDevice);

lpD3DDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE,TRUE);

lpD3DDevice->SetTexture(0,lpGrass);
Landscape->Render(lpD3DDevice);

lpD3DDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE,FALSE);
  
I have tried this and the result wasn''t bad. But I can''t imagine, how this functions. Is the terrain really computed twice, what would be very slow?
The problem of Object Oriented Programming:Everybody tells you how to use his classes, but nobody how not to do it !
thedo
thedo
You are quite correct - this is very slow. Imagine if you will that your landscape has 100,000 polys in it - suddenly you are doubling that throughput. Look into multi-texturing - this calculates the poly once but can render (up to 8) simultaneos textures (hardware dependent).

If you have it look at the MFC texture demo - it even gives you the setup code!

Neil

WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!
WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.