Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"draw" vs. "render" #984

Open
Runemoro opened this issue Nov 26, 2019 · 10 comments
Open

"draw" vs. "render" #984

Runemoro opened this issue Nov 26, 2019 · 10 comments

Comments

@Runemoro
Copy link
Contributor

When should we use each?

@liach
Copy link
Contributor

liach commented Nov 26, 2019

so in game stuff is almost all render. gui is like a mix of render and draw for now

@natanfudge
Copy link
Contributor

Rendering or image synthesis is the automatic process of generating a photorealistic or non-photorealistic image from a 2D or 3D model (or models in what collectively could be called a scene file) by means of computer programs.

Draw for simple things (rectangles, circles, buttons; text is a bit on the edge since it's not trivial).
Render for complex things/models (items, blocks, entities).

@Runemoro
Copy link
Contributor Author

But then the question is what do we consider "simple"? Is the sky rendered or drawn? Does the PathfindingDebugRenderer draw or render paths? Is a box drawn or rendered (we currently have drawBox, which calls renderQuad!)? Is text rendered or drawn?

@natanfudge
Copy link
Contributor

I would say for everything you've mentioned it should be render (apart from the PathfindingDebugRenderer since I don't know what that is).

@Sollace
Copy link
Contributor

Sollace commented Dec 12, 2019

I use render and draw interchangeably as synonyms. Usually render is for more involved processes whilst draw is a blunt edge.

In places I have used render for public-facing methods and draw for the internal/supporting/general-use util methods as well though.

@DreenDex
Copy link
Contributor

Maybe render for world & 3D stuff and draw for screen & 2D stuff will be fine?

@liach
Copy link
Contributor

liach commented Jun 21, 2020

Agree, draw for 2d and render for 3d. e.g. drawTexturedRect (mojang called it blit, a 2d operation, before) is 2d, and renderEntity is 3d.

@Prospector
Copy link
Contributor

IMO draw is the basic stuff and rendering is when you put a bunch of draws together. For example, you draw a line, or draw a texture, or draw text. But you render a model.

@liach
Copy link
Contributor

liach commented Jun 21, 2020

How about a piece of text? should it be draw or render string?

Imo the distinguishing feature for 2d and 3d is the matrix transformation. If there is no transformation involved in one step, I'd call that step and its components "draw"; if there is transformation, I'd call it "render".

For instance, if we draw a string that is the name of an entity, we call it drawing a name. But if we goes to upper level and see how the name is affected by the transforms of the entity or be occluded, we call it rendering a name plate.

@Prospector
Copy link
Contributor

I agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants