mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-30 20:51:06 +01:00 
			
		
		
		
	ImDrawCallback_ResetRenderState, Examples: Added support for reset render state callback. (#2037, #1639, #2452)
This commit is contained in:
		
							
								
								
									
										11
									
								
								imgui.h
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								imgui.h
									
									
									
									
									
								
							| @@ -1759,11 +1759,18 @@ struct ImColor | ||||
|  | ||||
| // Draw callbacks for advanced uses. | ||||
| // NB: You most likely do NOT need to use draw callbacks just to create your own widget or customized UI rendering, | ||||
| // you can poke into the draw list for that! Draw callback may be useful for example to: A) Change your GPU render state, | ||||
| // B) render a complex 3D scene inside a UI element without an intermediate texture/render target, etc. | ||||
| // you can poke into the draw list for that! Draw callback may be useful for example to:  | ||||
| //  A) Change your GPU render state, | ||||
| //  B) render a complex 3D scene inside a UI element without an intermediate texture/render target, etc. | ||||
| // The expected behavior from your rendering function is 'if (cmd.UserCallback != NULL) { cmd.UserCallback(parent_list, cmd); } else { RenderTriangles() }' | ||||
| typedef void (*ImDrawCallback)(const ImDrawList* parent_list, const ImDrawCmd* cmd); | ||||
|  | ||||
| // Special Draw Callback value to request renderer back-end to reset the graphics/render state. | ||||
| // The renderer back-end needs to handle this special value, otherwise it will crash trying to call a function at this address. | ||||
| // This is useful for example if you submitted callbacks which you know have altered the render state and you want it to be restored. | ||||
| // It is not done by default because they are many perfectly useful way of altering render state for imgui contents (e.g. changing shader/blending settings before an Image call). | ||||
| #define ImDrawCallback_ResetRenderState     (ImDrawCallback)(-1) | ||||
|  | ||||
| // Typically, 1 command = 1 GPU draw call (unless command is a callback) | ||||
| struct ImDrawCmd | ||||
| { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user