Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - luozi

#1
Thank you very much !
#2
Oh, I almost foget the math. Thank you! By the way, can you tell me if a model's texture coordinates have been difinited, does the size of the texture or the size of the picture have influnce on the result?
#3
Anybody give me a help? I have try many times but it is still not what I expect. Thanks!
#4
I want to caculate the angle between two SimpleVectors, I using the following code:
SimpleVector sp=new SimpleVector(0,1,0);
float angle=sp.calcAngle(new SimpleVector(0,0,1));
Logger.log("angle is "+angle);

I thought the angle should be 90, but the  output "angle is 1.5707964", is there something I misunderstand? Thank you!
#5
Support / Re: how to load the model
November 03, 2011, 05:16:03 PM
Sorry about my late reply. Your picture works fine on the sphere. Then I try to understand your " the coordinates is proper for special texture", but I can't understand it. I tried a small picture , it doesn't wrap the shpere completly, when I try a bigger one it overlay some part. What confuse me is that the texture is an array, and the texture coordinates is the relative coordinate. It just point out what part of the texture will be applied in the vertex( there is always a part of the texture will be). If that is true why I have to rescale the texture to a special size? And is there any difference between the pictures of different size? Thank you!
#6
Support / Re: how to load the model
November 02, 2011, 03:42:36 PM
Yes, I find that it says out of memory, so I load .obj files and md2 file, they work perfectly. Somehow, later I load the terra.asc, it work fine. I am not sure what happened, but I still have some question:
1. when I load the obj file and call setTexture(), but there is no texture on the object ,so the obj file doesn't contain texture coordinates , is that right?
2.when I load the md2 file and call setTexture(), the texture wrap the object perfectly, so the md2  file contains the texture coordinates, and if I want to create a object with texture, I just load the model, and set the texture using the picture, am I right?
3.when I load the obj terra.asc, it should work perfectly, but when I call setTexture(),the sphere's texture is not what I expected, I attach the picture. It isn't the result of the demon "earth". Is the texture coordinates different? Can you explain for me? Thank you!

[attachment deleted by admin]
#7
Support / how to load the model
November 02, 2011, 07:58:22 AM
I want to create a sphere with texture coordinates, so I download the terra.asc. I load the file, and when I start it , it stop unexpectedly. I try many times, but it still doesn't work, can any one help me?
try {
model = Loader.loadASC(new FileInputStream("/assets/terra.asc"), 4, true);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

model.setTexture("texture");
model.strip();
model.build();
world.addObject(model);

by the way, is there something wrong with the following code, I load the model using that fist, but when I use this function , the program will stop unexpectedly, thank you.public InputStream loadf(String fileName)
{

AssetManager am=getResources().getAssets();
try{
return am.open(fileName,AssetManager.ACCESS_STREAMING);

}
catch(IOException e){
return null;

}
}
#8
Ok, now I realy get it, thank you!
#9
Yes, you are right. But I find the only way to change the texture coordinate is via setpolygontexture(int polyID, TextureInfo tinf), am I right? And I'm not sure the "merge textures to one and modify the coordinates", is that by call TextureManager.compress() and setpolygontexture()? I know I am boresome but I just want to know clealy about your engine so that I can tell my classmates right thing.
#10
yes,I see, now how can I set the texture of every face, and how to set the texture coordinates of the vertex?  Thank you! ;)
#11
oh, I think  maybe this is because I did't set the Texture coordinates. I learn that opengl can calculate the Texture coordinates automatically, and in JPCT how to implement that? Thank you
#12
Thank you, I think I have know what you mean. And now I want to give every face a texture, so I call cube.getPolygonManager().setPolygonTexture(ID,TextureManager.getInstance().getTextureID("texture")); . But nothing happened except for there is one triangle become black. How can I set the texture of every face?
#13
I don't think I express myself clearly. Now I attach the picture, the picture1 is the example's result. The picture2 is the result ,   when I change cube.calctextwrapspherical(),to cube.calctexturewrap(),  I set new texture(...,ture) and I don't set the gl.enable(blend). And when I change the cube to a sphere, there are also two black places, which confuse me a lot.

[attachment deleted by admin]
#14
Yes, I set gl.enable(blend), and gl.blenfuc(ALPHA....). There is a hole in the upper and nether face. When I touch the screen , the cube totate. And  then I can see the upper face.  In the center of the upper face there is not any texture, maybe because the effect of the blend, I can see the background color. How can I make everywhere have the texture, thank you very much!
#15
I compile the example of the helloworld_ae, but when the cube display on the screen, there is some place that is entirely transparent as if there is no texture on it. I thought it was beacuse the cube.caltexturewrapsherical(), then I change it to cube.caltexturewrap(), but this time it was like that the texture is changed to default