Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to draw a 3D cube w/o graphics library.

How to draw a 3D cube w/o graphics library.

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsgame-devtutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    relsirc
    wrote on last edited by
    #1

    I want to draw a 3D cube without using graphics libraries such as OpenGL. I`m not sure how I can draw the cube. I don`t know what I need to do to draw something 3D.

    M C 2 Replies Last reply
    0
    • R relsirc

      I want to draw a 3D cube without using graphics libraries such as OpenGL. I`m not sure how I can draw the cube. I don`t know what I need to do to draw something 3D.

      M Offline
      M Offline
      Matthew Faithfull
      wrote on last edited by
      #2

      See if you can pick yourself up a copy of the book 'Teach Yourself Computer Graphics' or something similar. This will show you how transform a 3D point x,y,z into a 2D point X,Y using a projection. The process uses matrices so you might want to be familiar with simple matrix transformations. Many texts on DirectX also explain this sort of thing but you don't have to use DirectX to take advantage of them if you're prepared to hand code the data structures yourself. Otherwise you might want to try old school drawing in VB6, you can draw directly onto a form pretty easily. I used this to port a simple 3D scene generator from QuickBasic to Windows quite a few years ago. Provided you can handle the mathematics 3D vector drawing is not really so difficult. When it comes to more complex stuff like lighting and shading you're going to need a good book you can follow as the algorithms can be tricky.

      Nothing is exactly what it seems but everything with seems can be unpicked.

      1 Reply Last reply
      0
      • R relsirc

        I want to draw a 3D cube without using graphics libraries such as OpenGL. I`m not sure how I can draw the cube. I don`t know what I need to do to draw something 3D.

        C Offline
        C Offline
        CPallini
        wrote on last edited by
        #3

        You have to map cube 3D coords into screen 2D ones, you may choose, for instance, perspective transformation or (the simpler) isometric one. :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups