Re: Using framebuffers

Uğur Güney <[email protected]> Sat, 28 May 2016 13:10:26 -0400
Newsgroups gmane.comp.python.opengl.user
Message-ID <CALr+-4zqiKdd8q9O6v=9_R8KpTy28v_XL3tnBECTy1r83EZTzg@mail.gmail.com>
--===============2658645840308358298==
Content-Type: multipart/alternative; boundary=001a114428eeaf94260533ea1a9d

--001a114428eeaf94260533ea1a9d
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Thanks for your response and sharing your code!

I started looking at your code. You are using from OpenGL.GL.EXT extensions
by importing

from OpenGL.GL.EXT.framebuffer_object import *

I don't know what GL extensions are for in pyopengl, however, I tried to
move from non-extension version to EXT versions of GL functions.
Unfortunately, just at the beginning, calling the glGenFramebuffersEXT via

fbo =3D glGenFramebuffersEXT(1)

generates this error:

OpenGL.error.NullFunctionError: Attempt to call an undefined function
glGenFramebuffersEXT, check for bool(glGenFramebuffersEXT) before calling

Also bool(glGenFramebuffersEXT) return False,
whereas bool(glGenFramebuffers) is True.

I am using GLFW to generate the window, and my opengl version on OSX is
4.1. You are using pygame for that purpose. Do you think that might be the
source of my problem?

I wasn't able to "pip install pygame" to install pygame, hence I am
hesitant to use it. But I'll try glut and other window generation options
to see whether framebuffer's work in them, or whether EXT functions can be
called. Does this make sense?

PS:
By the way, I saw your amazing explanation on why y-axis should mean
upwards direction on your website: "Part of the problem was that Blender,
like many other modeling softwares use z  for up, which is morally wrong
(TL;DR: If y  is "up" in 2D (clue: it is), then it should also be "up" in
3D; it's demented to redefine it to mean something literally orthogonal to
its original meaning when you simply add a new coordinate)" Even though, as
a physicist, I am in the "z is up" camp, I appreciated the persuasion power
and simplicity of your argument. Also, my girlfriend agrees with you. :-)

Have a good day!
u

On Fri, May 27, 2016 at 8:44 PM, Ian Mallett <[email protected]> wrote:

> On Fri, May 27, 2016 at 5:35 PM, U=C4=9Fur G=C3=BCney <[email protected]=
m> wrote:
>
>> I am a beginner who studies OpenGL using PyOpenGL. I want to learn
>> post-processing effects and as the first step I want to be able to rende=
r a
>> scene into a FBO and then render that FBO on a quad that cover the whole
>> screen.
>>
>> The python code I am running is this:
>> https://gist.github.com/vug/2c7953d5fdf750c727af249ded3e9018 I combined
>> parts from several tutorials I found on the internet.
>>
>
>
>> I appreciate if anyone can direct me on how to render on an offscreen
>> framebuffer via PyOpenGL.
>>
>
> =E2=80=8BAs another reference, you may like to consider some of my code. =
For
> example, I wrote a Game of Life simulator
> <http://geometrian.com/programming/projects/index.php?project=3DGame%20of=
%20Life>
> that uses FBOs (it actually uses two IIRC; feedback requires ping-ponging=
).
> The code is well-abstracted and reasonably well-tested, so it should serv=
e
> as a good example.
>
> Ian=E2=80=8B
>

--001a114428eeaf94260533ea1a9d
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Thanks for your response and sharing your code!<div><br></=
div><div>I started looking at your code. You are using=C2=A0from OpenGL.GL.=
EXT extensions by importing=C2=A0</div><div><br></div><div>from OpenGL.GL.E=
XT.framebuffer_object import *</div><div><br></div><div>I don&#39;t know wh=
at GL extensions are for in pyopengl, however, I tried to move from non-ext=
ension version to EXT versions of GL functions. Unfortunately, just at the =
beginning, calling the glGenFramebuffersEXT via</div><div><br></div>fbo =3D=
 glGenFramebuffersEXT(1)<br><br><div>generates this error:<br><br>OpenGL.er=
ror.NullFunctionError: Attempt to call an undefined function glGenFramebuff=
ersEXT, check for bool(glGenFramebuffersEXT) before calling</div><div><br><=
/div><div>Also bool(glGenFramebuffersEXT) return False, whereas=C2=A0bool(g=
lGenFramebuffers) is True.</div><div><br></div><div>I am using GLFW to gene=
rate the window, and my opengl version on OSX is 4.1. You are using pygame =
for that purpose. Do you think that might be the source of my problem?=C2=
=A0</div><div><br></div><div>I wasn&#39;t able to &quot;pip install pygame&=
quot; to install pygame, hence I am hesitant to use it. But I&#39;ll try gl=
ut and other window generation options to see whether framebuffer&#39;s wor=
k in them, or whether EXT functions can be called. Does this make sense?</d=
iv><div><br></div><div>PS:</div><div>By the way, I saw your amazing explana=
tion on why y-axis should mean upwards direction on your website: &quot;Par=
t of the problem was that Blender, like many other modeling softwares use z=
 =C2=A0for up, which is morally wrong (TL;DR: If y =C2=A0is &quot;up&quot; =
in 2D (clue: it is), then it should also be &quot;up&quot; in 3D; it&#39;s =
demented to redefine it to mean something literally orthogonal to its origi=
nal meaning when you simply add a new coordinate)&quot; Even though, as a p=
hysicist, I am in the &quot;z is up&quot; camp, I appreciated the persuasio=
n power and simplicity of your argument. Also, my girlfriend agrees with yo=
u. :-)</div><div><br></div><div>Have a good day!</div><div>u</div></div><di=
v class=3D"gmail_extra"><br><div class=3D"gmail_quote">On Fri, May 27, 2016=
 at 8:44 PM, Ian Mallett <span dir=3D"ltr">&lt;<a href=3D"mailto:ian@geomet=
rian.com" target=3D"_blank">[email protected]</a>&gt;</span> wrote:<br><bl=
ockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #=
ccc solid;padding-left:1ex"><div dir=3D"ltr"><div class=3D"gmail_extra"><sp=
an class=3D"">On Fri, May 27, 2016 at 5:35 PM, U=C4=9Fur G=C3=BCney <span d=
ir=3D"ltr">&lt;<a href=3D"mailto:[email protected]" target=3D"_blank">ugu=
[email protected]</a>&gt;</span> wrote:<br></span><div class=3D"gmail_quote"=
><span class=3D""><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .=
8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">I am a be=
ginner who studies OpenGL using PyOpenGL. I want to learn post-processing e=
ffects and as the first step I want to be able to render a scene into a FBO=
 and then render that FBO on a quad that cover the whole screen.<div><br></=
div><div>The python code I am running is this:=C2=A0<a href=3D"https://gist=
.github.com/vug/2c7953d5fdf750c727af249ded3e9018" target=3D"_blank">https:/=
/gist.github.com/vug/2c7953d5fdf750c727af249ded3e9018</a> I combined parts =
from several tutorials I found on the internet.</div></div></blockquote><di=
v>=C2=A0</div></span><blockquote class=3D"gmail_quote" style=3D"margin:0 0 =
0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>I=
 appreciate if anyone can direct me on how to render on an offscreen frameb=
uffer via PyOpenGL.<br></div></div></blockquote><div><br><div class=3D"gmai=
l_default" style=3D"font-family:times new roman,serif;display:inline">=E2=
=80=8BAs another reference, you may like to consider some of my code. For e=
xample, I wrote <a href=3D"http://geometrian.com/programming/projects/index=
.php?project=3DGame%20of%20Life" target=3D"_blank">a Game of Life simulator=
</a> that uses FBOs (it actually uses two IIRC; feedback requires ping-pong=
ing). The code is well-abstracted and reasonably well-tested, so it should =
serve as a good example.<span class=3D"HOEnZb"><font color=3D"#888888"><br>=
<br></font></span></div><span class=3D"HOEnZb"><font color=3D"#888888"><div=
 class=3D"gmail_default" style=3D"font-family:times new roman,serif;display=
:inline">Ian=E2=80=8B</div></font></span></div></div></div></div>
</blockquote></div><br></div>

--001a114428eeaf94260533ea1a9d--


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

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
--===============2658645840308358298==
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

--===============2658645840308358298==--