Jump to content
  • Advertisement
Sign in to follow this  

R2VB in MDX (c#)

This topic is 4270 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

hi guys, well im new here in the forum as well im new in mdx. right now im working on a project for geometry refinment and i wanted to play around with the ati's r2vb workaround. but unfortunately i cant get it work in MDX - in the ati sdk are few examples and documentation how to use it but only for c++. since the enviroment in mdx is littl bit different, i dont know how to set it up. i found in the forum the post from acid2 but the sources he's pointig to are not available. could some one help me to set it up in c#?
device->SetTexture(D3DDMAPSAMPLER, renderTaget);

how can i express it in c#? SetTexture accepts only int as the first parameter, how can i know the id for D3DDMAPSAMPLER or i.e. D3DVERTEXTEXTURESAMPLER[n] ? [Edited by - przem on November 10, 2006 2:17:54 PM]

Share this post

Link to post
Share on other sites
no one can help me?

finally i figured out, how to set up all the bindings in c# - i.e. D3DDMAPSEMPLER is 256 - (int)DisplacementMap.Sampler. all the other setting too.

but it doesnt work - the vertex buffer isnt binded and it renders only one pixel, probably the one form the dummy vertex buffer with 4byte, since if i switch off the r2vb stuff, the pixel is still there.

the vertex declaration is set to float4 since i store the vb in a A32B32G32R32F texture in homogenus coords.

some code:

// 1.
device.SetRenderState(RenderStates.PointSize, ati.R2VB.r2vbGlbEnable_Set(1));
// 2.
// 3.
device.SetTexture((int)DisplacementMap.Sampler, buffer1);
device.SetRenderState(RenderStates.PointSize, R2VB.r2vbVStrm2SmpMap_Set(2, R2VB.R2VB_VSMP_OVR_DMAP));

device.VertexDeclaration = vertexDecl2;
device.SetStreamSource(2, vbdummy, 0);
// 4. draw
device.DrawPrimitives(PrimitiveType.TriangleFan, 0, 1);
// 5.
device.SetRenderState(RenderStates.PointSize, R2VB.r2vbVStrm2SmpMap_Set(2, R2VB.R2VB_VSMP_OVR_DIS));

device.SetTexture((int)DisplacementMap.Sampler, null);
// 6.
device.SetRenderState(RenderStates.PointSize, R2VB.r2vbGlbEnable_Set(0));

the vertex declaration:

VertexElement[] elements2 = new VertexElement[]
new VertexElement(2, 0, DeclarationType.Float4,
DeclarationUsage.Position, 0),

// dummy vertex buffer
vbdummy = new VertexBuffer(e.Device, 4*sizeof(float), Usage.None, CustomVertex.PositionOnly.Format, Pool.Default);

has someone any ideas??

Share this post

Link to post
Share on other sites
I'd suggest that you e-mail acid2. His e-mail is in his profile. If he gets the archive back up, it'd help anyone interested in this stuff.

Share this post

Link to post
Share on other sites
I had a chat with Ollie/Acid2 about this a few weeks ago, but he didn't have the sources himself anymore either. He sent me the sources as a demo a while ago though and that seems to be quite complete (download it here). It's in MDX 2.0, so it will take some tinkering, but it should help you on your way.

Share this post

Link to post
Share on other sites
ok, got it. thanx very much.
it was - as asumed - one small thing... the only problem was my dummy vertex buffer, which had to be declared with Usage-flag WriteOnly. intresting.

vbdummy = new VertexBuffer(e.Device, 4 * 4 * sizeof(float), Usage.WriteOnly, (CustomVertex.Transformed.Format), Pool.Default);

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!