smart-fun / smartGL

SmartGL is a Graphic Engine for creating Android Games and Apps. It is based on OpenGL and handles 2D Sprites and 3D Textured Objects.
Apache License 2.0
109 stars 24 forks source link

how to import obj file #7

Closed laitr01 closed 7 years ago

laitr01 commented 7 years ago

some obj file have .mtl plus how can to read them i tried way like you but no anything display

camaro

smart-fun commented 7 years ago

Hi!

can you put your files here so that I can have a look to them? If you don't want to put them here you can send them by email at contact@arnaudguyon.fr

thanks!

Arnaud.

laitr01 commented 7 years ago

Thanks for fast support. Here it is.

raw.zip

smart-fun commented 7 years ago

I successfully displayed it :)

WavefrontModel model = new WavefrontModel.Builder(context, R.raw.camaro_obj)
                .addTexture("01_-_Default_CMRO_TEX.TGA", mSpaceCruiserTexture)
                .create();
mObject3D.setScale(1f, 1f, 1f);
mObject3D.setPos(0, 0, -6);

with all this you should be able to see your car on screen.

It remains 1 issue, the mapping does not seem to be correct. Note that the .mtl file is not used, it is not planned to use it so far. Maybe there are some important values there for mapping (like an offset or something).

I don't have enough time today to investigate more.

tell me if you can see the car with those changes, and if there is still mapping issue.

Arnaud.

laitr01 commented 7 years ago

owh, i think has problem with mapping material

check my original car screenshot_2017-06-22-22-41-22 1 screenshot_2017-06-22-22-41-17 1 screenshot_2017-06-22-22-41-15 1

smart-fun commented 7 years ago

Hi,

I have found the issue. Vertical mapping is inverted in smartGL : if you try doing a vertical mirror on your jpeg then it works with smartGL. I'll fix that as soon as I have time.

Arnaud.

smart-fun commented 7 years ago

Hello Lai,

I've made a fix in release 1.1.3. Could you please use it and tell me if this is ok for you?

And are you ok if I use your car as a sample for my library ?

thanks!

Arnaud.

smart-fun commented 7 years ago

I assume the bug is fixed (tested on my side), so I'm closing the issue.

rameshkec85 commented 2 years ago

@laitr01 can u please provide me sample of your project. I could able to load obj files.