Full screen quads

50 views
Skip to first unread message

Tom Payne

unread,
Apr 22, 2013, 6:13:51 AM4/22/13
to webgl-d...@googlegroups.com
Hi,

My WebGL app involves composing a number of full-screen layers. Each layer is drawn as two triangles that together cover the full screen.

I've just read
which says:
  "Small rendering operations are slow
GPUs are intended to be used to draw large batches of triangles at once. If you have 10,000 triangles to draw, doing it in one single operation (as WebGL allows) will be much faster than doing 10,000 separate draw operations of one triangle each. Think of a GPU as a very fast machine with a very long warm-up time. Better warm up once and do a large batch of work, than pay for the warm-up cost many times. Organizing your rendering into large batches does require some thinking, but it’s worth it."

So, my question is: instead of drawing my full screen layer as two very large triangles, would it be better to draw it as many smaller triangles?

Cheers,
Tom

--
Camptocamp SA
Tom PAYNE
PSE A
CH-1015 Lausanne

+41 21 619 10 13 (direct)
+41 21 619 10 10 (centrale)
+41 21 619 10 00 (fax)

Paul Lewis

unread,
Apr 22, 2013, 6:44:23 AM4/22/13
to webgl-d...@googlegroups.com
It shouldn't be, no. In the case you describe the warm up would be the same whether it's two large triangles or ten thousand triangles, but the actual work done by the GPU is much larger, as would the data transfer of vertex positions be. 

The point the article is trying to make is that whenever you switch state (shaders, buffers etc) that you need to consider that an expensive operation which you're looking to minimize. The typical approaches for this is to order models / objects by shader first then state. Essentially graphics developers look to minimize the number of switches that are needed.


--
You received this message because you are subscribed to the Google Groups "WebGL Dev List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webgl-dev-lis...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Paul Lewis

unread,
Apr 22, 2013, 6:48:16 AM4/22/13
to webgl-d...@googlegroups.com
Slight correction, I think the warm up would actually be longer with more triangles since you'd have more vertices to buffer in. All the other overhead would, I guess, be similar, and that's what we'd like to minimize.

Benoit Jacob

unread,
Apr 22, 2013, 7:28:29 AM4/22/13
to WebGL Dev List
I meant that if you have many triangles to draw, you are better off drawing them in few draw-calls than in many. But if you only have two triangles to draw, and you already draw them in one draw-call, then you are already optimal in this respect.

Benoit




2013/4/22 Tom Payne <tom....@camptocamp.com>

--

Tom Payne

unread,
Apr 25, 2013, 6:57:47 AM4/25/13
to webgl-d...@googlegroups.com
Many thanks for the responses Paul and Benoit.
Reply all
Reply to author
Forward
0 new messages