glGetActiveAttrib number of params

Paul Melis <[email protected]> Fri, 7 Oct 2016 17:11:16 +0200 (CEST)
Newsgroups gmane.comp.python.opengl.user
Message-ID <[email protected]>
--===============1703801490141445669==
Content-Type: multipart/alternative; 
	boundary="----=_Part_1448284_139260685.1475853076581"

------=_Part_1448284_139260685.1475853076581
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Hi, 

With PyOpenGL 3.1.0 on Windows 8.1, Python 2.7 amd64 I get an exception in the call to glGetActiveAttrib in this piece of code: 

program = compileProgram(vertex_shader, fragment_shader) 
self.programs[name] = program 
print 'Program %d' % program 

# Get list of active uniforms 
active_uniforms = [] 
n_uniforms = glGetProgramiv(program, GL_ACTIVE_UNIFORMS) 
print '%d uniforms:' % n_uniforms 
for i in xrange(n_uniforms): 
name, size, type = glGetActiveUniform(program, i) 
# XXX could check actual type and location against what is registered 
location = glGetUniformLocation(program, name) 
print 'Uniform', name, size, type, location 
active_uniforms.append(name) 

self.active_uniforms[program] = active_uniforms 

# Get list of active attributes 
active_attributes = [] 
n_attributes = glGetProgramiv(program, GL_ACTIVE_ATTRIBUTES) 
print '%d attributes:' % n_attributes 
print glGetActiveAttrib 
for i in xrange(n_attributes): 
name, size, type = glGetActiveAttrib(program, i) 
# XXX could check actual type and location against what is registered 
location = glGetAttribLocation(program, name) 
print 'Attribute', name, size, type, location 
active_attributes.append(name) 


Relevant output: 

Program 3 
4 uniforms: 
Uniform model_view_matrix 1 35676 2 
Uniform normal_matrix 1 35675 5 
Uniform projection_matrix 1 35676 1 
Uniform view_matrix 1 35676 3 
2 attributes: 
Traceback (most recent call last): 
File "cfd_vis.py", line 589, in <module> 
shader_registery.setup_shaders_gl() 
File "d:\projects\cfd-vis-git\stuff.py", line 321, in setup_shaders_gl 
name, size, type = glGetActiveAttrib(program, i) 
File "D:\Software\Python27-amd64\lib\site-packages\OpenGL\latebind.py", line 45, in __call__ 
return self._finalCall( *args, **named ) 
File "D:\Software\Python27-amd64\lib\site-packages\OpenGL\wrapper.py", line 653, in wrapperCall 
pyArgs = tuple( calculate_pyArgs( args )) 
File "D:\Software\Python27-amd64\lib\site-packages\OpenGL\wrapper.py", line 428, in calculate_pyArgs 
args 
ValueError: glGetActiveAttrib requires 3 arguments (program, index, bufSize, length, size, type, name), received 2: (3, 0) 

I don't understand what's going wrong. glGetActiveUniform and glGetActiveAttrib have exactly the same call signature and while glGetActiveUniform() succeeds glGetActiveAttrib() fails with a message that it expects 3 paramaters instead of 2. 

Any clues? 

Regards, 
Paul 



------=_Part_1448284_139260685.1475853076581
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<html><body><div style=3D"font-family: arial, helvetica, sans-serif; font-s=
ize: 12pt; color: #000000"><div> </div><div>Hi,</div><div><br data-mce-bogu=
s=3D"1"></div><div>With PyOpenGL 3.1.0 on Windows 8.1, Python 2.7 amd64 I g=
et an exception in the call to glGetActiveAttrib&nbsp;in this&nbsp;piece of=
 code:</div><div><br data-mce-bogus=3D"1"></div><div> program =3D compilePr=
ogram(vertex_shader, fragment_shader) <br> self.programs[name] =3D program<=
br> print 'Program %d' % program<br> <br> # Get list of active uniforms<br>=
 active_uniforms =3D []<br> n_uniforms =3D glGetProgramiv(program, GL_ACTIV=
E_UNIFORMS) <br> print '%d uniforms:' % n_uniforms<br> for i in xrange(n_un=
iforms):<br>&nbsp; &nbsp; name, size, type =3D glGetActiveUniform(program, =
i)<br>&nbsp; &nbsp; # XXX could check actual type and location against what=
 is registered<br>&nbsp; &nbsp; location =3D glGetUniformLocation(program, =
name)<br>&nbsp; &nbsp; print 'Uniform', name, size, type, location<br>&nbsp=
; &nbsp; active_uniforms.append(name)<br> <br> self.active_uniforms[program=
] =3D active_uniforms<br><br> # Get list of active attributes<br> active_at=
tributes =3D []<br> n_attributes =3D glGetProgramiv(program, GL_ACTIVE_ATTR=
IBUTES) <br> print '%d attributes:' % n_attributes<br> print glGetActiveAtt=
rib<br> for i in xrange(n_attributes):<br>&nbsp; &nbsp; name, size, type =
=3D glGetActiveAttrib(program, i)<br>&nbsp; &nbsp; # XXX could check actual=
 type and location against what is registered<br>&nbsp; &nbsp; location =3D=
 glGetAttribLocation(program, name)<br>&nbsp; &nbsp; print 'Attribute', nam=
e, size, type, location<br>&nbsp; &nbsp; active_attributes.append(name)<br>=
</div><div><br data-mce-bogus=3D"1"></div><div><br data-mce-bogus=3D"1"></d=
iv><div>Relevant output:</div><div><br data-mce-bogus=3D"1"></div><div>Prog=
ram 3<br>4 uniforms:<br>Uniform model_view_matrix 1 35676 2<br>Uniform norm=
al_matrix 1 35675 5<br>Uniform projection_matrix 1 35676 1<br>Uniform view_=
matrix 1 35676 3<br>2 attributes:<br>Traceback (most recent call last):<br>=
&nbsp; File "cfd_vis.py", line 589, in &lt;module&gt;<br>&nbsp; &nbsp; shad=
er_registery.setup_shaders_gl()<br>&nbsp; File "d:\projects\cfd-vis-git\stu=
ff.py", line 321, in setup_shaders_gl<br>&nbsp; &nbsp; name, size, type =3D=
 glGetActiveAttrib(program, i)<br>&nbsp; File "D:\Software\Python27-amd64\l=
ib\site-packages\OpenGL\latebind.py", line 45, in __call__<br>&nbsp; &nbsp;=
 return self._finalCall( *args, **named )<br>&nbsp; File "D:\Software\Pytho=
n27-amd64\lib\site-packages\OpenGL\wrapper.py", line 653, in wrapperCall<br=
>&nbsp; &nbsp; pyArgs =3D tuple( calculate_pyArgs( args ))<br>&nbsp; File "=
D:\Software\Python27-amd64\lib\site-packages\OpenGL\wrapper.py", line 428, =
in calculate_pyArgs<br>&nbsp; &nbsp; args<br>ValueError: glGetActiveAttrib =
requires 3 arguments (program, index, bufSize, length, size, type, name), r=
eceived 2: (3, 0)</div><div><br data-mce-bogus=3D"1"></div><div>I don't und=
erstand what's going wrong. glGetActiveUniform and glGetActiveAttrib have e=
xactly the same call signature and while glGetActiveUniform() succeeds glGe=
tActiveAttrib() fails with a message that it expects 3 paramaters instead o=
f 2.</div><div><br data-mce-bogus=3D"1"></div><div>Any clues?</div><div><br=
 data-mce-bogus=3D"1"></div><div>Regards,</div><div>Paul</div><div><br data=
-mce-bogus=3D"1"></div><div><br></div></div></body></html>
------=_Part_1448284_139260685.1475853076581--


--===============1703801490141445669==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
--===============1703801490141445669==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
PyOpenGL Homepage
http://pyopengl.sourceforge.net
_______________________________________________
PyOpenGL-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyopengl-users

--===============1703801490141445669==--