3d graphics without API

This is a discussion on 3d graphics without API within the Game Programming forums, part of the General Programming Boards category; Hallo, Is it possible to create 3d graphics without using directX, openGL or any other 3d api? Or, I know ...

  1. #1
    Registered User
    Join Date
    Oct 2006
    Location
    UK/Norway
    Posts
    485

    3d graphics without API

    Hallo,

    Is it possible to create 3d graphics without using directX, openGL or any other 3d api?
    Or, I know it is possible. But then I first have to create my own rasterizor, which I dont really want to do.

    If anyone can remember, I posted a screen shot of a small game I am working on. Its a top down shooter. I would like to add a few 3d elements to it. What I need is to be able to create 3d cubes and pyramides and apply a texture to them. I would like shadows as well, but that is by no means necessary.

    So, is it possible to create 3d cubes and pyramids with textures without having to use a rastorizor or rayTracer? I know how to create the objects in wireframe (using matrices to transform, apply a perspective matrix and use a line drawing algorithm to draw between the points), but im not sure on how to "fill" them.

    Any ideas, thoughts or links would be appreciated.
    Regards,

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    23,021
    There's a reason we use 3D APIs nowadays. Because the abstract the need for low level stuff.
    And doing it all in software is not recommended. You will eat up the CPU and get measly framerates and it will probably lag. There's a reason it's done in hardware.

    But sure, it's possible.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Registered User
    Join Date
    Oct 2006
    Location
    UK/Norway
    Posts
    485
    There's a reason we use 3D APIs nowadays. Because the abstract the need for low level stuff.
    And doing it all in software is not recommended. You will eat up the CPU and get measly framerates and it will probably lag. There's a reason it's done in hardware.
    Yes, I know that, but I still want to give it a try.

  4. #4
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    23,021
    Sure, nothing is stopping you. Good luck
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,702
    Learning the discrete math behind 3D projections onto a 2D plane will actually help you become more proficient in using existing API's like OpenGl and DirectX.

    Most of the math certainly isn't intermediate. It helps if you've already had all your algebra courses, or some physics course that require vector calculations.

    Thinking back, I think my understanding of things came mostly from school - algebra, physics, calculus, discrete math. That knowledge was then put into perspective by reading OpenGl and "build your own ray-tracer" books.

    >> But then I first have to create my own rasterizor, which I dont really want to do.
    Well, simple 3D projections onto a 2D plane (the screen) isn't *too* bad. That would probably be the first thing to play with.

    A good book would probably be better than all the tid-bits laying around on the web. I found this short tutorial with visualizations though: http://www.comp.brad.ac.uk/research/.../project1.html

    gg

  6. #6
    Registered User
    Join Date
    Oct 2006
    Location
    UK/Norway
    Posts
    485
    Thanks for your reply.

    Most of the math certainly isn't intermediate. It helps if you've already had all your algebra courses, or some physics course that require vector calculations.
    I did a "introducation to 3d math course last year. So I have covered vectors and matrices quite a lot.

    Well, simple 3D projections onto a 2D plane (the screen) isn't *too* bad. That would probably be the first thing to play with.

    A good book would probably be better than all the tid-bits laying around on the web. I found this short tutorial with visualizations though: http://www.comp.brad.ac.uk/research/.../project1.html
    Thats the part I know how to do. I know how to project the different vertecis of my object on to the screen. But im not sure how to make them solid. It has to be a better way then just having an insane amount of vertecis in my object and then project then all?

    What I am looking for is a "Fill between the vertexes to make a polygon algorithm" if that makes any sense.

    I have a book at covers the basic of it (Game programming gurus I think it was called), but I never read through the 3d parts of it, just the 2d. And clever me left if in England, and im not going back before the summer is over. But if you have any good book recommendations Im open for it .

  7. #7
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    Polygon fill algorithm is what you are looking for.

    Here is a simple algorithm.

    1. Start at the top and work down.
    2. If the next vertex is to the right of the top, save it in the right buffer.
    3. If the next vertex is to the left of the top, save it in the left buffer.
    4. When done scan convert on the edges created by the left and right buffers.
    5. Draw lines from left to right.

    This will create solid filled polies. For simple texturing you can do linear interpolation between the u,v's of the left and right but this requires an interpolation as you scan convert and as you draw lines from left to right - hence bilinear interpolation.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Beginning Game Programming Type Books
    By bumfluff in forum Game Programming
    Replies: 36
    Last Post: 09-13-2006, 05:15 PM
  2. Vector Operations in 3D Graphics
    By The Dog in forum Game Programming
    Replies: 27
    Last Post: 09-13-2005, 06:11 PM
  3. Flickery API graphics
    By Magos in forum Windows Programming
    Replies: 7
    Last Post: 10-23-2002, 07:49 AM
  4. 3D Modelling + Graphics Cards
    By MethodMan in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 10-17-2002, 11:29 PM

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