View Full Version : Animated textures
15-03-2005, 03:46 PM
Questing about animated textures...
I'm currently thinking about the fastest way to make a dynamic animated texture.
1: Create a texture
2: Render an other texture over it (convyorbelt for example)
3: render more textures over it (even with multi textureing)
4: render texture (i created) to my world
5: I also can render that texture to another texture :)
so, its dynamic, but is there an other or faster way to do so ??
15-03-2005, 06:20 PM
It's the way to do. But it's recommended to actually have 2 textures:
[1 frame] Render to (texture 1) and "forget" about it. Render your scene using (texture 2)
[2 frame] Swap textures. So render to (texture 2) and render you scene using (texture 1).
[3 frame] see frame 1
This way you let your GPU/driver more possibility to avoid "locking" in single frame.
15-03-2005, 10:17 PM
Ok.... i'll get it a litte... but should I use 2 textures also when i'm making a texture with an u,v transformation ? like "streaming" lave/water for example?
16-03-2005, 06:54 PM
It depends on what are you understanding by "streaming". But if you lock/render to texture each frame when double buffering it is a good way.
16-03-2005, 10:10 PM
I have created a texture:
Textures[ Index ].Texture)
Im trying to render on the texture:
if Succeeded( Textures[Index].Texture.LockRect( 0, lr, nil, 0 ) ) then
if Succeeded( Textures[Index].Texture.GetSurfaceLevel(0, Surface) ) then
SetTexture(0); // set texture 0 (temp)
// create vertex buffer
SetVertexBuffer(256, 256, 0, 0, 0, 1, 1, 0, 1, 1);
FScreen.Device.SetStreamSource(0, FTempVertexBuffer, 0, sizeof(D3DFVF_TEXTURE_VERTEX));
FScreen.Device.DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
// Finally unlock...
but it's not renderd on the texture it self but on the main surface of my rendering...
You can apply a transformation matrix to a texture. Much more efficient than rendering to a texture.
Here is an example of it.
17-03-2005, 01:00 AM
But i want it to work cause in the future i want to render some things to a texture (for interactive (camera) screen or for example)
My problem is: Iam unable to create a render target
if Succeeded( D3DXCreateTexture(FScreen.Device,
Textures[ Index ].Texture) ) then
when i replace D3DUSAGE_RENDERTARGET with D3DX_DEFAULT its all OK but i can't render on it cause it's not a render target... please need help!!!
18-03-2005, 08:45 PM
Install DirectX Debug Runtime !!!
You can't create D3DPOOL_MANAGED rendertarget only D3DPOOL_DEFAULT.
This one works:
// Create the blank texture
Result:= pd3dDevice.CreateTexture(1, 1, 1,
if V_Failed(Result) then Exit;
Powered by vBulletin® Version 4.1.10 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.