How to make textures fill all area as it is specified? I'm getting small gaps if the texture is smaller than area example: gl_quads setup like these:
-1f, 1f, 0,
-0.98f, 1f, 0,
-0.98f, -1f, 0,
-1f, -1f, 0
I get this: https://i.sstatic.net/kWJnh.png
Red one's a texture, black is background, ignore it. Texture is imported by slick loader.
Texture itself: https://i.sstatic.net/8x7ZH.png (in case someone will think it has gaps)
Do I need to use a glTexParameter somehow on it? Added a rendering code down below:
//VertexArray initialization, vertexSize is 3, amountOfVertices is 8
private void initVertexArrays() {
borderVertex = BufferUtils.createFloatBuffer(vertexSize
* amountOfVertices);
borderVertex.put(new float[] { -1f, 1f, 0, -0.98f, 1f, 0, -0.98f, -1f,
0, -1f, -1f, 0 });
borderVertex.flip();
borderTextureVertex = BufferUtils.createFloatBuffer(vertexSize
* amountOfVertices);
borderTextureVertex.put(new float[] { -1f, 1f, 0, -0.98f, 1f, 0,
-0.98f, -1f, 0, -1f, -1f, 0 });
borderTextureVertex.flip();
amountOfArrays = 2;
}
//VertexBufferObject initialization
private void initVBO() {
borderVertexHandle = glGenBuffers();
glBindBuffer(GL_ARRAY_BUFFER, borderVertexHandle);
glBufferData(GL_ARRAY_BUFFER, borderVertex, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
borderTextureHandle = glGenBuffers();
glBindBuffer(GL_ARRAY_BUFFER, borderTextureHandle);
glBufferData(GL_ARRAY_BUFFER, borderTextureVertex, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
//Texture loading with slick
private void setupTextures(){
borderTexture = TextureDecoder.getTextureAt(borderTextureLocation,
"PNG");
}
//Rendering part
public void draw() {
borderTexture.bind();
glBindBuffer(GL_ARRAY_BUFFER, borderVertexHandle);
glVertexPointer(vertexSize, GL_FLOAT, 0, 0L);
glBindBuffer(GL_ARRAY_BUFFER, borderTextureHandle);
glTexCoordPointer(vertexSize, GL_FLOAT, 0, 0);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glDrawArrays(GL_QUADS, 0, amountOfVertices * amountOfArrays);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
}