Another tricky stuff:
Assume I have a main window created as usual:
window = framework.open_window(); // open the window
then I attach mouse and keyboard events
window->enable_keyboard(); // enable keyboard
Now, the point is that I have another window (DirectX), this window is intended to be full screen and so I’d like to get the mouse and keyboards events attached to this one.
The question is: how can I ‘transfer’ the handling of mouse & keyboard from the framework primary window to the new one?
Was this other window created by Panda, and does it have a GraphicsWindow associated with it? If so, why not just call enable_keyboard() on that window in the first place? Or, if there is some reason you had to call enable_keyboard() on the main window first, and then opened the second window later, then you will have to forego the high-level enable_keyboard() method, and create the lower-level structures individually. Basically all you need is a MouseAndKeyboard and ButtonThrower object in Panda’s data graph; this is what enable_keyboard() does.
If it’s created outside of Panda, then Panda has no access to its window events, and you will need to have some other mechanism to read the window events from there and feed them into the Panda event handler.
Well, the window was created in the c++ Panda-3D program, but this way :
L"WindowClass1", // name of the window class
L"my_dx", // title of the window
WS_EX_TOPMOST | WS_POPUP, // fullscreen values
0,// x-position of the window
0,// y-position of the window
dx_ImageWidth, // width of the window
dx_ImageHeight, // height of the window
NULL, // we have no parent windowNULL
NULL, // we aren't using menus, NULL
hInstance, // application handle
NULL); // used with multiple windows,NULL
The aim is to use it with DirectX (actually I pass the hwnd to directx stuff)
Now the question may be: could this window be created by Panda and its hwnd passed to DirectX?
If yes, I’d need to get access to the hwnd once the panda window is created.
Any particular reason you’re not just running Panda in DirectX mode, and using the Panda window directly, instead of all of this OpenGL-to-DirectX trouble?
You can get the HWND from a Panda-created window with win->get_window_handle()->get_os_handle()->get_int_handle().
Well openGL + DirectX… call it masochism!
More precisely using Panda in OpenGL vs DirectX mode was based on the facts:
I wanted to take advantage of some OpenGL extensions
Was waiting fro Dx11 support
and understood (maybe wrongly) that OpenGL was at the core of Panda
Anyway, I tried both.
Having said so, when running Panda under DirectX mode, I’ve been getting this kind of issues with shaders:
:display:gsg:dxgsg9(error):pixel shader cgD3D9LoadProgram failed at (c:\users\jc\desktop\panda_build_bot_source_bot_release\panda3d\
I think you’ll find that most DirectX 11 features are also available as OpenGL extensions. It’s probably easier to work with those than to try and combine OpenGL and DirectX.
I agree and that’s precisely the point, and this is why I’m not using “load-display pandadx9”
Now I have to leave room for some DirectX stuff since on top of other things I’m getting hooked to Directshow… and here I have no choice.
Hence this explains my mixture of OpenGL and DirectX .