Question

I'm new to GL and wanted to create a tiled map as a self tuorial. I want to create a small (maybe 7 hexes wide / tall) hex map. My first thought was to just create a method to draw one hex and then just translate the appropriate offset and place the new hex. But this doesn't seem effcient. Any Idea's? Alos as a side question, how do I determine if a MotionEvent is with in the are of a given hex?

Was it helpful?

OTHER TIPS

To determine if a MotionEvent is within a certain hex you have to convert the coords passed in via the motion event to your OpenGL World coords. Its just like a unit conversion, you know the screen goes from 0 - WIDTH and your GL world lets say goes from -1 to 1.

(xCoord / (Width - 0)) * (1 - (-1)) = xCoordWorld

will give you the xCoord from 0 to 2, then subtract 1 to get it in -1 to 1.

As far as the hexes go I've always used 'art' hexes. Draw the hex out in paint then render a bunch of squares with that piece of art on them, fast and easy to swap a hex out for another hex.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top