opengl - Why is my Texture Quad positioned incorrectly with glTexCoord2f using LWJGL? -


I am going to create an adventure game with grass, trees and other things in 2D if I can do this. My problem is that when I use glTexCoord2f to clamp texture in the quad, they split up to 25 pixels from each other.

I am loading them with sluetooth and the texture size is 100x100

Here is my source code for translation of quads and InitGL

  Submitting public static void () {Example-; GL11.glLoadIdentity (); Color.white.bind (); System.Game.ground.bind (); GL11.glTranslatef (e.g., 0, 0); // I used to loop for cloning quadening (int x = 0; x & lt; = width; x ++) {GL11.glBegin (GL11.GL_QUADS); GL11.glTexCoord2f (0, 0); GL11.glVertex2f (x * 100, 0); GL11.glTexCoord2f (1, 0); GL11.glVertex2f (x * 100 + 100, 0); GL11.glTexCoord2f (1, 1); GL11.glVertex2f (x * 100 + 100, 100); GL11.glTexCoord2f (0, 1); GL11.glVertex2f (x * 100, 100); GL11.glEnd (); } GL11.glLoadIdentity (); }   

This is my InitGL code.

  GL11.glEnable (GL11.GL_TEXTURE_2D); GL11.glClearColor (0.0f, 0.0f, 0.0f, 0.0f); GL11.glEnable (GL11.GL_BLEND); GL11.glBlendFunc (GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glViewport (0,0, width, height); GL11.glMatrixMode (GL11.GL_MODELVIEW); GL11.glMatrixMode (GL11.GL_PROJECTION); GL11.glLoadIdentity (); GL11.glOrtho (0, width, height, 0, 1, -1); GL11.glMatrixMode (GL11.GL_MODELVIEW); SlickUtil only reads texture with dimensions with two types of powers. The reason for this is that, since OpenGL 2.0, OpenGL has the power of non-power - two.    



Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -