Author Topic: Create VBO for object  (Read 5480 times)

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Create VBO for object
« on: March 11, 2011, 04:05:21 pm »
Can I somehow create VBO for all objects manually?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Create VBO for object
« Reply #1 on: March 11, 2011, 05:00:49 pm »
No. Why would you want to?

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Create VBO for object
« Reply #2 on: March 11, 2011, 05:14:11 pm »
creating VBO takes much time and here are visible big lags

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Create VBO for object
« Reply #3 on: March 11, 2011, 05:46:16 pm »
I misunderstood your question....i thought you wanted to upload you own data into some vbos, but you actually want to control the upload process.
Are you sure that creating the vbos causes this? It should actually be pretty cheap. Can't it be that the compilation of the objects causes the hickups? In that case, you can compile all objects at once by using the method in World.

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Create VBO for object
« Reply #4 on: March 11, 2011, 06:52:01 pm »
Compile all objects is without any changes. On objects where is GC_FOR_MALLOC are textures...

Code: [Select]
03-11 18:42:52.455: INFO/jPCT-AE(16059): new frame
03-11 18:42:52.469: INFO/jPCT-AE(16059): new frame
03-11 18:42:52.483: INFO/jPCT-AE(16059): VBO created for object 'm_0'
03-11 18:42:52.483: INFO/jPCT-AE(16059): VBO created for object 'm_0'
03-11 18:42:52.485: INFO/jPCT-AE(16059): new frame
03-11 18:42:52.503: INFO/jPCT-AE(16059): new frame
03-11 18:42:52.539: INFO/jPCT-AE(16059): new frame
03-11 18:42:52.563: INFO/jPCT-AE(16059): VBO created for object 'l_19'
03-11 18:42:52.563: INFO/jPCT-AE(16059): VBO created for object 'l_20'
03-11 18:42:52.611: DEBUG/dalvikvm(16059): GC_FOR_MALLOC freed 199 objects / 1055648 bytes in 38ms
03-11 18:42:52.623: VERBOSE/InputDevice(3227): ID[0]=0(0) Up(1=>0)
03-11 18:42:52.625: VERBOSE/WindowManager(3227): Dsptch > Window{48ea1840 com.main/cz.game.main.Demo paused=false}
03-11 18:42:52.661: INFO/jPCT-AE(16059): VBO created for object 'o_1'
03-11 18:42:52.709: DEBUG/dalvikvm(16059): GC_FOR_MALLOC freed 95 objects / 1051656 bytes in 34ms
03-11 18:42:52.759: INFO/jPCT-AE(16059): VBO created for object 'o_11'
03-11 18:42:52.779: INFO/jPCT-AE(16059): VBO created for object 'm_0'
03-11 18:42:52.779: INFO/jPCT-AE(16059): VBO created for object 'm_0'
03-11 18:42:52.779: INFO/jPCT-AE(16059): VBO created for object 'm_0'
03-11 18:42:52.783: INFO/jPCT-AE(16059): VBO created for object 'm_0'
03-11 18:42:52.793: INFO/jPCT-AE(16059): VBO created for object 'o_12'
03-11 18:42:52.801: VERBOSE/WindowManager(3227): Dsptch > Window{48ea1840 com.main/cz.game.main.Demo paused=false}
03-11 18:42:52.801: VERBOSE/InputDevice(3227): ID[0]=0(0) Dn(0=>1)
03-11 18:42:52.809: INFO/jPCT-AE(16059): VBO created for object 'o_13'
03-11 18:42:52.817: INFO/jPCT-AE(16059): VBO created for object 'o_13'
03-11 18:42:52.823: INFO/jPCT-AE(16059): VBO created for object 'o_13'
03-11 18:42:52.833: INFO/jPCT-AE(16059): VBO created for object 'o_14'
03-11 18:42:52.843: INFO/jPCT-AE(16059): VBO created for object 'o_15'
03-11 18:42:52.853: INFO/jPCT-AE(16059): VBO created for object 'o_16'
03-11 18:42:52.855: INFO/jPCT-AE(16059): VBO created for object 'o_17'
03-11 18:42:52.865: INFO/jPCT-AE(16059): VBO created for object 'm_0'
03-11 18:42:52.865: INFO/jPCT-AE(16059): VBO created for object 'b_24'
03-11 18:42:52.877: INFO/jPCT-AE(16059): VBO created for object 'o_2'
03-11 18:42:52.881: INFO/jPCT-AE(16059): new frame
03-11 18:42:53.785: INFO/jPCT-AE(16059): new frame
03-11 18:42:53.895: DEBUG/dalvikvm(16059): GC_FOR_MALLOC freed 444 objects / 1066040 bytes in 81ms
03-11 18:42:53.963: INFO/jPCT-AE(16059): VBO created for object 'o_5'
03-11 18:42:54.057: DEBUG/dalvikvm(16059): GC_FOR_MALLOC freed 458 objects / 1063288 bytes in 65ms
03-11 18:42:54.127: INFO/jPCT-AE(16059): VBO created for object 'o_7'
03-11 18:42:54.219: DEBUG/dalvikvm(16059): GC_FOR_MALLOC freed 17 objects / 1049168 bytes in 71ms
03-11 18:42:54.283: INFO/jPCT-AE(16059): VBO created for object 'o_6'
03-11 18:42:54.461: DEBUG/dalvikvm(16059): GC_FOR_MALLOC freed 16 objects / 1049144 bytes in 49ms
03-11 18:42:54.497: INFO/jPCT-AE(16059): VBO created for object 'o_3'
03-11 18:42:54.579: DEBUG/dalvikvm(16059): GC_FOR_MALLOC freed 16 objects / 1049144 bytes in 38ms
03-11 18:42:54.613: INFO/jPCT-AE(16059): VBO created for object 'o_21'
03-11 18:42:54.629: INFO/jPCT-AE(16059): VBO created for object 'o_9'
03-11 18:42:54.711: DEBUG/dalvikvm(16059): GC_FOR_MALLOC freed 21 objects / 1049480 bytes in 78ms
03-11 18:42:54.779: INFO/jPCT-AE(16059): VBO created for object 'o_10'
03-11 18:42:54.859: INFO/jPCT-AE(16059): VBO created for object 'p_26'
03-11 18:42:54.877: INFO/jPCT-AE(16059): VBO created for object 'm_0'
03-11 18:42:54.879: INFO/jPCT-AE(16059): VBO created for object 'm_0'
03-11 18:42:54.893: INFO/jPCT-AE(16059): VBO created for object 'o_8'
03-11 18:42:54.897: INFO/jPCT-AE(16059): VBO created for object 'b_27'
03-11 18:42:54.901: INFO/jPCT-AE(16059): VBO created for object 'b_28'
03-11 18:42:54.903: INFO/jPCT-AE(16059): new frame


Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Create VBO for object
« Reply #5 on: March 11, 2011, 10:38:33 pm »
I'm a little bit confused...what exactly is the actual problem now? The garbage collection kicking in? If yes, then i don't see how this should be related to vertex buffer objects. The method itself doesn't create any garbage except for the string that is used for logging the call, which shouldn't hurt. As said, creation of VBOs is cheap...it doesn't do anything more than declaring the native buffers that exist anyway for the geometry data as backup buffers the VBO....just a few calls to OpenGL, that's all there is. As you can see here:

Code: [Select]
03-11 18:42:52.779: INFO/jPCT-AE(16059): VBO created for object 'm_0'
03-11 18:42:52.779: INFO/jPCT-AE(16059): VBO created for object 'm_0'
03-11 18:42:52.779: INFO/jPCT-AE(16059): VBO created for object 'm_0'
03-11 18:42:52.783: INFO/jPCT-AE(16059): VBO created for object 'm_0'

It all happens within 4ms...

You might want to try to disable VBOs with Config.useVBO=false; and see if that changes anything.

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Create VBO for object
« Reply #6 on: March 11, 2011, 10:52:10 pm »
I thought that it does VBO... this is happening just for first time, after I rotate camera 360 degrees game is running smooth... so maybe uploading textures?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Create VBO for object
« Reply #7 on: March 11, 2011, 10:54:13 pm »
Might be...have to tried to call TextureManager.preWarm(<FrameBuffer>)?

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Create VBO for object
« Reply #8 on: March 11, 2011, 11:07:02 pm »
What it does? I placed it to begin and without any change and when i set it to end every object has same texture

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Create VBO for object
« Reply #9 on: March 11, 2011, 11:14:01 pm »
 ??? preWarm() forces all textures known to the texture manager to be uploaded at once instead of on demand. I don't see how it can cause all textures to look the same...then again, i don't understand what "begin" and "end" mean in this context!?

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Create VBO for object
« Reply #10 on: March 11, 2011, 11:22:54 pm »
before and after I load all textures...


Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Create VBO for object
« Reply #11 on: March 11, 2011, 11:29:09 pm »
I neither get what i'm seeing there nor what exactly you are doing there...please try to add the call to preWarm right before the first call to FrameBuffer.clear() and make sure that it's called only once (i.e. for the first frame ever being rendered).

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Create VBO for object
« Reply #12 on: March 11, 2011, 11:39:27 pm »
now it's alright, thanks :)