I've been reading some code and I see lots of examples (mostly ones that are far more complicated than I'm ready for) that run in a window, but that leaves me wondering:
1) Do I need to have a backing window for fullscreen graphics? Appears that the canvas is attached to a window normally?
2) How do I even get into fullscreen mode?
Anyone have a stupid simple example of flipping to fullscreen and throwing a single pixel up?
I had some start samples (not stupid ) here:
http://luce.yves.pagesperso-orange.fr/FenetreDX9.htm (http://luce.yves.pagesperso-orange.fr/FenetreDX9.htm)
There is two samples in the zip,a simple directx window and the same with a triangle.
Quote
Do I need to have a backing window for fullscreen graphics?
You need a special window as show the sample.
For many more questions,download the directx sdk (it's place depend of your system),he is full of samples in C
Quote from: ToutEnMasm on September 17, 2014, 02:26:16 AM
I had some start samples (not stupid ) here:
http://luce.yves.pagesperso-orange.fr/FenetreDX9.htm (http://luce.yves.pagesperso-orange.fr/FenetreDX9.htm)
There is two samples in the zip,a simple directx window and the same with a triangle.
Quote
Do I need to have a backing window for fullscreen graphics?
You need a special window as show the sample.
For many more questions,download the directx sdk (it's place depend of your system),he is full of samples in C
Thanks! I'll check that out tomorrow!
I've got the DirectX SDK, but it's very confusing. The download page said "for XP, Vista, and Windows 7", but all of the examples and documentation I've read so far say "Vista or 7 only". Having a real hard time getting down to the basics. I don't want to build full textured pyramids, etc. I just want to put a dot on the screen! It's like they're trying to teach how to fly with a 747 instead of a little Cessna. :-)
To put a dot on the sreen GDI and GDI + are a good way.
You surely find in this forum,samples drawing a sinusoide in points.
dirextx for XP and more is here
http://www.microsoft.com/en-us/download/details.aspx?id=6812 (http://www.microsoft.com/en-us/download/details.aspx?id=6812)
a while back, we were discussing OpenGL, as opposed to using Direct3D
you might look into it
as for creating a window that is full screen
well - windows 7 dropped support for full screen
but, you can create a borderless window (popup), size it to the screen, and make it top most
a single pixel is easy, but you might like a line or a box, at least :P
later today, i may play with it, if i have some time
Here is a sample of can be down with GDI plus.
More than a point,a line.
To go full screen,just use the normal api (search Msdn).
BLUEMR2,
I Googled: DirectX Full Screen Mode (https://www.google.com/?gws_rd=ssl#q=DirectX+Full+Screen+Mode),...and found lots of information.
There's this: DirectX Graphics Infrastructure: Best Practices, Full-Screen Issues (http://msdn.microsoft.com/en-us/library/windows/desktop/ee417025(v=vs.85).aspx#full-screen_issues)
...And, there's this: IDXGISwapChain::SetFullscreenState Method (http://msdn.microsoft.com/en-us/library/windows/desktop/bb174579(v=vs.85).aspx)
Quote from: ToutEnMasm on September 17, 2014, 03:58:23 AM
To put a dot on the sreen GDI and GDI + are a good way.
You surely find in this forum,samples drawing a sinusoide in points.
dirextx for XP and more is here
http://www.microsoft.com/en-us/download/details.aspx?id=6812 (http://www.microsoft.com/en-us/download/details.aspx?id=6812)
Really, GDI sounds a lot better for my purpose, but I understand it's deprecated now? Only supposed to use DirectX?
That's the SDK I downloaded. Despite the 9.0c and XP labels (and 2010 date) though, the contents are actually all about DirectX 11 and Vista and higher. Very confusing, but that seems to be typical Microsoft, they make cool stuff, but trying to find correct documentation is difficult (In my day job, among other things, I do Java and C#. C#/.Net documentation is at least an order of magnitude harder to find than the same thing for Java). :-)
i would bet that GDI is supported for many windows versions to come :P
you can't always trust what MSDN says about "not using" a function
here's a really simple example that sets a single pixel using GDI
there are faster ways to set pixels
and - you generally want to double buffer - but, this will get you started
the program has "left-over" code in it to set a title bar icon - you could delete that stuff, i guess
the pixel is in the center - you may have to squint to see it - lol
(press any key or click a mouse button to exit)
:icon_mrgreen: Thanks again for all the help!
Moving from DOS assembly to win32 for console apps wasn't a big deal, but doing the same for graphics seems to be much harder. Now I wish I hadn't completely skipped the 16-bit Windows era!
I have modify my sample,he show also,now,how to switch in Full screen.Clic on the window.
If you have a good eye,it show also a dot.
Thank you all, especially dedndave & ToutEnMasm who went above and beyond with perfect samples to help me build mental context!
I'm able to read all the code and have gained a good enough understanding of the win32 event model and paint process to move forward. I was able to integrate the critical segments of that code with what I had started already to build a base for this first win32 graphics application. Obviously, there's a LOT more I'll need to do as I move forward, but the biggest hurdle was getting the first thing assembled and generating some output. I now have that and will be able to do some exploring starting from this small kernel of knowledge! :-)
learning basic GDI isn't too hard
there are a few hurdles to get over, in the way of understanding the terminology - lol
when i started playing with it, i didn't really understand what a device context (DC) was
and, to be honest, i'm not sure i can describe it in one sentance that is comprehensible :P
but - i went on, without knowing, and learned to program around what i didn't know
it's like using Ohm's Law without understanding it - you assume it to be correct, and understand it later
the main thing to know is - there are 2 basic "modes" of DC's
one is a "physical" DC - it applies to displays, printers, etc
it may have a fixed set of colors, fixed dimensions, and so on
the other is more of a "virtual" DC - it exists in memory and may have whatever attributes you assign to it
drawing into a memory DC is typically much faster than drawing into one for a physical device
after that, you learn about DIB's (device independant bitmaps) and DDB's (device dependant bitmaps)
and, you are on your way to drawing with lines, circles, etc
DAVE !!!
Quote from: DAVE !!!...when i started playing with it, i didn't really understand what a device context (DC) was
and, to be honest, i'm not sure i can describe it in one sentence that is comprehensible,...
A Device Context (http://msdn.microsoft.com/en-us/library/dd183553(v=vs.85).aspx) is just a data structure. The system uses it to manage the graphic device.
Quote from: BLUEMR2Really, GDI sounds a lot better for my purpose, but I understand it's deprecated now?
GDI is so fundamental to Windows graphics that I don't think it will ever be truly deprecated. Many other graphics libraries eventually call GDI functions to do the essential work of sending data to the graphics driver.
I still think that: Windows Graphics Programming, Feng Yuan, 2000 (http://www.fengyuan.com/) is the best introductory book about Windows graphics out there. Many porgrammers consider it obsolete. It really depends on what you want to do. If you just want to display two dimensional images, it's easiest to use Bitmaps (http://msdn.microsoft.com/en-us/library/dd183377(v=vs.85).aspx), DIBSections (http://msdn.microsoft.com/en-us/library/dd183494(v=vs.85).aspx), etc. If you want the power of three dimensional graphics, DirectX is by far the best way to go.
...And, as I mentioned in one of my previous posts to you,...
...for GDI programming: EDGAR's Graphics Lib (http://www.donkeysstable.com/files/Graphics.zip)
Quote from: Zen on September 19, 2014, 03:44:11 AM
A Device Context (http://msdn.microsoft.com/en-us/library/dd183553(v=vs.85).aspx) is just a data structure. The system uses it to manage the graphic device.
i get that - but it doesn't help a newcomer understand and use it, much
in the movie "The Matrix", they called it "the construct"
as accurate as anything else, still not very helpful - lol
...I dunno DAVE,...that's about as simple as I can phrase it,...maybe a larger font,...
A DEVICE CONTEXT IS JUST A DATA STRUCTURE.
THE SYSTEM USES IT TO MANAGE THE GRAPHIC DEVICE.
Try this scientific experiment:
Write a GDI application WITHOUT calling: GetDC Function (http://msdn.microsoft.com/en-us/library/dd144871(v=vs.85).aspx)
The GetDC documentation states: The device context is an opaque data structure, whose values are used internally by GDI.
...Here it is in a LARGE font:
The device context is an opaque data structure, whose values are used internally by GDI.
(http://www.sherv.net/cm/emoticons/sick/big-headache-smiley-emoticon.gif)
Hey, it looks like the Firefox DC occasionally selects the wrong font ::)
What is a DC?
A Device Context (DC) is core of the GDI (Graphics Device Interface), Windows' graphics library. Behind the scenes the DC is the interface between our applications and the output hardware, however when developing with them we rarely see this aspect and can just think of them as a holder for various drawing objects and properties. As its name suggests, a DC puts all the objects it contains in the context of a specific device which and will work out how to format those objects to be compatible and efficient with the desired device. A DC also stores information about the device it's bound too and what it's capable or rendering, as well as holding various properties that can affect the outcome of various drawing routines.
What Is a Device Context?
The context of a device is the current state of the device hardware. The device driver manages the device context for a process on behalf of the process. The driver must maintain a separate device context for each process that accesses the device. The device driver has the responsibility to restore the correct device context when a process accesses the device.
Really,...what Is a Device Context ???
A device context is a Windows data structure containing information about the drawing attributes of a device such as a display or a printer. All drawing calls are made through a device-context object, which encapsulates the Windows APIs for drawing lines, shapes, and text. Device contexts allow device-independent drawing in Windows. Device contexts can be used to draw to the screen, to the printer, or to a metafile.
This is my personal favorite Device Context function: GetDeviceCaps Function (http://msdn.microsoft.com/en-us/library/dd144877(v=vs.85).aspx)
...Try it,...it's Fun,...it's Informative,...
...By the way,...you can probably GOOGLE just as well as I can,...
Zen did you have your ZEN meditation today? ;)
(http://energiepozitiva.files.wordpress.com/2014/07/zazen5.jpg?w=286&h=300)
...It's entirely possible that I skipped my Med,...and went straight to FULL_BLOWN anxiety,...
(http://raeganhuston.com/wp-content/uploads/2012/07/Zen-Dog1.jpg)
That's a good one, Zen. :lol: :lol: :lol:
Gunther
What a handsome dog. :P
It's a Dog Star,not a DC
but, Zen - what's a DC ?
:badgrin:
...Ha,...ha,...ha,...
This is what I love about the MASM Forum is that everybody is so dang
FUNNY (except, ONAN,...of course,...).
...By the way,...the zen dog (above) obviously has been extensively Photoshopped,...
...He originally was a naked picture of Lindsay Lohan (http://4.bp.blogspot.com/-nvjULwD81Ek/TwxMx9IWxHI/AAAAAAAAFUg/giV6pCI6xGI/s1600/lindsay+lohan.jpg),...
...And, DAVE !!!
Quote from: ...but, Zen - what's a DC ?
...OK,...OK,...if I reveal the BIG SECRET ABOUT DEVICE CONTEXTS (DCs),...will ya quite trying to demolish my brain with yer diabolical Jedi Mind Tricks,...??? OK,...
...If I recall correctly (from Feng Yuan's, Windows Graphics Programming, 2000) there are several HUGE Data Structures maintained in kernel mode address space that GDI
secretly uses for validating graphics operations. I wish I still had my old copy of his book, I'd post all the pertinent information. Feng Yuan is alot smarter than I am. But, how the heck did he figure it out,...since all the kernel-mode stuff is OFFICIALLY undocumented ??? Incredibly, he used the kernel-mode debugger (which is included in the old Microsoft Windows Driver Development Kit, DDK),...he somehow found a command that displayed the
secret kernel-mode data structures (they had different names,...of course), and noted that many of the fields and values were exactly the same as the fields and values in a GDI Device Context (DC). This was the era of Windows 2000,...so, I don't know if it is still a valid explanation,...
...But, the REALLY cool aspect of this explanation is that the data is part of a KERNEL-MODE COMPONENT,...which means that the average assembly programmer can neither read nor write to that address. SO,...YOU'LL NEVER REALLY KNOW !!!
SO,...HAH !!!...But,...I'm thinking,...maybe, we can trick
QWORD into figuring it out for us,...
...But, once he realizes he's been savagely duped...he will be mad at us,...and probably seek a terrible revenge,...
...Using QWORD's brain remotely is pretty much like cheating, though,...so, I'd be feeling a little guilty,...
You mean....this ?
http://blogs.msdn.com/b/fyuan/archive/2007/03/20/source-code-for-windows-graphics-programming-win32-gdi-and-directdraw.aspx
http://www.fengyuan.com/readme.html
At google you may find it. I removed the previously direct links to avoid Copyright infringement.
https://www.google.com.br/search?q=%22Windows+Graphics+Programming%22+Win32+GDI+and+DirectDraw+download&newwindow=1&client=firefox-a&hs=DOi&rls=org.mozilla:en-US:official&channel=sb&biw=1920&bih=956&ei=ff8fVLufGYvksATzroLwCA&start=10&sa=N
:t
With the help of the GDI kernel extension, we will examine the GDI objects' kernel data structures.
Device Context in the GDI EngineThe device context is a major GDI object which holds lots of settings for the Win32 API to interact with a graphics device, whether a display card, a printer, a plotter, or an image setter. The GDI stores data for a device context in two places. There is a user mode structure, named DC_ATTR, which stores settings like current pen, current brush, background and foreground color. DC_ATTR structure is shown in Section 4.3. The GDI engine also keeps a structure, DCOBJ, in kernel mode address space which holds complete information for a device context object, including a duplicate of DC_ATTR. For a device context handle, the pKernel field in its GDI object-table entry points to an instance of DCOBJ, while the pUser field points to an instance of DC_ATTR.
// dcobj.h
// Windows 2000, 440(0x1B8) bytes
typedef struct
{
HPALETTE hpal;
void * ppal;
void * pColorSpace;
unsigned lIcmMode;
unsigned lSaveDepth;
unsigned unk1_00000000;
HGDIOBJ hdcSave;
unsigned unk2_00000000[2];
void * pbrFill;
void * pbrLine;
void * unk3_e1a28d88;
HGDIOBJ hpath; // HPATH
unsigned flPath; // PathFlags
LINEATTRS lapath; // 0x20 bytes
void * prgnClip;
void * prgnMeta;
COLORADJUSTMENT ca; // 0x18 bytes
unsigned flFontState;
unsigned ufi;
unsigned unk4_00000000[12];
unsigned fl;
unsigned flbrush;
MATRIX mxWorldToDevice;
MATRIX mxDeviceToWorld;
MATRIX mxWorldToPage;
FLOATOBJ efM11PtoD;
FLOATOBJ efM22PtoD;
FLOATOBJ efDxPtoD;
FLOATOBJ efDyPtoD;
FLOATOBJ efM11_TWIPS;
FLOATOBJ efM22_TWIPS;
FLOATOBJ efPr11;
FLOATOBJ efPr22;
void * pSurface;
SIZE sizl;
} DCLEVEL;
// Windows 2000, 1548(0x60C) bytes
typedef struct
{
HGDIOBJ hHmgr; // 000
void * pEntry; // 004
ULONG cExcLock; // 008
ULONG Tid; // 00c
DHPDEV dhpdev; // 0x010
unsigned dctype;
unsigned fs; // Flags
void * ppdev;
void * hsem; // 0x020
unsigned flGraphics;
unsigned flGraphics2;
void * pdcattr; // point to user mode DCATTR
DCLEVEL dcLevel; // 0x030 0x1B8(440) bytes
DC_ATTR dcAttr; // 0x1C8(456) bytes
unsigned hdcNext; // 0x3B0
unsigned hdcPrev;
RECTL erclClip;
unsigned unk4_00000000[2];
RECTL erclWindow;
RECTL erclBounds;
unsigned unk5_00000000[4];
void * prgnAPI;
void * prgnVis;
void * prgnRao;
POINT FillOrigin;
unsigned unk6_00000000[10];
void * pca1; // point to DCLEVEL.ca
unsigned unk7_00000000[20];
void * pca2;
unsigned unk8_00000000[20];
void * pca3;
unsigned unk9_00000000[20];
void * pca4;
unsigned unka_00000000[10];
HFONT hlfntCur;
unsigned unkb_00000000[2];
void * prfnt;
unsigned unkc_00000000[33];
unsigned unkd_0000ffff;
unsigned unke_ffffffff;
unsigned unkf_00000000[3];
} DCOBJ;
QuoteBut, how the heck did he figure it out,...since all the kernel-mode stuff is OFFICIALLY undocumented ???
Take a look at the source of winNT, Win2K, and WinXP research kernel. The full source code of windows are available on google. Although some structure are not "officially" documented, inside the source code there are comments from where you can help to understand what it is and, therefore, make your own documentation of it.
This is probably how he did it. He got the leaked source code of windows2000 and read it.
Btw....A DC is just an acronym for
Dude !! where´s my
Car ? :greensml: :greensml: :greensml:
(http://i57.tinypic.com/efqi9y.jpg)
ZOLTAN !!!
"Windows Graphics Programming: Win32 GDI and DirectDraw" - $174 at amazon, but for free at masmforum?
guga, what is your excuse this time? You may be fair and sign such posts with your real name!
Guga is my real nickname (gustavo is my name ;) ). But...i´m not posting the file here. Just tried to help him with the link from where he can get back at least a ebook version (including the author´s website to get the sources examples). Just a matter of google to find.
U$ 174 ??? I found it for U$ 74,67 http://www.amazon.com/Windows-Graphics-Programming-Hewlett-Packard-Professional/dp/0130869856
£ 49.65 http://www.abebooks.co.uk/Windows-Graphics-Programming-Win32-GDI-DirectDraw/12497242980/bd
The ebook version is not updated, btw.
Sorry about the links, i didn´t meant to break any forum rules, but...personally, i don´t think that even if a few guys dl an ebook (that will be read from once and a while on a couple of pages for their own routines) will avoid the printed book to be sold anyway. Specially, if you consider that the ebook is outdated. We are talking on an universe of 10 or 20 thousand printed book (and sold), against, let´s say, 30 downloads of an outdated ebook version. In general, people who dl an ebook read specific pages for specific routines they are building, whereas, people who buy an book, intends to read it completely (to teach or study at school for example)
I´ll avoid post links if it will break any forum rules, but...i really don´t think that the usage of an ebook is the same as an book you buy on a store. I mean this is 2 different kind of public. I believe that people who is used to dl is not, at all, the same public that is used to buy an book. Specially because when dl an ebook, people, in general do it for a specific purpose at that time they dl it, and then discard the ebook, deleting the file etc once he have the answer he needs...People who buy a book, have other usage.
Even knowing that it violates Copyright, i´m not entirely against this sort of dls. An ebook is not an DVD, and for example, if you copy a book and give to your friends, IMHO is the best and free way to promote the printed and original version and increase the sells.
Quote from: guga on September 22, 2014, 10:38:16 PMI´ll avoid post links if it will break any forum rules, but...i really don´t think that the usage of an ebook is the same as an book you buy on a store. I mean this is 2 different kind of public. I believe that people who is used to dl is not, at all, the same public that is used to buy an book. [...]People who buy a book, have other usage.
Even knowing that it violates Copyright, i´m not entirely against this sort of dls.
So, because it not a problem for you (no real name nor address), it is also OK for the forum owner? Who will be contacted by lawyers?
Ok, qword...I understand the concern. I won´t post any links..I didn´t thought on this subject. I was trying to help him, mainly.
I Just edited the post, removed the direct links. btw :t
GUGA/GUSTAVO,
Very impressive !!! As you can see, my memory is seriously flawed (...probably,... a benign case of Zen-mentia).
But, you located the correct information, regardless, and, posted it. Thanks.
...Weird, though,...I don't remember the price of "Windows Graphics Programming: Win32 GDI and DirectDraw" being anwhere close to $174.
It was more like $50,...it must be out of print,...
...And,...apologies to QWORD,...and for getting GUSTAVO in trouble. I've done that myself a number of times,...posted a link to what is obviously an unauthorized copy of an informative book. For example here: Re: WOW64 Question, Windows Internals, Sixth Edition, 2012 (http://masm32.com/board/index.php?topic=3490.msg36755#msg36755). I even quoted from the book.
...Much as I admire QWORD's intelligence,...I don't post my real name, either. It's not so much you guys that I worry about,...but, that anyone in the world can read our posts here, and, use that information in any way they want,...
Quote from: GUGAEven knowing that it violates Copyright, i´m not entirely against this sort of dls. An ebook is not an DVD, and for example, if you copy a book and give to your friends, IMHO is the best and free way to promote the printed and original version and increase the sells.
...I agree with GUGA here,...but, I also think QWORD's opinion is reasonable. There are an enormous number of unauthorized e-books out there. The MASM Forum is NOT promoting them,...anyone that GOOGLEs can find and download them conveniently.
From a legal standpoint,...I don't think that HUTCH will be sued over something as minor as this. He may, however,...get some unpleasant and threatening communications. That I don't want to see,...
But,...I'm the
main offender, here,...maybe, I should be subjected to some kind of punishment,...banned, or, even,...deprived of my junk,...