TexUVData dissort

I got really close to rendering this texture to a quad and it’s not working right. HEre is my Vertex data:
EDIT: Sorry for the not so descriptive problem (was in a rush this morning). So I draw this texture using VBOs. This is just my vertex data I use to render it. Since I’m pretty new to LWJGL, do you know what I’m doing wrong to make the texture look this way?

 FloatBuffer vertexData = BufferUtils.createFloatBuffer(amountOfVertices * vertexSize);
        vertexData.put(new float[]{  -0.5f, 0.5f, 0,//LEFT BOTTOM
                				   	 -0.5f, -0.5f, 0,
                					  0.5f, -0.5f, 0,
                					  
                					  0.5f, -0.5f, 0,//RIGHT TOP
                				   	  0.5f, 0.5f, 0,
                					 -0.5f, 0.5f, 0,
});
        vertexData.flip();

Texture Data:

FloatBuffer textureUVData = BufferUtils.createFloatBuffer(amountOfVertices * 2); // amount of vertices * two texture coordinates per-vertex
        textureUVData.put(new float[]{0,1 , 0,0 , 1,0 , 1,1 /**/, 0,1 , 0,0 });
        textureUVData.flip();

Color Data:

FloatBuffer colorData = BufferUtils.createFloatBuffer(amountOfVertices * colorSize);
        colorData.put(new float[]{1, 1, 1, 1, 1, 1, 1, 1, 1, /**/1, 1, 1, 1, 1, 1, 1, 1, 1});
        colorData.flip();

The image drawn using this code.

http://i.minus.com/iydVAJMz77MX1.gif

As you may notice, it looks a bit odd compared to what it’s supposed to be:

http://i.minus.com/jOko05NGGwW8H.png

And… What is the problem? Where is the code? All I see is a bunch of numbers.

What I said when I learned about VBOs. Anyways, I rewrote my question since I asked it at a dumb time.

It’s because your window isn’t square. You will need to setup an orthographic projection if you want to remove that distortion.

I think my orthographic projectionn is right.
WHAT I USE:

 glMatrixMode(GL_PROJECTION);
     glLoadIdentity();
     glOrtho(1, -1, 1, -1, 1, -1);
     glMatrixMode(GL_MODELVIEW);
     glLoadIdentity();

http://pastebin.com/EHtqVVhs

Your glOrtho should be glOrtho(0, Display.getWidth(), 0, Display.getHeight(), 0.001f, 1000f); [icode]glOrtho(0, Display.getWidth(), 0, Display.getHeight(), -1, 1);[/icode]

These are the: left, right, bottom, top, near, and far planes of your projection matrix. This will set everything up where your units are pixels, and the origin is in the bottom left corner.

But my vertex data are tiny floats. I’m guessing that’s why everything just disappeared. ???

Yeah. Now you can use pixels as your units, instead of having everything being normalized.

Oh! So, now I can just make my array be something like

0, 0, 0,
10, 10, 10.....

Would I need the f suffix still since it’s a float array?

0.5f

Vertices that is :wink:

I feel kinda bad not making you do this yourself, but here’s what he means:

FloatBuffer vertexData = BufferUtils.createFloatBuffer(amountOfVertices * vertexSize);
vertexData.put(new float[]{
                       0, 200, 0,//LEFT BOTTOM
                       0, 0, 0,
                       200f, 0f, 0,
                                 
                       200f, 0f, 0,//RIGHT TOP
                       200f, 200f, 0,
                       0f, 200f, 0,
});
vertexData.flip();

If you want :-\

200 = 200f; 0.5f != 0.5d;

Nothing but a black window still.

Since when?

Whoops sorry. Those last two parameters should be -1, and 1. I was thinking of perspective projection :smiley:

Learnt something new, but that still didn’t solve my problem. The image still looks odd as the OP (Original Post(er)?). Maybe it has to do with index buffering (Something I haven’t read into much) needing to connect the triangles.

I’m sorry… I know they’re the same values, I meant they can’t be transformed together.

Your texture coordinates are mixed up, specifically the top left and bottom right vertices on the bottom triangle. Switch these two texture coordinates around.

Only reason ints can be “with” floats is because int is allowed implicit casting to float, but double requires an explicit cast to float. The reverse is implicit, though.
Yay, type systems!

I’ll stop derailing now…

Turns out, I needed to use a more reliable image. I’m nearly there though.

http://i.minus.com/i7XBSMoHdhp3I.gif

EDIT: Finally did it