Tag Info

Hot answers tagged

15

The simplest way is to calculate how much ball is moved and rotate the ball that much divided by it's radius! And the reason: we all know how they calculate PI. imagine a circle with radius of one unit, it's perimeter is 2*PI as shown in this picture: Now in your case the ball may move in any direction. but it's movement speed is always a 2d vector (note ...


13

Windows Advanced Rasterization Platform (WARP) WARP is a high speed, fully conformant software rasterizer. It is a component of the DirectX graphics technology that was introduced by the DirectX 11 runtime. The DirectX 11 runtime is installed on Windows 7, Windows Server 2008 R2, and Windows Vista with the [KB971644] update. To use WARP ...


12

It's probably a bad idea to create new classes for each type of geometry you're going to support. It's not very scalable or maintainable. Additionally, the class design you appear to want now seems to conflate the tasks of managing the geometry itself and the instance data for that geometry. Here's an approach you can take: Create two classes, Mesh and ...


12

For well over a decade hardware vendors have been pushing triangle strips, indexed triangle lists and indexed triangle strips as the fastest primitive types to use. Why? Strips have better cache locality (reusing the last 2 verts submitted instead of having to continually jump back to the first one) and indexing allows hardware vertex caches to actually ...


11

You should usually prefer to use the D3D11 API, because it introduced downlevel feature level support that allows you to target 9, 10 or 11 level features using the same (D3D11) API. This means cleaner, more compact code so long as you don't have to support XP (and thus need to use the actual D3D9 API as well). If you choose to require D3D11-level features, ...


10

D3D9 is quite different from an API perspective than D3D10, but the underlying concepts are very similar. Any terrain rendering example in D3D9 (such as this one) will work fine in D3D10, you'll just have to translate the API calls which shouldn't be that difficult. Similarly, since the techniques for rendering terrain are in no way API-specific, you could ...


10

Many rules for micro-optimising shaders are the same as for traditional CPUs with vector extensions. Here are a few hints: there are built-in test functions (test, lerp/mix) adding two vectors has the same cost as adding two floats swizzling is free It is true that branches are cheaper on modern hardware than they used to be, but it is still better to ...


9

Anything I can say on the subject is said better here: http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter03.html, but I'll give you my best shot anyway. The idea behind hardware instancing is that you reduce the amount of GPU draw calls by sending each mesh only once, together with a list of transforms. This offloads some of the work done by the CPU ...


8

In DirectX 10 the cards all have the same capabilities: this means that they guarantee that all features are available and implemented. However, they are free to do driver-level optimizations. Take, for example, the major difference in the way that they do anisotropic filtering (this article contains sources). Not only is the output of each vendor different ...


7

Yes; the feature that does this is called "stream-out". For D3D10, the documentation can be found here. It captures the geometry shader output to a vertex buffer you specify, which can then be re-used. For OpenGL, the same functionality exists under the name "transform feedback". The relevant OpenGL spec can be found here.


7

VS2012 now includes fxc in it's build process, defaulting it to enabled and a non-fx target. You can either Disable it completely as Pasha suggested, by changing the item in the project to Do Not Bulid or Change the compile settings to what you want. The easiest way to do this is right click on the .hlsl file, go to properties and then HLSL Compiler. ...


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 ...


6

Instead of D3DXVec3Unproject() use XMVector3Unproject(). It accpet float parameters for viewport: XMVECTOR XMVector3Unproject( [in] XMVECTOR V, [in] float ViewportX, [in] float ViewportY, [in] float ViewportWidth, [in] float ViewportHeight, [in] float ViewportMinZ, [in] float ViewportMaxZ, [in] XMMATRIX Projection, [in] XMMATRIX ...


6

D3D10 core didn't have a mesh class; you're probably thinking of ID3DX10Mesh, which is actually part of the D3DX API. D3DX itself was wholly deprecated with Windows 8. The relevant math bits were moved into another library. The higher-level utility interfaces, like mesh, were not ported. The API was removed because it was a continuation of the evolving ...


5

normalizing is a simple calculation, I would expect the function to have one parameter - the vector to be normalised. Why does it have two? could somebody write an example of how I would use it? Normalizing is, indeed, relatively simple. It's also an operation that is performed often and consequently should be very fast. Performance considerations ...


5

The purpose of "instanced" rendering is to make one draw call to draw all of the instances. You are making allLines number of draw calls. So no, that's not instancing. Since each instance is completely separate from the other, sharing absolutely no data at all (the matrix is basically just a bulky way to encode the two endpoints of each line), you would ...


5

Gajet's answer does an excellent job of covering the '2d' case, where your ball moves in one dimension; if you want to roll it across a plane then things get decidedly more complicated, but still very manageable. Here the ball is rolling across a plane in the direction of the green arrow, with (instantaneous) velocity V; the rotation is around the axis of ...


4

Consider your own format only if you can articulate demands that are very unique to your scenario, and even then - (good) mesh formats are extensible and would probably suit your needs. If you're developing in the MS universe there's DirectX's own .X format, which personally I think is very well designed. It supports animation, optional compression, and is ...


4

The D3DX10math.h header still contains declarations for the dot and cross product of vectors. I think the documentation of the D3DXMath library on MSDN is incomplete. The following example worked fine for me (Please excuse the absolute path for including the header): #include "C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include\D3DX10math.h" ...


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

Direct2D is using the GPU unless you specified not to use it... but unfortunately, Direct2D is in fact not as efficient as we would expect. There was a similar question on gamedev forum "Fastest way to draw connected lines?" I ran again the test on your test case and the results are again a bit scary... When you are trying to draw 10000 ellipse on the ...


4

You should not use DirectInput. It has been completely deprecated in favor of RAWINPUT. The answer that uses WM_MOUSEMOVE is not the same as RAWINPUT and I expect it to not be fast enough. An example using RAWINPUT in a Win32 app is available on my blog


4

Your 2 FPS experience is most likely on account of something else in your code rather than use of a DLL. When loaded a DLL is mapped into the same address space as the main process, so a function call into a DLL is really nothing more than transferring execution to another address (with the standard stack work, of course). Quake II used a DLL for it's ...


4

You're intent on separation of "nasty" code from "non-nasty" code. That's what OOP encapsulation is for. Classes are as good as you'll ever need, since separation of code is a coding/compile time concern, not a runtime concern as DLLs are. Not only that, but by factoring/organising your code into classes, you will have a better understanding of how they fit ...


4

-1.#IND means division by 0, make sure that SCREEN_WIDTH and SCREEN_HEIGHT have a non-zero value.


4

One of the major benefits is the clear separation of the device and the context The device is synchronized for use in arbitrary threads and is used for maintenance tasks like creating resources, while a context is tied to a particular thread. There's two flavors of context, the immediate context which is tied to the GUI thread, and the deferred contexts, ...


4

I do not know how much this actually affects the development but as with any such changes, it's been told that they will let driver developers write better drivers. The complexity of GPU drivers is amazing but I'm not sure if this exact change will help much. In either case, it's possible to replace triangle fans for most of your needs (like convex polygon ...


4

Generally it's OK. Shaders will execute in groups of vertices or pixels (different vendors have different terminology for these so I'm keeping away from that) and if all vertices or pixels in a group take the same path then branching cost is negligible. You also need to trust the shader compiler. The HLSL code you write should not be seen as a direct ...


3

Basically it allows you to have an input vector different from an output vector, like so: D3DXVECTOR3 bulletMovement = /*...*/; // the whole bullet movement D3DXVECTOR3 bulletDirection = /*...*/; // the DIRECTION of the bullet movement, with a length of 1. D3DXVec3Normalize(&bulletDirection , &bulletMovement); This way you keep your whole bullet ...


3

Direct3D no longer ships with a software rasterizer. You could, however, check out WARP. http://msdn.microsoft.com/en-us/library/gg615082.aspx



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