When should we use each?
so in game stuff is almost all render. gui is like a mix of render and draw for now
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).
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?
I would say for everything you've mentioned it should be render
(apart from the PathfindingDebugRenderer
since I don't know what that is).
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.
Maybe render
for world & 3D stuff and draw
for screen & 2D stuff will be fine?
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.
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.
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.
I agree