Using juce with Direct3D and DirectDraw


#1

Hello!
I begin create a simple grahics editor. In this project i have two main tasks

  1. Investigate juce.
  2. Investigate Direct3D and DirectDraw.

Question: how can i get a window HANDLE to init DirectX and draw on juce’s windows?

As i think i can use Windows API functions like ActiveWindow or something like this to get a handle, but i’d like to know is this possible to get some platform specific information?

P.S. Sorry for my english :smiley:


#2

getWindowHandle() - a method of Component, should return the native window handle.

But if you care about platform independence, you might want to look at OpenGL instead of DirectX. DirectX is Windows and Xbox only, OpenGL is everything but XBox.

The biggest downside to OpenGL (in my opinion) is that the drivers are not especially well supported under Windows. But if you want to do performance graphics in a multi-platform way, it is still probably the way to go.


#3

I did this using DirectDraw7 for a meter application where the client wanted high refresh rates.

Once you have the native window handle for your component, you can create a child window that isn’t serviced by JUCE.

Once that’s done, it’s just like using regular DirectDraw. You have to fool around a bit with translating window coordinates between JUCE component coordinates and Windows native coordinates, but it’s not too bad. You have to handle your own resizing and painting.

The upside is you can get refresh rates at the monitor rate with very low CPU usage.

For me, it worked best for non-interactive displays - it was just a big rectangle in the middle of the window that blitted audio meters. The JUCE controls were all around the DD7 child window. Overall, I was pretty happy with it.

Matt