Some question about Immediaterenderobject


I am new for three.js,but I know three.js is a great project! If I ask some stupid question,I am say sorry at begin…
Because I want to create my own batching module(for gui or 2d sprite),so I am look for some logic for render Immediaterenderobject,I has below question

1.Is RenderCallback can call multi times in one Immediaterenderobject? I look code for WebGLRenderer.renderBufferImmediate ,I think ,RenderCallback should call multi times in a Immediaterenderobject.

2.In WebGLRenderer.renderBufferImmediate,Is There have a unrelease gl buffer Issue?
var buffers = properties.get( object );

	if ( object.hasPositions && ! buffers.position ) buffers.position = _gl.createBuffer();
	if ( object.hasNormals && ! buffers.normal ) buffers.normal = _gl.createBuffer();
	if ( object.hasUvs && ! buffers.uv ) buffers.uv = _gl.createBuffer();
	if ( object.hasColors && ! buffers.color ) buffers.color = _gl.createBuffer();

in above code from WebGLRenderer.renderBufferImmediate method, when user pass a new ImmediaterenderobjectData to this method,It may create some gl buffers,but I search code for WebGLRenderer,I could not find where will release these buffers。Is am I miss something?If It dose not release gl buffers,When Immediaterenderobject created number increase(some instance may destroyed),
unrelease gl buffer will increase become a problem?

Sorry for my english,

Best regards.

  1. The render callback of an object is called each frame (so every time an instance of ImmediateRenderObject gets rendered)
  2. The instances of WebGLBuffer are cached by the renderer and are not disposed. If you removed objects, the buffers are kept inside WebGLRenderer.

If you are new to three.js, I don’t recommend to work with ImmediateRenderObject. Use the usual setup instead (so BufferGeometry, Mesh etc.). ImmediateRenderObject is only used in one example and therefore somewhat special. I guess it was introduced to enable a fast code path for objects with highly variable geometry data. But I don’t think that the performance benefits is crucial for most apps. Besides, certain features are not supported like indexed geometries or the disposal of cached buffers. And the handling is…well…not very user-friendly.

@Mugen87 Thanks
After read your reply,I give up ImmediateRenderObject.and I will keep learning BufferGeometry, Mesh ,Geometry for alternative.

Thank you!