Hi, im new to OpenGL for java, now id like to make a map of tiles (square 1 sided tiles) going 48*48, i have done this using the following code.
int count = 0;
for(int i=0; i < 48*48; i++) {
count++;
gl.glVertex3f(AcrossTwo, DownTwo, -0.4f);
gl.glVertex3f(AcrossTwo, DownOne, -0.4f);
gl.glVertex3f(AcrossOne, DownOne, -0.4f);
gl.glVertex3f(AcrossOne, DownTwo, -0.4f);
AcrossOne+= 1.02f;
AcrossTwo+= 1.02f;
// After 48 tiles have been layed, it moves the position down and resets horizontal back to the start to lay another 48 under it.
if(count == 48) {
count = 0;
DownOne+= 1.02f;
DownTwo+= 1.02f;
AcrossOne = 1.0f;
AcrossTwo = 0.0f;
}
}
Now this does show the tiles i created, except im completely lost in how i go about accessing them, lets say i click a tile on my screen, id like to be able to change that tile's color. I know this isnt structured properly (Normally id create a Tile class, holding all it's properties) except i don't actually know how to access each vertex3f by a mouse click?
Thanks for whoever helps
