I have troubles with using Textures in OpenGl (only 2D)
I want to show a Level (size 15x15) and every Field can have a different value/Picture.
I have about 100 different Fieldtypes and according to the leveldesign, I have to display a different image for every type.
If I use an single tga-Image for every possible Field (100 files), everything works fine,
but now I put all Images together in one File and, depending on the field-type, I'm always displaying a different part from the image.
The Problem: sometimes thin Lines in the images aren't displayed and between the different sprites, there are often black or gray lines which makes the whole graphics ugly.
Is there a way to solve this problem easily?
(Maybe I have to load the tga-image into one GLuint and then split it up into 100 different GLunint's? Or is there an setting to improve the rendering? Or do I have to change the resolution of the tga-image file itself?)
Here's a part of my image-File, every element has a resolution of 220x220 pixels --> whole pic.: 2200x2200 pixels
And that's the OpenGl-output:
I really don't want to have hundrets of image-files. Especially because loading all these Files consumes a lot of time and I'm sure there's a solution out there
EDIT:
I'm using the following settings:
// Specify filtering and edge actions
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP);
EDIT2:
Now I changed GL_LINEAR to GL_NEAREST and added a half texel in the texture-coordinates there are no lines between the images anymore :)
But I still have the other problem:
Small elements (lines) in the image aren't displayed correctly.
This is how it should look like: