TextureAtlas bug?

Guys, getAtlasTexture only gets one texture, the whole map (with all textures) with that name. Just read the javadoc. And @homsi you still didn’t meditate. Let me put this clear: You have some flaw in your thinking and its not our responsibility to find out what that is.

I have memorized the javaDoc @normen I still don’t get it :S sorry.



this is my updated code, I don’t get what am I doing wrong now…



[java]import com.jme3.app.SimpleApplication;

import com.jme3.material.MatParamTexture;

import com.jme3.material.Material;

import com.jme3.math.Vector3f;

import com.jme3.scene.Geometry;

import com.jme3.scene.shape.Box;

import com.jme3.texture.Texture;

import jme3tools.optimize.TextureAtlas;



public class TestTextureAtlas extends SimpleApplication

{

static TextureAtlas atlas = new TextureAtlas(1024, 1024);

static Material mat;

static Box box = new Box(new Vector3f(0,0,0),0.5f,0.5f,0.5f);



public static Geometry createGeom(float x,float y,float z)

{

Geometry geom = new Geometry(x+""+y+""+z, box);

geom.setLocalTranslation(x,y,z);

atlas.addGeometry(geom);



mat.setTexture(“Materials/podOrangeMaterial.png”, atlas.getAtlasTexture(“atlasColorMap”));



atlas.applyCoords(geom);

geom.setMaterial(mat);



return geom;

}



public static void main(String[] args)

{

TestTextureAtlas app = new TestTextureAtlas();

app.start();

}

public void simpleInitApp()

{

flyCam.setMoveSpeed(50);

atlas.addTexture(assetManager.loadTexture(“Materials/podGreenMaterial.png”), “atlasColorMap”);

atlas.addTexture(assetManager.loadTexture(“Materials/podBlueMaterial.png”), “atlasColorMap”);

atlas.addTexture(assetManager.loadTexture(“Materials/podOrangeMaterial.png”), “atlasColorMap”);



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

mat = new Material(assetManager, “Common/MatDefs/Light/Lighting.j3md”);





for (int i=0;i<5;i++)

{

for (int j=0;j<5;j++)

{

rootNode.attachChild(createGeom(i,0,j));

}

}











}

}[/java]





PS: I’ll be glad to write that wiki page for you guys when I figure this out, it definitely would be helpful if there was something about it in the wiki

why. the. heck. do. you. create. an. atlas. for. one. texture.

Also, as the javadoc says, the applyCoords() can only work if you took the texture from that geometry in the first place, else you have to do it by hand, so pick out the tile for a texture name and then use the tile to apply its texture coords to some mesh. Please, please, please, please THINK before you post the next question that pops to your mind.

This is very amusing! I just love you guys

@normen said:
why. the. heck. do. you. create. an. atlas. for. one. texture.


You know what they say: "There are questions you don't want an answer to." I think this might qualify. ;)
@normen said:
why. the. heck. do. you. create. an. atlas. for. one. texture.


not really.. I am creating an atlas for one texture for simplification reasons... that's not the issue.

I honestly dk how to do that. I'll meditate about it more I guess and try to figure it out.. thanks anyways

so pick out the tile for a texture name and then use the tile to apply its texture coords to some mesh.

gha, just by the speed of the reply I can say its bullshit… reading it now… aaand. it is. lol “creating an atlas for one texture for simplification reasons” …obviously… xD

The question here is, what’s the purpose of your atlas textures? You want to blend them? You want to store small textures? You want to do what with those textures in the atlas in the end?

I am using BatchNode for a list of my objects but at some point I want to change the material of one of them, since I cant change the material of an already batched node , I have to used that texture atlas - so basically to switch simple colors.





A simple few lines code explaining would have helped normen - guess this forum does not welcome beginners. You guys wrote simpler stuff in the wiki, why not for this one?

@homsi said:
A simple few lines code explaining would have helped normen - guess this forum does not welcome beginners. You guys wrote simpler stuff in the wiki, why not for this one?

I wrote the whole friggin class with a full code example in the javadoc. "Some lines of code" do not help you, believe me. You have to understand it yourself. Also, for your problem there is no lines of code involving TextureAtlas anyway. Your whole thinking is completely wrong as you rather trust your assumptions than reading our documentation. You have no idea of game programming, thats ok, our wiki is written for people like you. But coming here with totally artificial issues due to misuse of the classes and then complaining about the lack of support is just guaranteed frustration. And about "why is the problem that I am working on right now not explained in detail in the wiki".. When you have read the whole thing and have done all tutorials you might have your answer to both that question and your problem.