I am tampering with OpenGL and JOGL for the first time. I feel like I understand some of it, after some decent tutorials and such, but there is so much I do not understand.

Currently I am trying to to texture a 3D quad. (cube). Now I've looked through different examples, including those over at Nehe. There are some differences to my code that might or might not be the reason my "cube" looks nothing like a cube at all. (More like a 2D quad, and if I rotate it over x or y axiz, it looks totally garbled).

I am using the TexRectEnabled and mipmap boolean to true because of the weird behaviour I get when loading textures not POW2. (White quad or nothing at all).

All the examples I see, render in the scope of -1 -> 1, 0r 0 -> 1 for 2D. I don't know why, but while it seems 1.0f works as the value 100% in these examples, it works more like 1 pixel in my code.

In addition, after alot of try/fail, I found out that the texture when bound, was not where I expected it to be. TextureIO returns a texture that is obvioiusly different in some way, from the textures used infor instance the Nehe tutorials.

And rendering of this 2D cube works well. (iw is ImageWidth of texture, and ih is ImageHeight). When I get to 3D though, I am lost I see some differences from my code to the others, in the way that MatrixMode is set, and where it is set to what. And I admit, I dont know what the MatrixMode does

I am tampering with OpenGL and JOGL for the first time. I feel like I understand some of it, after some decent tutorials and such, but there is so much I do not understand.

Currently I am trying to to texture a 3D quad. (cube). Now I've looked through different examples, including those over at Nehe. There are some differences to my code that might or might not be the reason my "cube" looks nothing like a cube at all. (More like a 2D quad, and if I rotate it over x or y axiz, it looks totally garbled).

I am using the TexRectEnabled and mipmap boolean to true because of the weird behaviour I get when loading textures not POW2. (White quad or nothing at all).

All the examples I see, render in the scope of -1 -> 1, 0r 0 -> 1 for 2D. I don't know why, but while it seems 1.0f works as the value 100% in these examples, it works more like 1 pixel in my code.

In addition, after alot of try/fail, I found out that the texture when bound, was not where I expected it to be. TextureIO returns a texture that is obvioiusly different in some way, from the textures used infor instance the Nehe tutorials.

And rendering of this 2D cube works well. (iw is ImageWidth of texture, and ih is ImageHeight). When I get to 3D though, I am lost I see some differences from my code to the others, in the way that MatrixMode is set, and where it is set to what. And I admit, I dont know what the MatrixMode does

glMatrixMode allow you to choose which matrix you wish to manipulate. Each matrix has a specific role. There are a matrix for the model view, an other matrix for the projection, an other matrix for the textures...

I am using the TexRectEnabled and mipmap boolean to true because of the weird behaviour I get when loading textures not POW2. (White quad or nothing at all).

All the examples I see, render in the scope of -1 -> 1, 0r 0 -> 1 for 2D. I don't know why, but while it seems 1.0f works as the value 100% in these examples, it works more like 1 pixel in my code.

For standard textures the coordinates do range from 0.0 to 1.0, but for texture rectangles they are integer values from 0 to texture size in that dimension. So yes 1 is literally one pixel/texel, and 2 would literally be two, and so on. Fortunately NPOTs (non-power of two textures) are being more and more ubiquitous and with both OpenGL 2.0 and beyond, and DX10 requiring support it shouldn't take too long.

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