Hi Cym,
your problem seems to be the translate() calls. When you use multiple translations in one draw() loop, all these translations gets added to each other.
If you change the code like you describe, (don't use a transparency in line 75 and change the order of drawBackgroundHexagons() and drawMouseHexagons()), you can witness that if you go over the hexagons a the top, the hexagons totally at the bottom light up. This could already put you on the track to realize that the drawing *does* happen, but at just the *wrong location*.
The fix would be to wrap the translate() calls in a pushMatrix(); // your translations; popMatrix(); block.
PushMatrix means that you're pushing the translations that follow on the "translation stack". And with popMatrix you pop these off the stack again. When you reach the drawMouseHexagons() code, you want to be sure the stack is empty, so you're translations are not affected by previous translations.
I hope this clear things and solves your problem. I'll attach or upload the fixed code here.
Also a nice improvement of your code would be to make a Hexagon class that knows how to draw itself and respond to mouse events (hover or click).
best
dirk
your problem seems to be the translate() calls. When you use multiple translations in one draw() loop, all these translations gets added to each other.
If you change the code like you describe, (don't use a transparency in line 75 and change the order of drawBackgroundHexagons() and drawMouseHexagons()), you can witness that if you go over the hexagons a the top, the hexagons totally at the bottom light up. This could already put you on the track to realize that the drawing *does* happen, but at just the *wrong location*.
The fix would be to wrap the translate() calls in a pushMatrix(); // your translations; popMatrix(); block.
PushMatrix means that you're pushing the translations that follow on the "translation stack". And with popMatrix you pop these off the stack again. When you reach the drawMouseHexagons() code, you want to be sure the stack is empty, so you're translations are not affected by previous translations.
I hope this clear things and solves your problem. I'll attach or upload the fixed code here.
Also a nice improvement of your code would be to make a Hexagon class that knows how to draw itself and respond to mouse events (hover or click).
best
dirk



