graphics

This is a discussion on graphics within the Windows Programming forums, part of the Platform Specific Boards category; Is there a way to directly access the monitor's output? I mean, to draw to the screen, you always have ...

  1. #1
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,690

    graphics

    Is there a way to directly access the monitor's output?
    I mean, to draw to the screen, you always have to use GDI, OGL, D3D, or somthing else, isn't there some way to forget about all that stuff? How does windows draw?
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,823
    > How does windows draw?
    By providing many hundreds of hardware specific libraries for accessing any imaginable graphics card that can run with a windows compatible PC. All those libraries present the same interface to the layers above, so you get a nice set of interfaces which allow your code to run easily pretty much anywhere (if you use OpenGL).
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Banned
    Join Date
    Nov 2007
    Posts
    678
    Yarin, you can also use crayons that can draw properly on a glass surface!

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Yarin View Post
    Is there a way to directly access the monitor's output?
    I mean, to draw to the screen, you always have to use GDI, OGL, D3D, or somthing else, isn't there some way to forget about all that stuff? How does windows draw?
    Sure, although you probably won't be able to use it very effectively, as the framebuffer that the graphics card gives you is not normally mapped into the memory space of the user-mode application, so you can't actually get to it. But assuming you write a suitable driver to map it into user space you could just write the relevant data into the right position of the framebuffer. Of course, the relevant position depends on the hardware provided - most modern graphics cards do not store pixels in the obvious order of 8 bits of Red, 8 bits Green, 8 bits Blue and 8 bits of Alpha, but rather stores some number of red data items, then the green, the blue and alpha data in their own separate "tiles".

    So you don't only need to know where the pixels are stored, but also how they are organized.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,690
    Ohj, I was under the impression that all the graphics cards use a specific reserved memory space, regardless of what kind it is.
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,823
    In days of old when VGA memory was just that, and the processor did all the pixel bashing then having the memory in the same place was good.

    Modern cards usually (AFAIK) sit at the same address, but there's no reason to assume so. Also, many cards have many acceleration functions which are far quicker than letting the host processor bash away at the pixels one at a time.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Turtle Graphics, how does it work?
    By freddyvorhees in forum C++ Programming
    Replies: 15
    Last Post: 08-28-2009, 10:57 AM
  2. Graphics Programming :: Approach and Books
    By kuphryn in forum Windows Programming
    Replies: 4
    Last Post: 05-11-2004, 09:33 PM
  3. egavga.bgi problem
    By sunil21 in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 09-22-2003, 06:06 PM
  4. Graphics Devices and Cprintf clash
    By etnies in forum C Programming
    Replies: 6
    Last Post: 05-09-2002, 12:14 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21