Differences

This shows you the differences between two versions of the page.

Link to this comparison view

spg:laboratoare:02 [2023/07/28 20:38]
andrei.lambru
spg:laboratoare:02 [2023/09/29 13:39] (current)
andrei.lambru [Diferite tipuri de instanțiere]
Line 17: Line 17:
 Pentru a instanția implict geometrie, există comanda: Pentru a instanția implict geometrie, există comanda:
  
-<​code>​+<​code ​cpp>
 glDrawElementsInstanced(topologie,​ nr_indecsi, tip_data, offset, instante). glDrawElementsInstanced(topologie,​ nr_indecsi, tip_data, offset, instante).
 </​code>​ </​code>​
Line 23: Line 23:
 De exemplu, dacă aș dori să desenez de 1540 de ori (instanțe) un obiect cu 99 de indecși, format din triunghiuri din buffer-ul de indecși, legat curent la banda grafică, atunci comanda ar fi: De exemplu, dacă aș dori să desenez de 1540 de ori (instanțe) un obiect cu 99 de indecși, format din triunghiuri din buffer-ul de indecși, legat curent la banda grafică, atunci comanda ar fi:
  
-<​code>​+<​code ​cpp>
 glDrawElementsInstanced(GL_TRIANGLES,​ 99, GL_UNSIGNED_INT,​ 0, 1540); glDrawElementsInstanced(GL_TRIANGLES,​ 99, GL_UNSIGNED_INT,​ 0, 1540);
 </​code>​ </​code>​
  
 Instanțierea explicită se face în shader, generând geometrie nouă prin comenzi glsl, în acest caz prin comenzi de geometry shader: Instanțierea explicită se face în shader, generând geometrie nouă prin comenzi glsl, în acest caz prin comenzi de geometry shader:
-<​code>​+<​code ​cpp>
 gl_Position = P*V*M*vec4(p1,​ 1);​ EmitVertex();​ gl_Position = P*V*M*vec4(p1,​ 1);​ EmitVertex();​
 gl_Position = P*V*M*vec4(p2,​ 1);​ EmitVertex();​ gl_Position = P*V*M*vec4(p2,​ 1);​ EmitVertex();​
spg/laboratoare/02.1690565924.txt.gz · Last modified: 2023/07/28 20:38 by andrei.lambru
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0