Author Topic: Dynamic texture loading?  (Read 5453 times)

Offline ollioikarinen

  • byte
  • *
  • Posts: 12
    • View Profile
Dynamic texture loading?
« on: March 13, 2008, 10:58:04 pm »
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

Offline JavaMan

  • long
  • ***
  • Posts: 231
    • View Profile
Re: Dynamic texture loading?
« Reply #1 on: March 13, 2008, 11:27:10 pm »
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.
« Last Edit: March 13, 2008, 11:32:59 pm by JavaMan »

Offline ollioikarinen

  • byte
  • *
  • Posts: 12
    • View Profile
Re: Dynamic texture loading?
« Reply #2 on: March 14, 2008, 04:10:35 pm »
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

Offline fireside

  • double
  • *****
  • Posts: 605
    • View Profile
Re: Dynamic texture loading?
« Reply #3 on: March 14, 2008, 08:50:44 pm »
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<-

Offline JavaMan

  • long
  • ***
  • Posts: 231
    • View Profile
Re: Dynamic texture loading?
« Reply #4 on: March 14, 2008, 10:50:59 pm »
This is my first game engine. Actually its my first experience with any type of game programming at all.
Quote
Some 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.

Offline ollioikarinen

  • byte
  • *
  • Posts: 12
    • View Profile
Re: Dynamic texture loading?
« Reply #5 on: March 15, 2008, 09:53:28 am »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Dynamic texture loading?
« Reply #6 on: March 15, 2008, 11:01:30 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
« Last Edit: March 15, 2008, 11:09:10 am by EgonOlsen »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Dynamic texture loading?
« Reply #7 on: March 15, 2008, 11:17:27 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...
« Last Edit: March 15, 2008, 11:19:28 am by EgonOlsen »

Offline ollioikarinen

  • byte
  • *
  • Posts: 12
    • View Profile
Re: Dynamic texture loading?
« Reply #8 on: March 15, 2008, 03:48:48 pm »
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.

Offline ollioikarinen

  • byte
  • *
  • Posts: 12
    • View Profile
Re: Dynamic texture loading?
« Reply #9 on: March 17, 2008, 12:36:31 pm »
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

Offline JavaMan

  • long
  • ***
  • Posts: 231
    • View Profile
Re: Dynamic texture loading?
« Reply #10 on: March 17, 2008, 12:43:08 pm »
Quote
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.

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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: Dynamic texture loading?
« Reply #11 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?

Offline ollioikarinen

  • byte
  • *
  • Posts: 12
    • View Profile
Re: Dynamic texture loading?
« Reply #12 on: March 19, 2008, 09:33:36 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 ;).