1
SFML projects / Re: The 2D Game - drawing a tilemap with a shader
« on: February 02, 2013, 10:36:43 pm »Is it supposed to work for size different than 256x? Your example breaks for me if I change all 256s to 128s.Yes it is possible. There are actually two ways to achieve that:
I am working on shader that'll support any data and tile textures and with 32x32 tiles.
- Modify the shader constants so the computations to find the tile and texture work for the particular size
- Modify the shader code to get the textures dimensions that are passed as parameters
The first is easy but not flexible, the second will auto-magically works whatever sizes you give.
I had a prototype using the second method but it made the code very ugly and complex for no particular reason since in my case I had decided to use 256x256 tilemaps and sizes that are 32x32 tiles.
I'll make a thread if I succeed.I guess that's fine, perhaps just add a link to my website? Like for example:
Is it enough for your copyright if I paste a comment like that in my class code and publish my class and shaders?//The code on which this class implementation and shader code is based are subject to following copyright notice:
//
// Copyright (c) 2012 by Mickaël Pointier.
// This work is made available under the terms of the Creative Commons Attribution-ShareAlike 3.0 Unported license,
// http://creativecommons.org/licenses/by-sa/3.0/.
//
//Which is not included in shader source literals below to save space in final executable -FRex
// Copyright (c) 2012 by Mickaël Pointier. (http://www.the2dgame.com)
Have fun!
(I tried your executable, it works fine here)