Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 05 Oct 2006
Offline Last Active Mar 06 2013 11:15 AM

Posts I've Made

In Topic: DirectX 11 as DLL + WPF for UI

06 March 2013 - 10:59 AM

There is a third method, which is to use a HwndHost control. I'm currently using this for an application that I'm working on and it appears to work and meet my needs so far. The main drawback is that most Win32 messages directed to the HWND in the HwndHost are not automatically forwarded to WPF, so I have to actually raise mouse events etc. myself.


Regarding WindowsFormsHost, I haven't tried it but I heard about it after implementing a HwndHost-based DX11Host class. It actually looks like it might be a better method than HwndHost. I may get around to trying this at some point, but I don't see why it won't work.


I have heard of people using a shared surface technique, where you create a D3D9 render target, which should be straightforward in WPF, and somehow getting a D3D11 handle to it. Apparently this works only in Windows 7 or later. I haven't tried this myself, but see



In Topic: Windowed mode and enumerating adapters and outputs

02 February 2013 - 11:00 AM

Having thought about it some more, it seems that if Windows cannot extend the desktop across multiple adapters, then the problem of finding my window goes away, and I can assume it is on the one-and-only desktop adapter.


Is my assumption that a window can be displayed on any (and more than one) adapter wrong?

In Topic: Rotating points in 3D to match a unit vector.

30 July 2010 - 02:54 PM

Let's say that the the end of the blue line has position P, and I'm assuming that you already have the value of P. For the white circle, I believe you can do something like:

1. Construct a 3x3 lookat matrix R from the blue vector. Such a matrix would transform the endpoint of the blue line P -> Q = (0, 0, 1).

2. You want to go the opposite way, to transform Q -> P. So compute the inverse R^-1 of R (simply by transposing it, since it is a pure rotation matrix).

3. Rotate the vector Q = (0, 0, 1) by R^-1 - this should give the centre of the white circle at the endpoint of the blue line. R^-1 should be the matrix you need to use when transforming the vertices that make up the white circle.

I didn't quite understand what you want to do with the yellow circle, but hopefully you will figure it out if you can get the white circle right.

In Topic: [DX10] Your picking techniques

05 May 2010 - 01:48 AM

I implemented picking for an editor by using multiple render targets:

Render target 1 - colour render target (what the user sees).
Render target 2 - identifier render target, stores primitive IDs. The user doesn't see this.

When I need to do a pick, I read a few pixels around the cursor from render target 2 and make a decision on what ID is under / nearest the cursor. Basically it goes something like

- if there is a valid ID right under the cursor, then choose that.
- otherwise, find most common ID weighted by distance from centre of cursor

It could be more sophisticated than that, but it works OK. Then I look up the primitive corresponding to the chosen ID in a map (needs to use a data structure with near O(1) search time).

The ID codes are stored in the buffer data that is input to the shaders. This means that depending on your needs, you can the make ID codes unique at whatever level of granularity you want: a triangle / point / line, a mesh, part of a mesh, a polygon, a curve, a surface etc. DX10 has good support for integer datatypes.

You could probably also use the ID method as part of a hybrid pick system that also uses geometric information.

The main downside of this method (as I have currently implemented it) is that it can't pick anything that is covered up by something else. A geometric pick system has the advantage of being able to tell you all of the primitives under the cursor, if you cast a ray through the scene.

[Edited by - tweduk on May 5, 2010 8:48:11 AM]

In Topic: [SlimDX r1242] How to use a compiled DX10 shader without effects framework

24 October 2009 - 09:54 AM

Original post by Mike.Popoloski
No, there does not appear to be a way to do that right now. I'm looking to overhaul the shader/effects system for D3D10 and D3D11 soon, so I'll make sure this gets addressed. The main issue is that DirectX provides a ridiculously large number of ways to manage shader data, so bits and pieces get lost in the confusion as we try to decide what to implement.

Thanks Mike. I appreciate the hard work you and the others have put it.