Comments (16)
Hi,
Could you elaborate on 'not being renderer properly'?
Are the textures stored alongside the models (in the same folder)?
Are the textures power of two textures?
Any errors in LogCat?
from rajawali.
Not being rendered properly means, Sometimes there is no texture loaded , and some of the times , it loaded only on half side of model.
Textures for MD2 Models are just bitmaps , so Bitmap images i will get from server and it need not to be stored on sdcard , where as in case of OBJ model , Material file will saved alongside the models , but again for Bitmap it will be same case.
Errors in Logcat is displayed:
Material was not found
from rajawali.
Ah, so there is a third scenario. When you load images from the server, are you sure they've completely finished loading?
Could you copy & paste the stack trace (with line numbers, etc)?
from rajawali.
hi here are the errors when i try to load model from sdcard and texture from drawable
05-25 14:53:24.715: W/System.err(3248): java.lang.NullPointerException: name
05-25 14:53:24.715: W/System.err(3248): at android.content.res.AssetManager.getResourceIdentifier(Native Method)
05-25 14:53:24.715: W/System.err(3248): at android.content.res.Resources.getIdentifier(Resources.java:1642)
05-25 14:53:24.715: W/System.err(3248): at rajawali.parser.MD2Parser.getMaterials(MD2Parser.java:122)
05-25 14:53:24.715: W/System.err(3248): at rajawali.parser.MD2Parser.parse(MD2Parser.java:79)
05-25 14:53:24.715: W/System.err(3248): at com.monyetmabuk.rajawali.tutorials.Md2Renderer.initScene(Md2Renderer.java:42)
05-25 14:53:24.715: W/System.err(3248): at rajawali.renderer.RajawaliRenderer.onSurfaceCreated(RajawaliRenderer.java:224)
05-25 14:53:24.715: W/System.err(3248): at com.monyetmabuk.rajawali.tutorials.Md2Renderer.onSurfaceCreated(Md2Renderer.java:58)
05-25 14:53:24.715: W/System.err(3248): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1373)
05-25 14:53:24.715: W/System.err(3248): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1138)
05-25 14:53:25.140: E/Rajawali(3248): [rajawali.animation.mesh.VertexAnimationObject3D] Material is null. Please add a material before adding a texture.
05-25 14:53:25.175: I/GLThread(3248): exiting tid=13
05-25 14:53:25.175: W/dalvikvm(3248): threadid=9: thread exiting with uncaught exception (group=0x4001e578)
05-25 14:53:25.175: E/AndroidRuntime(3248): FATAL EXCEPTION: GLThread 13
05-25 14:53:25.175: E/AndroidRuntime(3248): java.lang.RuntimeException: Material is null. Please add a material first.
05-25 14:53:25.175: E/AndroidRuntime(3248): at rajawali.BaseObject3D.addTexture(BaseObject3D.java:329)
05-25 14:53:25.175: E/AndroidRuntime(3248): at com.monyetmabuk.rajawali.tutorials.Md2Renderer.initScene(Md2Renderer.java:44)
05-25 14:53:25.175: E/AndroidRuntime(3248): at rajawali.renderer.RajawaliRenderer.onSurfaceCreated(RajawaliRenderer.java:224)
05-25 14:53:25.175: E/AndroidRuntime(3248): at com.monyetmabuk.rajawali.tutorials.Md2Renderer.onSurfaceCreated(Md2Renderer.java:58)
05-25 14:53:25.175: E/AndroidRuntime(3248): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1373)
05-25 14:53:25.175: E/AndroidRuntime(3248): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1138)
from rajawali.
Hi, the textures and the model both need to be in the same location. It's either sdcard or resources.
from rajawali.
thanks for your reply,
even i don't apply any texture situation is seemed to be same..
i have another question that in obj with the help of mtl texture is applied but how implicitly md2 model apply texture?is there any way to rename textures so that md2 apply them?
from rajawali.
could you send me the .obj file?
the md2 file is baked into the file, can't change that i'm afraid.
You can add a texture afterwards though.
from rajawali.
plz give your mail id so that i can forward you the file
from rajawali.
info at rozengain com
from rajawali.
The parser crashed when there was not material defined in the md2 file. Now it reports a RajLog message but continues without throwing an exception.
So after parsing the file you still have to add a material or it won't render:
MD2Parser parser = new MD2Parser(mContext.getResources(), mTextureManager, R.raw.king);
parser.parse();
VertexAnimationObject3D o = (VertexAnimationObject3D)parser.getParsedAnimationObject();
o.addLight(mLight);
o.setScale(.05f);
DiffuseMaterial material = new DiffuseMaterial(true); // -- true because it is an animated object
material.setUseColor(true); // -- use a color, not a texture
o.setMaterial(material);
o.setColor(0xff00ff00);
o.play();
from rajawali.
as you mentioned,i tried with these modifications but result is black screen,i am using the same md2 king model.
from rajawali.
Did you try using different values for setScale(); it might be too small to see depending on the distance of the camera. You might also try removing this line completely :-)
from rajawali.
sorry for replying late but i tried everything but still no model only black screen.
from rajawali.
Could you send me your code please?
On Jun 1, 2012 2:40 PM, "MrYogi" <
[email protected]>
wrote:
sorry for replying late but i tried everything but still no model only
black screen.
Reply to this email directly or view it on GitHub:
#35 (comment)
from rajawali.
i am just editing your md2 renedrer class ,here is the code:
package com.monyetmabuk.rajawali.tutorials;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
import rajawali.animation.mesh.VertexAnimationObject3D;
import rajawali.lights.DirectionalLight;
import rajawali.materials.DiffuseMaterial;
import rajawali.parser.MD2Parser;
import rajawali.renderer.RajawaliRenderer;
import android.content.Context;
import android.graphics.Color;
public class RajawaliMD2Renderer extends RajawaliRenderer {
private DirectionalLight mLight;
private VertexAnimationObject3D mOgre;
public RajawaliMD2Renderer(Context context) {
super(context);
setFrameRate(60);
}
public void playAnimation(String name) {
if (name.equals("loop all")) {
mOgre.play();
} else {
mOgre.play(name, false);
}
}
protected void initScene() {
mLight = new DirectionalLight(0, 0, 1);
mLight.setPower(2);
mCamera.setPosition(0, 0, -8);
MD2Parser parser = new MD2Parser(mContext.getResources(), mTextureManager, R.raw.king);
parser.parse();
VertexAnimationObject3D mOgre = (VertexAnimationObject3D)parser.getParsedAnimationObject();
mOgre.addLight(mLight);
mOgre.setScale(.015f);
DiffuseMaterial material = new DiffuseMaterial(true); // -- true because it is an animated object
material.setUseColor(true); // -- use a color, not a texture
mOgre.setMaterial(material);
mOgre.setColor(Color.GREEN);
addChild(mOgre);
mOgre.play();
}
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
((RajawaliExampleActivity) mContext).showLoader();
super.onSurfaceCreated(gl, config);
((RajawaliExampleActivity) mContext).hideLoader();
}
}
from rajawali.
I removed the line
mOgre.setScale(.015f);
which made it work.
from rajawali.
Related Issues (20)
- build issue com.github.ben-manes.versions not found HOT 3
- jcenter repository has been depracated
- Seeking Luminance based desaturation
- Seeking Lighten and Darken Blend Modes
- Seeking point texture plugin
- improving SpriteSheetMaterialPlugin efficiency HOT 1
- Seeking Flexible Sprite Sheet Animation
- Seeking runtime adjustment of AlphaMask threshold
- Please restore AnimatedSpritesFragment to example app
- Stencil Buffer is not initializing corrrectly,
- Some `ScreenQuad` materials spew error messages at frame rate
- Objects starts to render with delay when camera if far from them HOT 1
- How to translate object with touch screen?
- anyway to implement ray in the library?
- Create Sphere with phiStart, phiLength, thetaStart, thetaLength HOT 1
- LoaderFBX.java:347 ArrayIndexOutOfBoundsException
- display obj model in AR
- Examples are broken
- When will the new version be released?
- load obj file fail,NumberFormatException: For input string: "nan"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rajawali.