Having fun :)

Started by DavidYazel, July 04, 2003, 02:26:23

Previous topic - Next topic

DavidYazel

I am having fun with LWJGL

I have gotten far enough that I was able to run some stress tests and finding interesting results.

I have cubes which are moving around transformed every frame.  They are texture mapped and are done in quads (which I know suck for performance).


resolution     color depth     full screen    polygons      display list      FPS
-----------    -------------   ------------   ----------    -------------     -----
640x480        16              no             78            yes                1120
640x480        16              no             78            no                 1635
640x480        16              yes            78            no                 1535
1024x768       16              no             6072          no                 14
1024x768       16              no             6072          yes                4


It seems weird that 6000 quads would render so slowly on a GeForce 4 TI 4600.  And it is doubly wierd that display lists would even be slower, since that bypasses all the gl.vertex3f() calls completely.  I assume vertex arrays will be faster, and I will test them soon.

In the 6000 quad test there is nothing happening except drawing, since they all have the same appearance I do not change states.  They are also in the same transform group, so there is no changes to the matrix.  

I am about to install JBuilder 9 so I can analyze performance and see where the time is being spent.

DavidYazel

I changed the renderer to use vertex lists (which is easy because my underlying storage of all geometry is NIO buffers).  This did not improve the FPS wierdly.

So either it is the test case itself (1000 cubes made of quads rendering in exactly the same place) or sometheing else.

If I collapsed the shapes into a single shape but kept the same amount of geometry I suspect it would render quite fast, but it is interesting that 1000 calls of gl.drawArrays(mode,0,numVertices) is not blazingly fast.  I realize this is not  a LWJGL issue since I have removed almost all the overhead, this is more of an OpenGL question.

Matzon

Have you tried -Xprof ?

princec

That looks suspiciously like software rendering framerates to me.
BTW, quads are no different for performance than triangles, but they do cause unexpected problems sometimes if you subsequently try and draw triangles on top of them for multipass.

Cas :)

DavidYazel

How can I check to see if it is rendering in software?

princec

glGetString(GL.RENDERER) I think should give a hint. (Is that right?)

Cas :)

DavidYazel

OpenGL Renderer = GeForce4 Ti 4600/AGP/SSE/3DNOW!

Weird

DavidYazel

and wierder...

I changed the code to generate the cubes offset from each other randomly and the rendering sped up.  

Total frame = 220
Total time = 13 seconds
FPS = 16
Total polygons in scene are 12078

Now here is the real weird part.  Keeping exactly the same scene as above, but ADDING a single shape with 3000 triangles here are the results

Total frame = 1285
Total time = 41 seconds
FPS = 31

Total polygons in scene are 15078

Uh huh?

DavidYazel

Hot spots                                                                                     	Time %	Time   	
----------------------------------------------------------------------------------------------	------	-------	
org.lwjgl.opengl.BaseGL.doPaint                                                               	36.65 	7072 ms	
com.xith3d.render.SimpleRenderEngine.renderShape3D (SimpleRenderEngine.java:1257)             	22.45 	4332 ms


Looks like gl.drawArrays is taking 22 percent and doPaint is taking 36 percent of the cpu.  What is doPaint() doing?

princec

A swapbuffers. In other words it's waiting for all the drawing to finish, so that looks about right to me.

Cas :)