Currently I'm setting up the basic level rendering.But a strange error occurred: the tile image bottom line shows at the top of the tile (source image size: 64x64).the y-coords (i think): 64, 1, 2, 3, ...I also searched on google, but the solution does not work, 'cause my images ARE pot-sizes.

It is doing it every time drawing a tile.I have an array of integers which represents the index of an array of images.e.g.:int index = tilemap[xCoord][yCoord];images[index].draw();I also tried that code with Slick2D, same error.

The texture reader should not be the problem, 'cause the error occurred as well as I used Slick2D.But thank deepthought for the hint. Well, actually it was the draw method.I was drawing the image with floating coord values but as it seems there is no problem if i use integer values.

The problem seemed to be solved, but it isn't. When I scale the tiles with glScalef(...) it does not render correct.The background image is scaled over the whole window and the lowest row of pixels is also at the top too.Is it a problem to scale images?Cause I get the same problem with slick2d.

I didn't see anything that I believe could cause your error, although you haven't in fact posted how you generate texture coordinates. I do have a couple of things however. Firstly I believe there is a bug in your initialization of glcolorModel:

I don't understand how you are "scaling it down." The sizes you put into the glTexImage2D have to be 64 and 64, the texture coords you're using is 1 and 1 so are you using a texture matrix or what? None of the code you have posted could scale a 64x64 image to a 40x40 image.

The size of the square you're drawing has nothing to do with the area of the texture used. The texture is stretched or shrunk to fit the vertex coordinates. It is the texture coordinates which specify what area of the texture to draw.

I want to draw 100% of my texture (the whole texture).The only thing is that the texture has an destination size of 40x40 (but 100% of the textures area in the destination squad, just scaled).do the texture coords also has to be scaled down?as said before:

The next power of two up from 40 is 64. So the size of the texture is 64x64 but you only want the 40 x 40 square int the top left hand corner. (It's the top since OpenGL stores textures from the top downward) Hence your texture coordinates should be:

1 2 3 4 5 6

{0, 1 - (40f/64),1, 1 - (40f/64),1, 1,0, 1}

I realize now that I got this wrong before. Sorry. I always make sure the textures I load are pot anyway so it's not something I'm used to. Your vertex coords can be whatever you want, they have no effect on what area of the texture is drawn, only where it is drawn on the screen.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org