GDI and DirectX

Started by
3 comments, last by crazemanx 22 years, 6 months ago
I wrote myself a lovely set of macros to help with debugging, which wrote various useful informations to the screen using the GDI TextOut function. This works fine until i start double buffering, at which point the GDI continues to write only to the area of memory containing the original primary surface. Basically only one in two frames feature my nice GDI text. Is there a way to tell the GDI to write to the right part of memory, or alternatively does anyone know of an alternative way i could do this easily? (without using two monitors) Thanks NICK
Advertisement
Im not 100% sure but i think u call GetDc on your backbuffer and se that then call ReleaseDc or something
______________________Qix99 (Qix was taken)
Aha! your suggestion set me thinking and i realised i was using:

hdc = GetDC(hwnd)
...
ReleaseDC(hwnd, hdc)

from Win32 rather than:

primarysurface->GetDC(&hdc)
...
primarysurface->ReleaseDC(hdc)

which solves my problem! I am happy now

thanx
Nick
Depending on which version of DX you''re using, using the GDI can range from bad to extremely bad in terms of performance. If you are just using it for debugging it might not matter, but keep that in mind...
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
Just an idea, why not write to a file instead? That way in case of a crash you have an idea what has happened.

l8a

This topic is closed to new replies.

Advertisement