Dynamic texture loading?

Started by ollioikarinen, March 13, 2008, 10:58:04 PM

Previous topic - Next topic

ollioikarinen

Hi again!

Nice to notice, that I come and go, seek and seek, try different things (jmonkeyengine, ruby with several 3D native bindings, Jirr etc.), but I always come back here - at home! ;)

Do you think it's possible, even easy enough to load and change 3D object's texture "on-the-fly" using JPCT?

Thanks,
OO

JavaMan

#1
Sure, its a breeze
One way to do it is to use to get the polygonmanager of an object, and then use setPolygonTexture to set the textures of individual polygons.
I suppose you could also just call setTexture on an object and then build it, but that may take some time if the object is complicated.
Jman

Hey, do you know how jpct and jmonkey stack up as far as performance?  I know that they are not the same thing, theres is something different in exactly what there used for, but approximately.

ollioikarinen

Thanks for your reply!

Almost the only way to really "benchmark" jPCT and jMonkeyEngine is to put them side by side both using OpenGL. Since I have used jMonkeyEngine's native libraries (.dll and .so), but actually never tried jPCT's OpenGL-support, I really can't tell. But what I can tell is that jPCT seems to be really fast engine. Some models I've loaded in jPCT-applets (pure java, 1.1) and they seem to run as smoothly as in jMonkeyEngine (with jMonkeyEngine you can't even make java 1.1 applets, only 1.4 and above and it's not even easy, needs extra effort and hard work to get them working!).

But there must be people here at these forums who have used both engines with the same models and both using OpenGL?

OO

fireside

Not me, I'm lucky if I can learn one engine.  I like jPct because it's so small and it still seems pretty fast to me.  I might try JME if I get into a big project, but right now I'm more interested in things that might be able to fit into an applet.
click here->Fireside 7 Games<-

JavaMan

This is my first game engine. Actually its my first experience with any type of game programming at all.
QuoteSome models I've loaded in jPCT-applets (pure java, 1.1)

That is a nice thing about jpct that it can run on the such an old jre.


Which engine takes less code to do the same thing jpct or jmonkey? I not thinking of dumping jpct, just wondering. I really do like how simple jpct is to use.

ollioikarinen

Quote from: JavaMan on March 14, 2008, 10:50:59 PM
Which engine takes less code to do the same thing jpct or jmonkey? I not thinking of dumping jpct, just wondering. I really do like how simple jpct is to use.

Both engines are really easy to use, but for my taste jMonkeyEngine is nowadays almost too easy to use. You don't need your own code almost at all to get started (importing your model and attaching some physics onto it). Anyway, programming tends to be "choosing engines and libraries" and "putting as small amount your own 'glue' as possible" today - which is kind of a good thing anyway...

I try to do some testing with render-to-texture today. I try to make a mirror and a reflective surface with jPCT.

EgonOlsen

#6
Quote from: ollioikarinen on March 15, 2008, 09:53:28 AM
Anyway, programming tends to be "choosing engines and libraries" and "putting as small amount your own 'glue' as possible" today
And end up with a gazillion of applications that all look and feel the same... ;D

EgonOlsen

#7
Quote from: ollioikarinen on March 15, 2008, 09:53:28 AM
I try to do some testing with render-to-texture today. I try to make a mirror and a reflective surface with jPCT.
Keep in mind that the orientation of the render-to-texture result (via FrameBuffer.setRenderTarget(<Texture>)) differs from software to hardware renderer due to technical reasons. If you want to use both, i recommend to flip the result by using an ITextureEffect when using the software renderer. If you limit yourself to one renderer, it doesn't matter...

ollioikarinen

Quote
If you want to use both, i recommend to flip the result by using an ITextureEffect when using the software renderer. If you limit yourself to one renderer, it doesn't matter...

Thanks for the notice, I'm gonna use the software-renderer only.

ollioikarinen

I think I managed to render "the world" onto my model's texture-surface. I can't be sure - it is black at the moment - but I think it's rendering it but all the models are so small or the direction for the camera is wrong and that's the reason I can't see anything.

EgonOlsen, do you think you could publish your TV-example's sourcecode? Or have you even published it already?

Thanks again,
Olli

JavaMan

QuoteI think I managed to render "the world" onto my model's texture-surface. I can't be sure - it is black at the moment - but I think it's rendering it but all the models are so small or the direction for the camera is wrong and that's the reason I can't see anything.

Try out making a call to setAmbientLight; maybe there is no light in your world? Also, you can tell the camera to lookAt the transformed center of your object. That way you know you are looking at your object.
If you still don't see it, move the camera in or out.
Jman

EgonOlsen

Did you use the FremeBuffer's render-target mechanism or something home brewn to render into the texture?

ollioikarinen

Quote from: EgonOlsen on March 18, 2008, 10:25:06 AM
Did you use the FremeBuffer's render-target mechanism or something home brewn to render into the texture?

I used FrameBuffer's setRenderTarget (_your_ home brewn method ;).