Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Cube Draw  (Read 4223 times)

0 Members and 1 Guest are viewing this topic.

Theroth

  • Newbie
  • *
  • Posts: 1
    • View Profile
Cube Draw
« on: October 10, 2016, 02:14:19 pm »
Hello for first Im from Germany so excuse my bad english. I write here, because in the german forum are not so many people that can ask m.

So my teacher says I should build a cube to rotate it.

So I draw a cube on a paper and put vectors from the middle to the vertices. So now I can calculate the edges and set the points. I think I can set any point for beginning lets say 100,100 and set there a point with sf::VertexArray. Now I want to go with the vector edge and set at the end of vector arrow the other point. With that I should be able to "build" a cube.

Is this possible?

If there are any better libaries or functions to do that?



Greetings

Theroth

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Cube Draw
« Reply #1 on: November 14, 2016, 02:06:37 pm »
Hello for first
Hi and welcome! :)

To "build" a cube, you would need to have (up to) six faces, or quads. Quads are made up of two triangles.

Using SFML, you can use a vertex array to draw quads. If you already know how to calculate the vertices' positions, the hardest part might be deciding on which order to draw the faces.

Note that texturing a quad can be harder that it might at first seem. Solid colours are much easier.

If there are any better libaries or functions to do that?
Selba Ward's Sprite 3D can help with rotating textured faces (using SFML).
To "do it properly", however, you can use OpenGL directly.

Note that one of SFML's examples is a rotating cube...
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*