A little help on 3D animation!!

This is a discussion on A little help on 3D animation!! within the Windows Programming forums, part of the Platform Specific Boards category; Lately i've been reading many online tutorials on 3D computer science. I'm trying to understand how a 3D system works ...

  1. #1
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    1,625

    A little help on 3D animation!!

    Lately i've been reading many online tutorials on 3D computer science. I'm trying to understand how a 3D system works and how can i generate one without the use of a library like openGL or DirectX. So i've got a few questions to ask:

    1) How can i stop bitmaps from flashing, a.k.a who can i manipulate the device buffer or the window update rate?

    2)Is there another method beside BitBlt?

    3)Related to the above, when using vectors with double values, after calculating the right screen position, how can i insert it in BitBlt, which accepts only integers?

    These are my questions. Feel free to post your opinion and/or suggestion on this.
    Thanks in advance!!!

  2. #2
    Registered User valaris's Avatar
    Join Date
    Jun 2008
    Location
    RING 0
    Posts
    507
    1) Usually this is done with double buffering. If you want to access the attributes you described you can use the api provided with your grraphics card, or write your own. Most people like to write in a way that will be usable on a multitude of hardware though, hence GDI, DirectX, etc...

    2) BitBlt usually just copies memory from one location to another, so technically ya I suppose.

    3) Cast it

    I wouldn't write your own 3d system until you are extemely familiar with how 3D works in general, and how other systems do it (X & GL...).

  3. #3
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    1,625
    Ok, but, could you be more specific?

  4. #4
    Registered User
    Join Date
    Oct 2008
    Posts
    34
    A quick explanation of what happens between GDI/DirectX/OpenGL/etc. and your graphics hardware:

    At the lowest level you have the graphics hardware, which is basically a GPU capable of performing lots of operations. You execute these operations by writing operation codes into the registers of the GPU, much in the same way as your CPU. This is what the device driver takes care of for you. To write such a driver you would need the documentation for the graphics hardware you are using (explaining what the different registers do and how to use them properly). The device driver provides an interface to a graphics subsystem such as GDI, to further abstract it from the hardware and GDI provide you with an interface for drawing stuff on the screen (or any other output device).

    1) If you don't know what double buffering is, you can read up on it here. Basically you are alternating between two buffers, reading from one (drawing to the screen), while you write to the other.

    2) Blitting is essentialy performing a so-called raster operation (ROP) which is basically - as valaris is saying - copying memory from one location to another. This raster operation involves combining the source and destination memory locations using a boolean formula (consisting of OR, AND, NOT and XOR operations). You could of course reinvent the wheel by implementing this yourself (by interfacing directly with the device driver), but you would loose abstraction, which is the purpose of GDI (GDI also implementing the same interface for not only monitors but also other output devices, such as printers), OpenGL, DirectX and other graphics libraries.

    3) As valaris says, just cast the floats to an integer:
    Code:
    float flt = 10.12;
    int i = (int)flt;
    GDI was not designed for doing 3D graphics. It was designed for simplifying output to any output device, hence it has for instance no synchronization with the framebuffer or rasterization (converting vector grapics to raster graphics) capabilities.

    I would advice you to not write your own graphics layer, and in stead use an existing one, OpenGL is a great start. Buy yourself a book and start coding. It takes years of experience and tremendous effort way beyond the capacity of one person to implement such functionality as OpenGL and DirectX provides.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Animation class not working
    By VirtualAce in forum Game Programming
    Replies: 5
    Last Post: 03-02-2005, 05:48 AM
  2. 3D animation (difficult?)
    By maes in forum Game Programming
    Replies: 3
    Last Post: 09-08-2003, 10:44 PM
  3. 3D starfield
    By VirtualAce in forum Game Programming
    Replies: 6
    Last Post: 06-26-2003, 12:40 PM
  4. 3D SDK for C++ programmers
    By chand in forum Game Programming
    Replies: 2
    Last Post: 05-20-2003, 07:38 AM
  5. 3d engines
    By Unregistered in forum Game Programming
    Replies: 7
    Last Post: 12-17-2001, 10:19 AM

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