Cnotrols in DX8 window

Started by
11 comments, last by mdfmKoRn 22 years, 3 months ago
Is it possible to draw something such as a combo box in a DirectX 8 window? If so, is it possible to do it when fullscreen? ---- Herb M. (mdfmKoRn) www.sky-meyg.com s3202@attbi.com
Advertisement
MFC fog on the sdk does it in a window, not sure about a combo box in full screen but you can pop up a dialog box
Look up Combo box in the SDK docs
(just kidding...)

There are a couple of different meanings to your question - can you draw GUI elements within your 3D scene (like a HUD), or can you draw GUI elements next to your viewport (like MFCFog). The latter is easy, the former is usually very difficult because GUI objects have no notion of a D3D back buffer, depth buffer, etc. Something like a dialog box works, but I personally find that clumsy and ugly whenever I see it. A couple of options in fullscreen mode:

1. build your own GUI components in the D3D world. At the beginning it''s a pain, but it''s not a killer and it''s ultimately very flexible for different styles, transparency, etc.

2. Don''t use fullscreen mode. Instead, change the screen resolution in the app and make your windowed app as big as that new resolution. Then, use MFCFog as an example. When the app ends, make sure you set the resolution back.
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
3. Look up, study and use GDI+.

Happy Hacking!

[ GDNet Start Here | GDNet FAQ | MS RTFM | STL | Google ]
Thanks to Kylotan for the idea!


How does GDI+ enable rendering of controls to a D3D environment?

I looked it up and all it seems to enable is a "class based" approach to using GDI in the first place? Lines, pens, brushes, fonts, etc..

Did i not look at it deep enough?

Just curious, because the question of controls in a 2D/3D environment comes up quite a bit. To me, it seems as if we ought to be able to either a) create a control (listbox, edit, etc) and parent it to the window we use for our rendering and have it draw itself correctly. or b) use the controls, but owner draw them into a 3d context.

The best approach I have encountered so far is Mason''s articles on building a user interface or to use linux and open gl/sdl and one of the widget toolkits?

Hrm... GDI+ is looking like more than just a class based approach. At first I thought it was just a WinXP thing, I think I might be wrong. I''ll have to look at it some more.

CrazedGenius, I''m trying to do the former. I''m trying to draw GUI elements within a 3d scene. I agree, popping up a dialog box would be really sloppy. I''m not even considering that. I''m looking for a good (possibly cheap way to get user input in my D3D app. Kinda like an edit control. I would make my own but I''ve been having nothing but trouble with the dreaded font drawing methods for D3D. ID3DX sux, it''s too slow. CD3DFont is driving me crazy. It works fine when I compile Microsoft''s code. I put it in mine and I get access violations everywhere.



----
Herb M. (mdfmKoRn)
www.sky-meyg.com
s3202@attbi.com
About CD3DFont -

My guess is that you are not calling RestoreDeviceObject (I think that''s what it''s called) and the other SDK framework specific calls. Look carefully at how the samples use it. You need to make sure you call these functions at the right time in the right order.
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
When do you have to call RestoreDeviceObject()? I thought you only had to call it when you lose the device. (like the user alt-tabs out)

----
Herb M. (mdfmKoRn)
www.sky-meyg.com
s3202@attbi.com
Sorry - didn''t have the code and meant that as a "for instance". Are you calling InitDeviceObjects?

If you''re crashing, step through in the debugger. I''m *guessing* that you will find that you are trying to use a font that was not fully created. Hence, the calls to something like InitDeviceObjects (for instance). Just a hunch...

Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
I called InitDeviceObjects(). It''s crashing on locking the vertex buffer in the DrawText() function. *scratches head*

----
Herb M. (mdfmKoRn)
www.sky-meyg.com
s3202@attbi.com

This topic is closed to new replies.

Advertisement