www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: KittenKoder on November 12, 2012, 07:51:28 am

Title: Need Advice
Post by: KittenKoder on November 12, 2012, 07:51:28 am
Okay, I figured out that either jPCT or OpenGL doesn't like transparent objects. Tons of sorting errors and it eats CPU cycles, on the GL render. Since I'm too lazy to write my own graphics library for OpenGL I'm just going to work with it somehow. Which leads to two things I would like some recommendations on from the dev(s) of jPCT:

1. For texture animations, frame by frame update of the texture, would reassigning the texture each frame be more costly, or would using a TextureEffect and updating the texture's array each frame be more costly, when using jPCT?

2. Would using two worlds cost a lot? I notice that using two worlds versus one then switching visibility on the objects, has almost no difference in CPU cycles eaten, and the two different methods don't seem to have much of a difference in resource consumption from what I can see.

When I say cost I mean memory and CPU consumption. I don't know exactly how you coded the World class, so I'm not sure what it does exactly. Currently with the simple world, and almost no transparent objects, I can pump out 33 FPS with or without the GUI layer on top of it, using either technique. So unless there is a nuance that could kill an app I am considering going with the multiple world "layers."
Title: Re: Need Advice
Post by: EgonOlsen on November 12, 2012, 11:00:47 am
Quote
Okay, I figured out that either jPCT or OpenGL doesn't like transparent objects. Tons of sorting errors and it eats CPU cycles, on the GL render.
Sorting is required to maintain rendering order and can't be perfect. because it's based on the painter's algorithm, which simply isn't perfect. However, it actually doesn't eat that much of the cpu unless your cpu is really really slow and old...is it? Even on Android, you can sort hundreds of objects in almost no time. Are you actually using compile() on your objects? Because if you don't, the sorting/rendering happens based on polygons and not objects, which is slower.

Quote
1. For texture animations, frame by frame update of the texture, would reassigning the texture each frame be more costly, or would using a TextureEffect and updating the texture's array each frame be more costly, when using jPCT?
Updating the array is more costly, because it requires to destroy and upload the texture on the GPU. The other approach (i.e. assign a new texture) is cheaper if the texture is already present on the GPU.

Quote
2. Would using two worlds cost a lot? I notice that using two worlds versus one then switching visibility on the objects, has almost no difference in CPU cycles eaten, and the two different methods don't seem to have much of a difference in resource consumption from what I can see.
No, it's pretty cheap and layering them is fine.
Title: Re: Need Advice
Post by: KittenKoder on November 12, 2012, 11:51:01 am
Quote
Okay, I figured out that either jPCT or OpenGL doesn't like transparent objects. Tons of sorting errors and it eats CPU cycles, on the GL render.
Sorting is required to maintain rendering order and can't be perfect. because it's based on the painter's algorithm, which simply isn't perfect. However, it actually doesn't eat that much of the cpu unless your cpu is really really slow and old...is it? Even on Android, you can sort hundreds of objects in almost no time. Are you actually using compile() on your objects? Because if you don't, the sorting/rendering happens based on polygons and not objects, which is slower.

Quote
1. For texture animations, frame by frame update of the texture, would reassigning the texture each frame be more costly, or would using a TextureEffect and updating the texture's array each frame be more costly, when using jPCT?
Updating the array is more costly, because it requires to destroy and upload the texture on the GPU. The other approach (i.e. assign a new texture) is cheaper if the texture is already present on the GPU.

Quote
2. Would using two worlds cost a lot? I notice that using two worlds versus one then switching visibility on the objects, has almost no difference in CPU cycles eaten, and the two different methods don't seem to have much of a difference in resource consumption from what I can see.
No, it's pretty cheap and layering them is fine.

Thank you, I actually think the entire CPU drain was because of the method I had for animated textures. I'll have to figure out some method that will work well with the reassignment technique though. Without the animation on the textures it's pretty smooth. Of course my CPU is only 1Ghz, so I'll likely work on a 2D GUI using blitting for an alternative as well. Otherwise the GUI system for the library is completed.

My computer is actually pretty old, about 5 years old, and I only have 1gig RAM as well. Which is fine because the game I want to develop I am hoping to appeal to even people with old computers, so I develop for my computer with the option of "better" stuff available in the library.
Title: Re: Need Advice
Post by: bobson on November 14, 2012, 07:43:49 am
My opinion that your ps's configuration is acceptable, most of first mid have till 1Ghz and 512Mb of RAM.
Title: Re: Need Advice
Post by: KittenKoder on November 15, 2012, 04:10:09 am
My opinion that your ps's configuration is acceptable, most of first mid have till 1Ghz and 512Mb of RAM.

That's what I am hoping. I actually purposefully bought an old computer for development testing and this is the lowest machine I could find in the shop. Games that I play are all console games, I actually prefer those and there is a huge lack of such styles for the PC.