PDA

View Full Version : Rectangular texture gets repeated



symla_
07-12-2014, 03:37 PM
I can use texture of size 32x32, 512x512 without any problems. If I try to display sizes 64x16, 8x4 and so one the textures get "repeated".

The png file:

https://www.dropbox.com/s/nbizfw2fuysler4/RecTex-Original.png

The processed result:

https://www.dropbox.com/s/aj7b2zv9w0a23sd/RecTex-OpenGL.png

I just don't know what's going on. It seems to get repeated vertically!??

Here's the code I use to enable and bind the texture:



gl.glColor3d(1D, 1D, 1D);
gl.glEnable(GL2.GL_TEXTURE_2D);
gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, this.minInterpolation);
gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, this.magInterpolation);
gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_S, GL2.GL_CLAMP_TO_EDGE);
gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_WRAP_T, GL2.GL_CLAMP_TO_EDGE);
if ( this.alpha ) {
gl.glEnable(GL2.GL_BLEND);
gl.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA);
}
gl.glBindTexture(GL2.GL_TEXTURE_2D, this.textureID);


I appreciate any tips!

Nikki_k
07-12-2014, 04:27 PM
Try binding the texture before setting the clamping mode and the texture filter setting.

symla_
07-13-2014, 03:46 AM
Thanks for the tip but it does not result in any visible change.

Throuch some research which parameters, targets etc. exist I've found the target "GL_TEXTURE_RECTANGLE_ARB".

I've tried binding the texture with this target before uploading and before drawing ... et voila ... it works!