How to import Blender models into JOGL?

classic Classic list List threaded Threaded
29 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: How to import Blender models into JOGL?

Estajxo
That makes sense since it is backed up by my experience. But I strongly suppose that the version from the model loader must also work in some way, otherwise the Passivist would have written it different. That is why I am asking.
Reply | Threaded
Open this post in threaded view
|

Re: How to import Blender models into JOGL?

Pixelapp
Well. When you use the ClassLoader class is when you need to read your sources by using URLs, the other ways of reading are by using paths that are not URLs. The difference is that you can use the ClassLoader class from inside a package (myfile.jar), but the others only work when you have all-Permissions.

Hope that clarifies it.
Reply | Threaded
Open this post in threaded view
|

Re: How to import Blender models into JOGL?

Pixelapp
In reply to this post by Estajxo
And that's just to name the most important cases. There are other instances that you will learn while you are coding.
Reply | Threaded
Open this post in threaded view
|

Re: How to import Blender models into JOGL?

gouessej
Administrator
In reply to this post by Estajxo
Estajxo wrote
In the output entry there is indeed "bin". But when I remove it and restart Eclipse, I cannot start the application because of a NoClassDefFoundError, same as when I remove it from within Eclipse (which Eclipse does not allow, in fact).
You should have removed the whole entry from your file like I do here:
http://tuer.svn.sourceforge.net/viewvc/tuer/pre_beta/.classpath?revision=505&view=markup

It is supported by Eclipse, I have done that since 2006.

Estajxo wrote
I read in another forum that getResource works well in Linux, but not quite (or not always) in other OSs. As my screenshot reveals, I use Windows...
getResource() works well with Unix-like path even under Windows, you read wrong things.

Putting the models into "src" is a really bad idea. If you don't succeed in cleanly fixing your problem, just send me your files by email and I will explain to you what I modify to allow you to understand my changes.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: How to import Blender models into JOGL?

Demoscene Passivist
Administrator
In reply to this post by Estajxo
>But I strongly suppose that the version from the model loader must also work
>in some way, otherwise the Passivist would have written it different. That is why I am asking.

Internally the model loader uses the classloader in more or less the same way you did:
    new BufferedInputStream((new Object()).getClass().getResourceAsStream(inModelPath))

... so the "path" you supply only has to be in reach of the classloader and can be an URL too if you like. I myself don't start my JOGL application direcly out of eclipse but use ant to deploy to a dedicated deployment location and start it manually from there.
Reply | Threaded
Open this post in threaded view
|

Re: How to import Blender models into JOGL?

Estajxo
In reply to this post by gouessej
gouessej wrote
You should have removed the whole entry from your file like I do here:
http://tuer.svn.sourceforge.net/viewvc/tuer/pre_beta/.classpath?revision=505&view=markup
The last entry of the linked example still shows the entry, only with an empty String. This is what I have done, too.

Anyway, I now found one solution quite workable which is described here: http://lj4newbies.blogspot.de/2008/03/using-classgetresource-load-resource.html
I suppose this is a "clean" solution, isn't it? If not, what are the disadvantages?

Anyway, thanks a lot for your support! As a reward I would like to share my results regarding this. My Blender model

now looks like this inside my application:

Pretty flat shading still, but at least it is there. More vivid shading will need lighting, I suppose.
But also, as you can see I added some material to my model, like the black screen and the white eyes. Is there any way to recover those in the application? So far I just set the glColor to this bluey color (or any other) and the material is lost.
Reply | Threaded
Open this post in threaded view
|

Re: How to import Blender models into JOGL?

Demoscene Passivist
Administrator
>But also, as you can see I added some material to my model,
>like the black screen and the white eyes. Is there any way to recover those in the application?

Generally u can't use the materials u see in in Blender directly in JOGL/OpenGL, but there are multiple ways to work around this.

Personally I use a combination of "texture baking" and "uv unwrapping" (google for these) to export materials as textures from blender. The rest I add with shaders manually in my application.

Another way is to use the "blender game engine" and use the materials provided there. These can be easily reverse engineered/extracted from the engine and used with JOGL.
Reply | Threaded
Open this post in threaded view
|

Re: How to import Blender models into JOGL?

Andrew
Hi passivist, after importing the Blender model into JOGL is there any way to change the color of model components?
Reply | Threaded
Open this post in threaded view
|

Re: How to import Blender models into JOGL?

Demoscene Passivist
Administrator
Not with the loader I'm using. But I'm sure there are loaders out there that use the .mtl files from blender that are dropped with the .obj files.

But as stated before to change any part of an exported object blender I would go for the texture/shader solution to change the appearance. Its the most flexible way.
12