0

I've tried to find some code, but found only obsolete. I've made only verts & indices arrays (hope they are correct):

const SDL_Point blocksCount = { 4, 16 }; //I have texture with 4x16 squares 8x8 px.
f32 *verts = new f32[(blocksCount.x + 1) * (blocksCount.y + 1) * 2];
for (f32 y = 1; y >= -1; y -= 0.125f) //So I can automatize.
    for (f32 x = -1; x <= 1; x += 0.5f)
    {
        static u32 i = 0;
        verts[i] = x;
        i++;
        verts[i] = y;
        i++;
    }
u16 *indices = new u16[blocksCount.x * blocksCount.y * 4];
for (s32 y = 0; y < blocksCount.y; y++) //I've used TRIANGLE_STRIP.
    for (s32 x = 0; x < blocksCount.x; x++)
    {
        static u32 i = 0;
        indices[i] = x + y * (blocksCount.x + 1);
        indices[i + 1] = x + 1 + blocksCount.x + y * (blocksCount.x + 1);
        indices[i + 2] = x + 1 + y * (blocksCount.x + 1);
        indices[i + 3] = x + 2 + blocksCount.x + y * (blocksCount.x + 1);
        i += 4;
    }

So what's next? I need some code for SDL 2 & OpenGL 4+. Also new ideas are acceptable.

genpfault
  • 51,148
  • 11
  • 85
  • 139
Necronomicron
  • 1,150
  • 4
  • 24
  • 47
  • It is not really clear what you are asking here. There are many tutorials which show you how to do texturing with modern GL and shaders. – derhass Oct 26 '13 at 16:33
  • OK, so show me at least 1. – Necronomicron Nov 04 '13 at 14:32
  • For texturing in general have a look at [this](http://open.gl/textures) ot [this](http://arcsynthesis.org/gltut/Texturing/Tutorial%2014.html) tutorial. – derhass Nov 04 '13 at 20:33

0 Answers0