While back I made a simple demo featuring grids with hexagon tiles. I've added a download containing the demo and source for whom is interested, I've heard many people say that they could not figure out how to do hex grids, this is one solution.
Here's a video
http://www.youtube.com/watch?v=hgqclKY4yVo
Download:
http://www.fileden.com/getfile.php?file ... Source.zip
Screenshot:
Hex Map / Hex Grid demo with source
Moderator: PC Supremacists
- hurstshifter
- ES Beta Backer
- Posts: 713
- Joined: Mon Jun 08, 2009 8:33 pm
- Favorite Gaming Platforms: SNES
- Programming Language of Choice: C/++
- Location: Boston, MA
- Contact:
Re: Hex Map / Hex Grid demo with source
Very cool. This makes me think of a fun board game I've played with some friends a few times called Runebound. It uses a hex based grid for the gameboard and now that I think about it, might actually translate very well to a computer game with a nice grid like this one.
"Time is an illusion. Lunchtime, doubly so."
http://www.thenerdnight.com
http://www.thenerdnight.com
Re: Hex Map / Hex Grid demo with source
That's pretty cool. I'll download it later. :)
I'm an altogether bad-natured Cupid.
- Bakkon
- Chaos Rift Junior
- Posts: 384
- Joined: Wed May 20, 2009 2:38 pm
- Programming Language of Choice: C++
- Location: Indiana
Re: Hex Map / Hex Grid demo with source
While I wasn't necessarily looking for a Hex Map, I'm looking to start learning OpenGL soon and this looks extremely well documented. Really like the comment style for each function. Thanks!
- Falco Girgis
- Elysian Shadows Team
- Posts: 10294
- Joined: Thu May 20, 2004 2:04 pm
- Current Project: Elysian Shadows
- Favorite Gaming Platforms: Dreamcast, SNES, NES
- Programming Language of Choice: C/++
- Location: Studio Vorbis, AL
- Contact:
Re: Hex Map / Hex Grid demo with source
I haven't had a chance to check it out yet, but it looks really cool. Are you rendering the hexagons as untextured triangle fans?
- Spikey
- Chaos Rift Cool Newbie
- Posts: 98
- Joined: Sat Dec 13, 2008 6:39 am
- Programming Language of Choice: C++
- Location: Ottawa, Canada
- Contact:
Re: Hex Map / Hex Grid demo with source
@GyroVorbis
Currently as untextured gl_polygons. Triangle fans would probably be faster, as well as display lists.
Lots of room left for improvement.
Currently as untextured gl_polygons. Triangle fans would probably be faster, as well as display lists.
Lots of room left for improvement.
Re: Hex Map / Hex Grid demo with source
It was my understanding that the quick draw methods from openGL such as triangle fans, quads, polygons, etc. were being depreciated and that...
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, verticies);
glDrawArrays(GL_TRIANGLES,0,numberOfVerticies); //or GLDrawElements
glDisableClientState(GL_VERTEX_ARRAY);
...was the way people are being incited to do things nowadays. (As well as putting all the vertex data onto your graphics card)
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, verticies);
glDrawArrays(GL_TRIANGLES,0,numberOfVerticies); //or GLDrawElements
glDisableClientState(GL_VERTEX_ARRAY);
...was the way people are being incited to do things nowadays. (As well as putting all the vertex data onto your graphics card)