Newbie Stuck With Textures HELP!

This is my first post so I’d just like to start off by saying hello to one and all on this forum ;D

My introduction: I’m 22 in my final year at university studying Computer Science and am working on a 3D game/environment.

I’ve chosen Java3D and am still learning the ropes with the tool. My main problem right now is with textures.

I’ve started by creating geometry for a flat floor made up with 100 squares, so it’s a 10x10 grid. I’ve done this using the QuadArray structure. I have specified texture coordinates and have loaded in a texture. The problem is it displays nothing - the world is just black.

But when I simply change the QuadArray structure for a LineArray structure the lines are displayed and the texture is applied to the lines. I know for a fact the geometry created in the loop is correct. The texture must be loading correctly since it is applied to the lines fine right?

So I thought the problem was with the texture coordinates which I was initially putting into an array as the floor geometry was being created in a loop, and then applying the texture coordinates at the end using setTextureCoordinates. As can be seen from my source, I commented this out and tried a more basic approach, and still no result.

So why won’t it work with QuadArray? I know this might seem like a very basic and stupid question but I’m still learning and have no idea where to go from here!

Thanks muchly for any help :slight_smile:

Sounds like backfaceculling to me…

Try to add the coordinates in the reverse order

(changing +0, +1, +2, +3,
to +3, +2, +1, +0)

Indeed backface culling was the problem, thank you very much my friend :wink:

I did some research and rather than reverse the order of the coordinates I simply disabled backface culling for the time being with these first 2 lines:

PolygonAttributes polyAppear = new PolygonAttributes();
polyAppear.setCullFace(PolygonAttributes.CULL_NONE);
Appearance floorAppearance = new Appearance();
floorAppearance.setPolygonAttributes(polyAppear);
floorAppearance.setTexture(floorTexture);

I wouldn’t have been able to figure it out without your help so thanks again. No doubt I’ll be here to bug you again very soon when my next problem crops up ;D