# Tag Info

16

I'm the author of SharpDX, so my advice is going to be biased, but I would like at least to respond about some of your concerns. About SharpDX documentation, the current state is very limited, as I have been working so far to bring the whole DirectX API accessible from .NET and new Win8 OS. As I'm closed to finish on this side, I'm working on providing a ...

6

All of these are pretty high level requirements you have. You may be answering your own questions in that SlimDX is intentionally very low-level, whereas XNA tries its best to answer these high-level requirements, even if the XNA answer isn't necessarily the answer that you particularly seem to be looking for. I haven't worked with SlimDX, so I can only ...

5

It's been a while since I looked at SlimDX, so I feel like drawing some lines to remember how it feels :) Well, it looks like several colored lines are all we need, so lets arrange vertices as a list, describe it's order and draw it: // Simple vertex with position and color. public struct LineVertex { public Vector3 Position; public int Color; } /* ...

5

First: // Create a Query to be able to wait for the completion of the drawing: D3D11_QUERY_DESC qd; ZeroMemory(&qd, sizeof(qd)); qd.Query = D3D11_QUERY_EVENT; hr = m_U->m_pd3dDevice->CreateQuery(&qd, &m_U->m_pEventQuery); if( FAILED( hr ) ) return hr; After the flush put the query in the queue (there is no call like begin in this ...

5

The problem is neither of the conversion functions, the problem is the input matrix. It is not an affine transformation matrix, because the rotational part is not a pure rotation matrix, it has one or more flipping/negated axis in it. Only Rotation matrices can be converted to quaternions. More specifically rotation matrices are orthogonal matrices with ...

4

You're calling SetTexture in your main program (effectively). This binds the texture to a sampler index, not a named sampler variable in shader code... you're not assigning Tex2D in the shader anything. So when you sample it, you get black (all-zero) and multiplying all-zero the way you do will of course still yield all-zero. You could confirm this by ...

4

Specifying the default pool does not instruct Direct3D to put the resource on the GPU. It instructs Direct3D to put the resource in the best pool for the usage you specified for the resource. The task manager is a very poor way of measuring performance, in general. It's possible the allocation is transient and done by the D3D API in order to transfer some ...

4

In general you can use SlimDX.Configuration.ThrowOnError to almost-globally enable or disable exceptions. You can also set up more complex exception exclusions via SlimDX.Configuration.AddResultWatch. You cannot, however, prevent SlimDX from throwing exceptions of a constructor (by design). This is because that's the only way to signal failure of a ...

4

As APIs, SlimDX and SharpDX are almost exactly as difficult to use as the native D3D API or any other APIs they encapsulate. With a few minor exceptions, any ease-of-use benefit you get from either API comes primarily from the fact that you're using a higher level language (C#). This is because, as Martins points out in the comments on your question, they're ...

4

The description is somewhat misleading; even though the SDK link you've posted is for the June 2010 version of the SDK, the DirectX for Managed Code Update is from a much older version of the SDK (whenever they last updated MDX, which was years and years ago as MDX is a deprecated product). The latest SDK still contains the old MDX assemblies, but they are ...

4

I'm not sure it's actually possible to do this, and even if it's possible I doubt it's a good idea. When you run a graphics application, the CPU and GPU are both running at the same time - the GPU is rendering frame n while the CPU is setting up frame n+1. This means any resources, like buffers, that are generated on the CPU and consumed on the GPU need ...

4

The answer doesn't have to do with DoubleBuffered, but rather with the default behaviour of System.Windows.Forms.Forms, which paint their own background when they need to paint. The answer is to add an override in the form: protected override void OnPaintBackground(PaintEventArgs e) { } Which fixes the problem.

3

You may be interested in this paper on hardware-determined feature edges. In particular, the paper discusses techniques for texture parameterization of feature edges, which can be used to apply dotted/dashed stipple pattern textures to your lines. It is probably possible to do this without that kind of texture parameterization (but still using texture ...

3

When drawing 2D overlay disable any lighting and depth test. And set camera projection matrix to orthographic, so no jitter will be present - and you will be able to achieve pixel-perfect mapping. Not sure which version of Direct3D are you using (9/10/11) but here's nice explanation for Direct3D11: http://www.rastertek.com/dx11tut11.html

3

Could you open all of the images before you start the slide show? Store them in an array of textures and then just loop through? If not, then I would suggest using the c# threading classes Josh Petrie suggested, or using the Thread class itself, which can be easier to use than it looks. If you are new to threading I would suggest avoiding it unless you are ...

3

I think the correct syntax to josh's solution is using texture2D FirstTexture : register(t0); sampler texsmp : register(s0) = sampler_state { Texture = <FirstTexture>; }; Using register(0); (without the "s") will result in a compiler error, see register (DirectX HLSL)

3

I swear I added this an answer to this question back closer to when it was originally asked... Check the "max frames to render ahead" setting in the NVIDIA Control Panel, or whatever the comparable setting in the AMD drivers is if using an AMD card. I believe it defaults to 3, which would correspond exactly to what PIX is showing you (the GPU is rendering ...

3

You don't need a separate vertex buffer, you can just put additional vertices in the same buffer. Rather than re-using vertices where faces meet, create a duplicate and set it's normal and texture coords to match the face that it belongs to.

3

The ImageLoadInformation struct does not have sane defaults. You need to make sure they're all set to an acceptable value. You can use the ImageLoadInformation.FromDefaults() function to get a starting value with more appropriate defaults. EDIT: You don't mention in your post whether you're loading from a DDS file. I don't think D3DX knows how to load a ...

3

From your description of your problem, it sounds like the heart of the matter might be that your representation is currently missing data. A bone isn't simply the vector from one joint to the next — it's a full transformation matrix representing the orientation of the local frame, either with respect to world space or with respect to the local frame ...

3

Would the fact that I'm using a texture atlas cause this? Anisotropic filtering only works within a topologically continuous surface. Two adjacent triangles that share an edge position-wise, but have different texture coordinates are not topologically continuous. And thus, aniso won't work very well between triangles. Just use mipmap filtering.

3

I think the proper way of syncronising the surfaces is using "Direct3D9Ex and DXGI Shared Surface Queue": More info: in the docs for the queue, in chapter Interoperability between Direct3D 9Ex and DXGI based APIs here Surface Sharing Between Windows Graphics APIs (Windows)

3

Probably the simplest way to modify your code to get rotation (roll) is to modify the calculation of upVector. Specifically, upVector should be rotated around the planeNormal axis by the desired roll angle; then the calculation of rightVector and all the vertex positions will incorporate the rotation, too. A convenient formula for this is Rodrigues' ...

3

"fx_5_0" refers to the effect file version, not the shader profile. Basically it's just telling the HLSL / effect compiler which version of syntax to allow. You actually control which shader profiles are used when you use the CompileShader function inside your techniques in the effect, like so: technique11 RenderSceneWithTexture1Light { pass P0 { ...

3

In windowed mode in Windows Vista and Windows 7, as well as OS X and many modern Linux desktop incarnations, the application has zero control over refresh. The application's front buffer is really just another off-screen surface used by a compositing system, like dwm.exe in Windows, which then composites the final full desktop image. It may run at a ...

2

Yes, that's the basics of blending: you must manually sort your objects from farther to closer, so when object B is drawn and occludes A, the alpha function merges the two colors correctly. Also, disable depth writing when drawing transparent object.

2

You usually need one and only one device context for your application. Generally this would live in some sort of 'Renderer' or 'Graphics' class, which would often be a singleton. This would handle initialisation/shutdown, and resetting the device on, for example, window resizing or fullscreen-windowed switches. You really don't want a Triangle class with a ...

2

This was a bug in SlimDX; we just left the method out. It was fixed in revision 2134 and should be in the binaries for our September release (which, the name notwithstanding, was shipped in October a few days ago). You can simply call SetResourceArray with an array of shader resource views on any EffectResourceVariable now.

2

Unless the sprite image is itself part of a larger image (see "sprite sheets"), you don't need to do any resizing of the image at runtime. You can simply adjust the geometry of the quad you are rendering so that it appears the desired size, in pixels, in your final render. How exactly you do this depends on how exactly you are setting up your rendering ...

2

elements array sould look like this: // create the vertex layout and buffer var elements = new[] { new InputElement("POSITION", 0, Format.R32G32B32A32_Float, 0, 0), new InputElement("COLOR", 0, Format.R32G32B32A32_Float, 16, 0) }; or // create the vertex layout and buffer var elements = new[] { new InputElement("POSITION", 0, Format....

Only top voted, non community-wiki answers of a minimum length are eligible