Archived

This topic is now archived and is closed to further replies.

mdfmKoRn

Cnotrols in DX8 window

Recommended Posts

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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster


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?

Share this post


Link to post
Share on other sites
mdfmKoRn    122
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

Share this post


Link to post
Share on other sites
CrazedGenius    156
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.

Share this post


Link to post
Share on other sites
CrazedGenius    156
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...

Share this post


Link to post
Share on other sites
Oluseyi    2103
quote:
Original post by Anonymous Poster
How does GDI+ enable rendering of controls to a D3D environment?

http://www.microsoft.com/hwdev/video/GDInext.htm

Pay particular attention to the following statements:
quote:

It must be possible to seamlessly mix 2-D, 3-D, video, and animation with high performance.

Graphics accelerators may support layering in the DAC (digital-analog converter). GDI+ will provide services that allow the driver to hook the top n layers in the z-order, and render them in hardware. It is up to the hardware as to the number of layers it supports in the back-end; GDI+ will emulate any layers lower than the top n using front-end compositing.

A common theme of GDI+ is the integration of 2-D and 3-D, from the API (application programming interface) to the DDI (device driver interface). On the DDI side, GDI+ will use existing 2-D and 3-D hardware acceleration capabilities by leveraging the Microsoft Direct3D® command stream for all hardware acceleration. GDI+ will use a mixture of D3D and GDI+ command tokens for all its rendering.

GDI+ can freely intermix "3-D" and "2-D" rendering without incurring costly state changes.


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

Share this post


Link to post
Share on other sites
DrunkenHyena    805
G''day!

To the best of my knowledge GDI+ cannot be used directly with D3D8 just as GDI cannot be used directly.

What the quoted blurb means to me is that GDI+ is built on top of D3D so that it can benefit from acceleration where available. That does not mean that you can use GDI+ with D3D yourself.

I flipped through the docs on GDI+ and saw no mention of D3D surfaces or textures. This is something I really wouldn''t mind being wrong on, but I don''t think I am.

Stay Casual,

Ken
Drunken Hyena

Share this post


Link to post
Share on other sites
mdfmKoRn    122
Good God, how do you even begin to use GDI+? I included the gdiplus.h and included the libs files. Now the compiler completely geeks out with over 100 syntax errors comming from the header files.

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


Edited by - mdfmKoRn on January 17, 2002 3:00:34 AM

Share this post


Link to post
Share on other sites