If you can read obj files from your source folder, which
LoaderOBJ objParser = new LoaderOBJ(mContext.getResources(),mTextureManager, R.raw.camero_obj);
and not from your SD card, you should make the following changes to your files: In your obj file, which should be saved as _obj in your SD card (therefore for _jpg and _mtl in the same place)
in your case:
mtllib 1c_mtl v -0.7526 14.5146 0.171602 v -0.7922 14.5792 0.075402 v -0.4998 14.7082 0.457802 v -0.5409 14.7486 0.393002 v -0.5358 14.5862 0.414902
Following the mtl file
newmtl Texture0 illum 0 Kd 0.7 0.7 0.7 Ks 0 0 0 Ka 0 0 0 newmtl Texture1 illum 0 Kd 0.7 0.7 0.7 Ks 0 0 0 Ka 0 0 0 map_Kd parse_jpg
Remember to rename your jpg texture to _jpg Where do you get the error message:
ERROR: 0:13: '.': Syntax error: syntax error
After that, execute your code to parse:
private Object3D Object; LoaderOBJ objParser = new LoaderOBJ(this,"Load/1c_obj"); try { objParser.parse(); Object = objParser.getParsedObject(); getCurrentScene().addChild(Object); } catch (ParsingException e) { e.printStackTrace(); }
And the error you get
E / Rajawali: [org.rajawali3d.materials.Material] Failed to compile fragment shader:
Unable to read your texture file from your material file. To do this, you can make the above changes in your material file.
For more information on custom materials or the vertex shader, follow the Rajawail document and sample
source share