A 3d Project -- Loading and Rendering md2 model

Tutorials concerning the OpenGL® ES cross-platform API for full-function 2D and 3D graphics on the Google-Android platform.

A 3d Project -- Loading and Rendering md2 model

Postby suhas.gavas » Wed Oct 08, 2008 8:39 am

Hi Guys,
I have attached a project for new sdk 0.9 and higher which has :

1. A 3d cube
2.Loading and rendering of 3d model which is md2 type
Attachments
suhas3d.rar
include whole project
(1.34 MiB) Downloaded 2825 times
suhas.gavas
Junior Developer
Junior Developer
 
Posts: 22
Joined: Thu Sep 04, 2008 7:58 am

Top

Postby Serenikill » Fri Nov 07, 2008 4:39 am

well done, thanks for the sample.

Although the cube seems to get Zbuffer issues and the other is quite laggy, but not a big deal for a small sample
Serenikill
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Nov 07, 2008 2:26 am

Postby suhas.gavas » Fri Nov 07, 2008 6:43 am

Hi
Ya its sample application and I know its lagging.
I have just worked on it because i have noticed that many developers were having problem with opengl context in sdk 0.9.
suhas.gavas
Junior Developer
Junior Developer
 
Posts: 22
Joined: Thu Sep 04, 2008 7:58 am

Postby SkyNet800 » Fri Feb 27, 2009 12:39 pm

I´ve seen that you have used some libraries importing them:

import edu.union.graphics.IntMesh;
import edu.union.graphics.MD2Loader;
import edu.union.graphics.Model;

where are them? I can´t see them in this package.
SkyNet800
Junior Developer
Junior Developer
 
Posts: 20
Joined: Tue Feb 24, 2009 11:44 am

Postby whatever12684 » Sun Mar 01, 2009 10:09 am

[quote="SkyNet800"]I´ve seen that you have used some libraries importing them:

import edu.union.graphics.IntMesh;
import edu.union.graphics.MD2Loader;
import edu.union.graphics.Model;

where are them? I can´t see them in this package.[/quote]

Inside Referenced Libraries, he has modelloader.jar
Inside that jar file exists those classes.
whatever12684
Freshman
Freshman
 
Posts: 4
Joined: Sun Mar 01, 2009 10:07 am

Postby whatever12684 » Sun Mar 01, 2009 10:36 pm

[quote="suhas.gavas"]Hi
Ya its sample application and I know its lagging.
I have just worked on it because i have noticed that many developers were having problem with opengl context in sdk 0.9.[/quote]

Thanks suhas,

Do you have a working example for loading an .obj file?

I'm unfamiliar with file formats, but it seems obj formats have no animations, so running it through your current GLThread breaks.

Thanks again.
whatever12684
Freshman
Freshman
 
Posts: 4
Joined: Sun Mar 01, 2009 10:07 am

Top

Postby suhas.gavas » Mon Mar 02, 2009 7:10 am

hi,
actually now I m not using or loading md2 models in my project . I m using ms3d models and they work gr8 for me.
So bcoz of ms3d i m not using or working on any other models.
suhas.gavas
Junior Developer
Junior Developer
 
Posts: 22
Joined: Thu Sep 04, 2008 7:58 am

Postby javame_android » Fri Mar 27, 2009 10:39 am

Hi,

I want to know is it necessary to have model for displaying objects. If v dont have a model then can rendering be performed.
Thanks & Regards
Sunil
javame_android
Junior Developer
Junior Developer
 
Posts: 19
Joined: Wed Mar 25, 2009 11:00 am
Location: Ahmedabad

Postby suhas.gavas » Mon Mar 30, 2009 7:23 am

Its not necessaryu to have models to dispaly objects. If u have co-ordinates of the triangles to be rendered u can do it. as in the attached rar there is example of cube in which cube is rendered by not using model but by defining co-ordinbates in the code itself
suhas.gavas
Junior Developer
Junior Developer
 
Posts: 22
Joined: Thu Sep 04, 2008 7:58 am

Postby dolgion1 » Mon Apr 06, 2009 6:49 am

hm i dont get any errors with the app, but it's just a black screen when i start.
what could the problem be?

{EDIT} Oh nevermind, it just took reeaally long on my old machine to render the model lol
dolgion1
Freshman
Freshman
 
Posts: 2
Joined: Fri Apr 03, 2009 5:33 am

Loading Maps

Postby MrPlatonic » Tue Apr 28, 2009 5:55 pm

Hello Suhas,

First off: Thanks for the example! It is the first working 3D import demo I have used.

I am attempting to load a 3D model created in Blender into my project, to no avail. By default, Blender exports MD2 files with ~250 frames. There is a python script that fixes this problem, but I am not sure if the model will load even after I manage to export a single frame.

What tool are you using to create the model?

Thanks!
MrPlatonic
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Apr 28, 2009 5:41 pm
Location: Tacoma, WA

Postby lostInTransit » Thu May 21, 2009 2:15 pm

Bump

I'd also like to know what tool you're using to create the models Suhas. Thanks for the tutorial.
lostInTransit
Developer
Developer
 
Posts: 26
Joined: Thu Feb 12, 2009 10:37 am
Location: India

Reply for 3D models

Postby suhas.gavas » Thu Oct 08, 2009 8:14 am

Hi All,
Sorry for late reply.
Might be u guys have moved forward with other stuff with respect to 3d and had ur own engine for 3d

I have used Milk shape 3d 1.8.4 which is a view/editor/maker tool which can be use to make 3d models.
So i Have created models in this tool which are ms3d models as there extension and type
Then I wrote a ms3d model loader and render class with the help of NEHE tutorial which are in c language
So I have to convert it to java
It worked gr8 for me and so i stopped using md2 loader libraries.
With the help of ms3d models and loader/renderer class I ported a iphone game ipinpong 3d to android and it works gr8 and i got more than 25 fps(varies from 35-45 fps) in my game. U can check ipingpong 3d game on android store. Its purely 3d game.
Also I used VBO(vertex buffer object) technique which helped me a lot to stop having gc in betweent the game
Also to have rich 2d graphics in my game I have layered surface view and other views(ImageView, TextView, button etc).

U can chk the screen shots of the game
Attachments
original_653.jpg
original_653.jpg (63.95 KiB) Viewed 12059 times
ipingpong3d_189.png
ipingpong3d_189.png (81.49 KiB) Viewed 12059 times
thumb_116.png
thumb_116.png (147.65 KiB) Viewed 12059 times
suhas.gavas
Junior Developer
Junior Developer
 
Posts: 22
Joined: Thu Sep 04, 2008 7:58 am

Postby amandake » Fri Apr 16, 2010 7:23 pm

Thanks for the example. I have successfully opened and run it on nexus one, and worked great.
Could any one tell me how to replace my own static model?
I put the model into res/ drawable folder and change the path : is = getResources().openRawResource(path);
It keeps showing error when running the app. on emulator or device.
Thanks for your help.
amandake
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Apr 16, 2010 7:01 pm

Re: Reply for 3D models

Postby seed » Fri Apr 16, 2010 8:58 pm

suhas.gavas wrote:Hi All,

Then I wrote a ms3d model loader and render class with the help of NEHE tutorial which are in c language
So I have to convert it to java
It worked gr8 for me and so i stopped using md2 loader libraries.


The game looks great. Can you provide the code for loading ms3d models?
seed
Senior Developer
Senior Developer
 
Posts: 103
Joined: Mon Mar 15, 2010 3:22 pm

Top
Next

Return to Android 2D/3D Graphics - OpenGL Tutorials

Who is online

Users browsing this forum: No registered users and 2 guests