Jump to content

Recommended Posts

Posted

Hello!

 

I have been looking through the Forge source as well as traced in debug mode, but can't be entirely sure of the answer to the following question:

 

When an entity is being rendered, does each entity posses it's own model object, or does the renderer instantiate just one model, pose it for each entity, render and move on? The former seems unlikely to me, since every render frame all the info is basically replaced during a render event.

 

The reason for this question is that I'm going about rendering a custom Player model not by substituting the modelrenderer, but by detecting and redirecting the render event to another modelrenderer - that way I can have the legacy renderer (as well as any others that the player might be using) and, at the press of a button, it can change to mine.

 

What I need to know is if me instantiating just one ModelRenderer and one Model is okay for this kind of method, or do I need to go about this another way, such as a Map of UUID to ModelRenderer.

 

If any of this is unclear, I'll try and elaborate in further posts. Any guidance is very appreciated!

I do pony stuff :3

Posted

You should keep the models cached, because they compile themselves into a Display List. If you create a new Model every time it will create a new Display List every time, which is not good.

You also need to clean up the Display Lists when you no longer need the model. For every

ModelRenderer

in your Model you need to call

GL11.glDeleteLists(<listID>, 1);

with

<listID

being

ModelRenderer#displayList

(you will need reflection to access this field, since it is private).

 

Thank you for the reply! I'll have to look into the displayList.

 

I guess that means that for my custom Renderer (which will imitate a RenderPlayer) I only need one instance of said class? It will contain, as you said, one instance of a model (derived from ModelBiped) which will be manipulated and rendered. I just want to make super sure I'm not doing something horribly against the current flow.

I do pony stuff :3

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.