If possible could you please take a look at this image/tileset and see if its possible to draw a 2x2 tile map with each of the frames in that image correctly mapped onto the quads in the tile map.

The idea is to go on and use this as a spritesheet or/and tileset, to basically cut out ANY PORTION (or frame) of a single texture.

The image : http://img441.imageshack.us/i/tileset512.jpg/

This is all in 2D, the formula i use gets me the frames in the wrong order (draws from BL to TL, then BR to TR) so if anyone can help i'd appreciate it and note i'm NOT ane expert with opengl lol.

So my 2x2 tile map should look EXACTLY as that image!

Also! If by some magical way the texture coordinate system can be modified to start with 0,0 at the top left then i'd be fine as i only get the correct coordinates from the texture starting at 0,0 where thats the bottom (BL) when i want (TL).

Thank You

Yes its possible to cut that picture into correct portion and paste it onto
a 2d tile.

You need to first create a nxn tile set. Then, you need to generate the
correct texture coordinate for each tile.

You could calculate the texture coordinate by having 4 variables,
float bottomLeft, bottomRight, topRight, topLeft;

You need to use a nested for loop.

for(int i = 0; i < N; i++)
    bottomLeft = i/float(N);
    bottomRight = (i+1)/float(N);

    for(int j = 0; j < N; j++)
        topRoght = (j+1)/float(N); 
        topLeft = j/float(N);

        //Draw using those texture coordinates.
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.