Text Coordinates Problem for generated .obj model


I’m having trouble applying materials to my .obj Model. I load it as a Node, with several child Geometries.

Supose I have a Geometry geom which correspond to a child Geometry of my model.

I use this code to apply a texture repeatedly to the geom:


Texture tex = application.getAssetManager().loadTexture(“Textures/Terrain/BrickWall/BrickWall.jpg”);


Material mat = new Material(application.getAssetManager(), “Common/MatDefs/Misc/Unshaded.j3md”);

mat.setTexture(“ColorMap”, tex);

setTextureScale(geom, new Vector2f(2,2));


private void setTextureScale(Spatial spatial, Vector2f vector) {

if (spatial instanceof Node) {

Node findingnode = (Node) spatial;

for (int i = 0; i < findingnode.getQuantity(); i++) {

Spatial child = findingnode.getChild(i);

setTextureScale(child, vector);


} else if (spatial instanceof Geometry) {

((Geometry) spatial).getMesh().scaleTextureCoordinates(vector);




And when run this, I get this Warning:

[java]WARNING: Root Cause: java.lang.IllegalStateException: The mesh has no texture coordinates[/java]

And the base color of the material is applied to the Geometry but not the texture.

My question is: Can I generate this texture coordinates in runtime and, if not, How can I do it in 3DStudioMax ou Blender (I know this escapes the scope of this forum, but I just need some guidance to find the right path).


The thing you have to look for is “UV Mapping” your model. Thats what creates a set of coordinates for every vertex that give the x/y coords of the texture at that vertex. Thats how basically all game / opengl texturing works, so you should invest some time into learning how to do that in your editor of choice. Theres a tutorial just to the right in “Drag & Drop Help” on how to export a UV mapped model with blender 2.49 but theres also lots of tutorials on UV mapping with any software to be found using :google:

Thanks for the fast response!

I’m going to look into it.