www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: AW999 on July 13, 2010, 07:47:05 pm

Title: Runtime-generated textures
Post by: AW999 on July 13, 2010, 07:47:05 pm

Once I've generated the textures I need via my code, what's the easiest way to transfer that array to a usable texture graphic which jPCT can use?  I assume for a .bmp, I just need to reverse the array so it's "upside down" and then add a header?  Or is it best to use premade conversion code from a library? Or am I way off base...?
Title: Re: Runtime-generated textures
Post by: EgonOlsen on July 13, 2010, 10:39:40 pm
Depends on the format of the generated texture. If it's an int[]-array or similar, the best way is to use an ITextureEffect.
Title: Re: Runtime-generated textures
Post by: AW999 on July 13, 2010, 11:06:59 pm
Depends on the format of the generated texture. If it's an int[]-array or similar, the best way is to use an ITextureEffect.

  Just an array of pixels in RGB format. Is there an example of using ITextureEffect for something like this?
Title: Re: Runtime-generated textures
Post by: EgonOlsen on July 13, 2010, 11:18:08 pm
I have various ITextureEffect implementations lying around here, but i guess they would confuse more than they might help, because they do too much.

The steps are pretty simple:


That's basically all there is to do. Hope this helps.