LWJGL is there a reason for this?

Okay well as you can see from pretty much all of my recent posts i have been working in 3D using LWJGL and Libgdx and everytime i get to the same problem and that is either optimizesation or collision not working/ buggy

So i have redone my LWJGL engine and I have been working on this for about a day now and i have came to a problem, maybe? not completely sure if it is a problem or it is me just overreacting.

Okay i am trying to make a square and the end result is a rectangle is this correct?

vertices
-1,-1,-1
-1,1,-1 <-------- Same as in the code
1,1,-1
1,-1,-1

Result

Can somebody explain how the -1 to 1 system works as when i check for collision which i have done in the past i have noticed i have had to do x+(width/2) just to get the starting point?? Am i doing this correct?

I probably has something to do with your aspect ratio, make sure that you calculate your aspect ratio using floats not ints

Thanks dude i knew something wasn’t right

Can somebody explain how the -1 to 1 system works as when i check for collision which i have done in the past i have noticed i have had to do x+(width/2) just to get the starting point?? Am i doing this correct?

Normalized device coordinates in OpenGL use a system that ranges from -1 to 1 along the x and y axes, but I think you’re just asking about quad vertex coordinates, yes?

If you’re asking about quad coordinates, there’s no ‘system’ per se; it’s just that -1/1 is what you’ve chosen to use. In other words, your quad is just mesh geometry, and mesh geometry can be whatever you want it to be (practically speaking). For example, your quad could range from -.5 to .5 in each direction, or -2 to 2, or -1000 to 1000. (And of course it can be non-square or non-rectangular if you want.)

So, there’s really nothing special about -1/1 except that it’s fairly intuitive and easy to work with. (-.5/.5 is also handy, as it gives your quad an exact size of 1 in each direction.)

As for the ‘x+(width/2)’ part, although it’s not ‘wrong’, technically, I think it’s conceptually suboptimal to the point that you might as well consider it to be wrong. In most types of simulations (such as games) it makes the most sense for objects to be anchored in the center or in some central location (like between the feet for a humanoid character). Anchoring at the corner will probably be a poor choice in most cases. I think any time you find yourself doing things like ‘x+(width/2)’ it’s a sign that you really want your object to be anchored at the center. Not knowing the context I can’t tell you exactly what you need to do to address this, but I’ll go ahead and say that if you have a lot of expressions like ‘x+(width/2)’ scattered throughout your code, then you probably want to be doing things differently.

Edit: I should also mention that the quad you posted the coordinates for is actually anchored in the center (aside from being offset in the z direction), so if you’re still having to compensate by adding half the dimensions, it must be for some other reason, such as your collision representation being set up differently than your visual representation.