Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


DX8SDK Vertex Tweening tutorial not working...

This topic is 5563 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I just started learning about Vertex Shaders, and I wanted to do KeyFrame based animation. I took a look at the help file supplyed with Dx8SDK. I noticed several mistakes in the examples in the help files, for example leaving out a "(0)" or so, but nothing too serious. Ok, I figured out how to put together, a supposable working Vertex Tweening procedure. Here's what I do: Make a custom Vertex format: private type VF Position1 as D3DVECTOR Position2 as D3DVECTOR TexCoord as D3DVECTOR2 end type Now, i set up a VERTEXBUFFER, with a bunch of triangles loaded from an MD2 file. I set up the shader: Dim Decl(4) As Long Decl(0) = D3DVSD_STREAM(0) Decl(1) = D3DVSD_REG(D3DVSDE_POSITION, D3DVSDT_FLOAT3) 'Position 1 Decl(2) = D3DVSD_REG(D3DVSDE_POSITION2, D3DVSDT_FLOAT3) 'Position 2 Decl(3) = D3DVSD_REG(D3DVSDE_TEXCOORD0, D3DVSDT_FLOAT2) 'Tex Decl(4) = D3DVSD_END() Call D3DDevice.CreateVertexShader(Decl(0), ByVal 0, Handle, 0) But, the code crashes here. (can't create the shader) If I delete the texturecoordinate related line, it works... Ok, now the real problem: If I render simply, like this: Call D3DDevice.SetVertexShader(Handle) D3DDevice.SetStreamSource 0, Md2_Models(id).VertexBuf(Trees(P).cFrame), Len(Md2_Models(id).VertexL(0)) D3DDevice.SetTexture 0, Md2_Models(id).Texture D3DDevice.DrawPrimitive D3DPT_TRIANGLELIST, 0, Md2_Models(id).nTriangles Everything works fine: I see my model's first keyframe. Now, if I add tweening, my model dissapears... Why is that ? D3DDevice.SetRenderState D3DRS_VERTEXBLEND, D3DVBF_TWEENING D3DDevice.SetRenderState D3DRS_TWEENFACTOR, 0.1 'InterpolateAmount I tried almost anything, i looked at the help files, and I'm sure I did everything right, but it still doesn't work... And also: why is it so hard to configure a shader ? Why didn't the first declaration work ? [edited by - Dark_Guy on September 22, 2003 4:15:11 PM] [edited by - Dark_Guy on September 22, 2003 4:16:40 PM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!