gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > Polygon examples

#19001 - iainprice - Fri Apr 09, 2004 8:03 pm

Hi, I am trying to get a nice polygon example - with source code - the best one I have found is the cube demo on your sources page, but I am having trouble getting it to work. It compiles correctly with not errors but does not boot on GBA or emulator. Are there any more nice simple polygon sources out there?

#19004 - iainprice - Fri Apr 09, 2004 9:11 pm

sorry you guys, my library was messed up. Got the cube demo working, but any other nice polygon examples would be useful... Cheers.

#19007 - dagamer34 - Fri Apr 09, 2004 10:17 pm

Exactly which example were you looking at?
_________________
Little kids and Playstation 2's don't mix. :(

#19012 - iainprice - Sat Apr 10, 2004 12:32 am

Cube demo by Pete and SM3d v0.9

#19021 - batblaster - Sat Apr 10, 2004 12:03 pm

There is a good CubeDemo on Vham package...

If you do not need a filled cube and only a wireframe i can help you...
_________________
Batblaster / 7 Raven Studios Co. Ltd
------------------------------------------

#19035 - dagamer34 - Sat Apr 10, 2004 2:35 pm

What would be the magic Google keywords for this topic anyway?
_________________
Little kids and Playstation 2's don't mix. :(

#19039 - Lupin - Sat Apr 10, 2004 3:21 pm

Look here:
http://freespace.virgin.net/hugo.elias/

The magic keyword is "Scan converting"
_________________
Team Pokeme
My blog and PM ASM tutorials

#19044 - dagamer34 - Sat Apr 10, 2004 5:59 pm

That helped a little bit, but I am still in the dark on how to scan convert a polygon.

What screws me up is that after you have the edges, what do you do with them?
_________________
Little kids and Playstation 2's don't mix. :(

#19074 - Miked0801 - Sat Apr 10, 2004 10:37 pm

Draw a horizontal line between them quickly. Same color for flat shade, gradient for Gourand shade, as a texture in U/V coords for textured.

#19107 - Lupin - Sun Apr 11, 2004 1:33 pm

http://www.gbadev.org/archive.php?time=200307

check for the news labeled "Another code sample", i once sent in the code (i wrote it at the very beginning of my gba coding experience), but the code didn't find its way into the code-section... maybe it helps since it is written in very basic fashion.
_________________
Team Pokeme
My blog and PM ASM tutorials

#19123 - dagamer34 - Sun Apr 11, 2004 6:17 pm

Whoops, I typed the wrong thing. What I meant to say was I don't know how to get the edges. Everything else I somehow understand.

Lupin, your example looks exactly what I was looking for. Umm... you think you could comment it for me? I'm a bit lost in your code. Thank you!
_________________
Little kids and Playstation 2's don't mix. :(

#19125 - Lupin - Sun Apr 11, 2004 7:17 pm

well, i just noticed that my code is using a bresenham implementation, you may want to use a lookup table for divides instead... So, better forget about the code :)

You can get the edges just by using a line drawing algorithm, but bresenham is not that good for scanning the edges...
_________________
Team Pokeme
My blog and PM ASM tutorials