News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

I'm not clear on how to do full screen graphics in win32 (XP DirectX).

Started by BlueMR2, September 16, 2014, 11:27:02 PM

Previous topic - Next topic

BlueMR2

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?
My Code Site
https://github.com/BrianKnoblauch

TouEnMasm


I had some start samples (not stupid ) here:
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

Fa is a musical note to play with CL

BlueMR2

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
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.  :-)
My Code Site
https://github.com/BrianKnoblauch

TouEnMasm

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
Fa is a musical note to play with CL

dedndave

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

TouEnMasm


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).
Fa is a musical note to play with CL


BlueMR2

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

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).  :-)
My Code Site
https://github.com/BrianKnoblauch

dedndave

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

dedndave

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)

BlueMR2

 :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!
My Code Site
https://github.com/BrianKnoblauch

TouEnMasm


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.
Fa is a musical note to play with CL

BlueMR2

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!  :-)
My Code Site
https://github.com/BrianKnoblauch

dedndave

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

Zen

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 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 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, DIBSections, 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