<div>Hi Ye Cong:</div><div> For instance rendering,You can see osgEarth::Drawinstance,they use uniform texture buffer instead of vertex attribute.</div><div> If you insist on using VertexAttribute,I guess you may inherit the osg::Geometry,and rewrite DrawImplement method,create a GLExtension to do this.</div><div> just like this:</div><div>   contextID = state.getContextID();</div><div>   osg::ref_ptr<osg::GLExtensions> ext = osg::GLExtensions::Get(contextID, true);</div><div>   ext->glVertexAttribPointer(blabla);</div><div>   ext->glVertexAttribPointer(blabla);</div><div><br></div><div>Finally,you can use Matrix Array uniform ,but it's a stupid way I think.</div><div><br></div><div><br></div><div><br></div><div style="font-size: 12px;font-family: Arial Narrow;padding:2px 0 2px 0;">------------------ Original ------------------</div><div style="font-size: 12px;background:#efefef;padding:8px;"><div><b>From:</b> "Cong Ye"<sirian_ye@hotmail.com>; </div><div><b>Date:</b> 2018年11月27日(星期二) 中午12:58</div><div><b>To:</b> "osg-users"<osg-users@lists.openscenegraph.org>; </div><div><b>Subject:</b> [osg-users] pass mat4 as attribute for glsl</div></div><div><br></div>Hi,<br><br>I am currently working on a project requires gpu instancing. I worked out a way to do the instancing with vec4 as position attribute in. However, in the real case, instances need to be scaled/rotated/translated. Now, I want to send the transform matrix as an attribute to the shader. Normally, general opengl uses glVertexAttribPointer with offset and glVertexAttribDivisor to sperate mat4 to vec4 then pass to the shader. However, I don't find the replacement function to do the offset data structure pass. Could someone enlighten me about it, please? <br><br>thanks very much!<br><br>... <br><br>Thank you!<br><br>Cheers,<br>Cong<br><br>------------------<br>Read this topic online here:<br><a href="http://forum.openscenegraph.org/viewtopic.php?p=75249#75249" rel="noopener" target="_blank">http://forum<wbr>.openscenegr<wbr>aph.org/view<wbr>topic.php?p=<wbr>75249#75249</a><br><br><br><br><br><br>_______________________________________________<br>osg-users mailing list<br><a href="mailto:osg-users@lists.openscenegraph.org" rel="noopener" target="_blank">osg-users@li<wbr>sts.openscen<wbr>egraph.org</a><br><a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noopener" target="_blank">http://lists<wbr>.openscenegr<wbr>aph.org/list<wbr>info.cgi/osg<wbr>-users-opens<wbr>cenegraph.or<wbr>g</a><br><style type="text/css">.qmbox style, .qmbox script, .qmbox head, .qmbox link, .qmbox meta {display: none !important;}</style>