Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Opengl Soccer Ball

This thread is locked; no one can reply to it. rss feed Print
Opengl Soccer Ball
Scooter
Member #16,799
January 2018

Hi Folks:

I am back at it again. Has anyone drawn a soccer ball using opengl?
If so, can you offer some help?

Thanks

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

"truncated icosahedron concentric with the sphere"

a little 3d trig should do you nicely. Then split each pentagon into 5 triangles. Then render with or without textures.

EDIT - bump
Note, you can start with a 2D pentagon, and extrapolate that to 3D.

Scooter
Member #16,799
January 2018

Checking in!
I have the white sphere. Now trying to add the pentagons.
Having some trouble, but will keep trying.

Elias
Member #358
May 2000

Another very easy way would be to just use a premade 3D model. Of course that takes out all the fun :)

--
"Either help out or stop whining" - Evert

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

https://en.wikipedia.org/wiki/Truncated_icosahedron

The coordinates are given by the permutations of :

Cartesian coordinates for the vertices of a truncated icosahedron centered at the origin are all even permutations of:

    (0, ±1, ±3φ)
    (±1, ±(2 + φ), ±2φ)
    (±φ, ±2, ±φ3)

where φ = 1 + √5/2 is the golden mean. The circumradius is √9φ + 10 ≈ 4.956 and the edges have length 2.[1] 

EDIT
A truncated icosahedron is made of pentagons AND hexagons. Sorry, read that wrong.

EDIT2
You could do a d20 or d100, those are both regular.

Scooter
Member #16,799
January 2018

Yeah, I have seen that. My problem is there is so many numbers involved
I always lose track where I am. I have to take it in very small bites.
It will take time to do this one!

I am doing this with a list using allegro5 and opengl which takes a lot of time.
I should have used an array, but too far into it now to start over. Maybe when I
get all the coordinates I will plug them into the three arrays and see what happens.
Very confusing project. I work awhile and have to stop. Come back later and do some more. I have started over many times. I have the sphere completed. It works fine.
I tried applying a texture, but could not find one that would look right.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

When you map your sphere texture onto the sphere, it needs to be made of pentagons and hexagons like your polygonal faces.

Johan Halmén
Member #1,550
September 2001

I once created a polyhedron out of an icosahedron. Let's say each vertex of an icosahedron is on the surface of the final sphere. Divide each triangle of the icosahedron into four. You get a new vertex on each middle point of each edge, that is each pair of vertices. Push these new vertices out until they reach the radius of your sphere. Now you have a polyhedron with 80 triangles. Note that they aren't regular anymore. Now you can continue to divide each of the 80 triangles into four by following the same principle. Find middle point of each pair of vertices. Push this middle point to the radius of the sphere. You get 320 triangles, then 1280, then 5120 and so on. How many do you need? You will always have 20 equilateral triangles left. All the other triangles are a bit twisted. The most twisted ones will have angles 72°, 54° and 54°.

The advantage of the truncated icosahedron is only in the real world. It is a neat way of making a football. And it has become an icon of a football, and that's probably why it is used in computer graphics, too. But really, an icosahedron is probably a much easier geometrical struct to begin with, if you are going to divide the faces into smaller triangles anyway.

Here:
https://www.allegro.cc/forums/thread/517005

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Years of thorough research have revealed that the red "x" that closes a window, really isn't red, but white on red background.

Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest.

Go to: