<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi Bruno,<br>
<br>
Can you provide more information about your setup? Platform, gfx
card, osg version, etc. Have you seen and tried the osg example
osgdrawinstanced? Writing "not working" is probably too little info
for people to help you ;-)<br>
<br>
Cheers,<br>
Raymond<br>
<br>
<br>
<br>
<div class="moz-cite-prefix">On 5/22/2017 8:17 PM, Bruno Oliveira
wrote:<br>
</div>
<blockquote
cite="mid:CAO-SbSsECC9SwPt6nu1yDCuaUTjf2zWn==NBn0xBDsFh_vupfA@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>
<div>
<div>Hi,<br>
<br>
<br>
</div>
I want to render several simple quads ( a simple rectangle).
I pass the quad centers via a 2D texture, and try to render
them with the following vertex shader:<br>
<br>
<br>
<br>
"#version 120\n"<br>
"#extension GL_EXT_draw_instanced : enable\n"<br>
"\n"<br>
"uniform sampler2D texVert;\n"<br>
"uniform sampler2D texColor;\n"<br>
"uniform float texSize;\n"<br>
"\n"<br>
"void main() {\n"<br>
"\n"<br>
" float row = float(gl_InstanceID) /
texSize;\n"<br>
"\n"<br>
" vec2 uv = vec2(fract(row), floor(row) /
texSize);\n"<br>
" vec4 vert = gl_Vertex + texture2D(texVert,
uv);\n"<br>
"\n"<br>
" gl_Position = gl_ModelViewProjectionMatrix *
vert;\n"<br>
"\n"<br>
"}\n"<br>
<br>
<br>
<br>
</div>
<b>This is my code for creating 1000 quads:</b><br>
<br>
this->setUseDisplayList(false),<br>
this->setUseVertexBufferObjects(true);<br>
<br>
// Build Geometry<br>
// Simple Quad<br>
osg::ref_ptr<osg::Vec3Array> vertices = new
osg::Vec3Array(4);<br>
(*vertices)[0].set(-500, -500, 0.f );<br>
(*vertices)[1].set( 500, -500, 0.f );<br>
(*vertices)[2].set( 500, 500, 0.f );<br>
(*vertices)[3].set(-500, 500, 0.f );<br>
<br>
this->setUseDisplayList(false);<br>
this->setUseVertexBufferObjects(true);<br>
this->setVertexArray(vertices.get());<br>
this->addPrimitiveSet(new osg::DrawArrays(GL_QUADS, 0, 4,
1000));<br>
<br>
<br>
</div>
<b>IMPORTANT NOTE</b>: <b>If I use simple GL_POINTS, my code
works fine and renders correclty 1000 points:<br>
</b><br>
<br>
osg::ref_ptr<osg::Vec3Array> vertices = new
osg::Vec3Array(1);<br>
(*vertices)[0].set(0, 0, 0.f );<br>
<br>
this->setVertexArray(vertices);<br>
<br>
this->addPrimitiveSet( new osg::DrawArrays(GL_POINTS, 0,
1, 1000) );<br>
<br>
<br>
</div>
<div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2">
<br>
<br>
<hr style="border:none; color:#909090; background-color:#B0B0B0;
height: 1px; width: 99%;">
<table style="border-collapse:collapse;border:none;">
<tbody>
<tr>
<td style="border:none;padding:0px 15px 0px 8px"> <a
moz-do-not-send="true"
href="http://www.avg.com/internet-security"> <img
moz-do-not-send="true"
src="http://static.avast.com/emails/avg-mail-stamp.png"
alt="AVG logo" border="0"> </a> </td>
<td>
<p style="color:#3d4d5a;
font-family:"Calibri","Verdana","Arial","Helvetica";
font-size:12pt;"> This email has been checked for
viruses by AVG antivirus software. <br>
<a moz-do-not-send="true"
href="http://www.avg.com/internet-security">www.avg.com</a>
</p>
</td>
</tr>
</tbody>
</table>
<br>
<a moz-do-not-send="true"
href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1"
height="1"> </a></div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
osg-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a>
<a class="moz-txt-link-freetext" href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a>
</pre>
</blockquote>
<br>
</body>
</html>