pyopengl-users Mailing List for PyOpenGL (Page 52)
Brought to you by:
mcfletch
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(81) |
Oct
(41) |
Nov
(55) |
Dec
(14) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(34) |
Feb
(3) |
Mar
(16) |
Apr
(5) |
May
(10) |
Jun
(13) |
Jul
(24) |
Aug
(14) |
Sep
(14) |
Oct
(9) |
Nov
(10) |
Dec
(16) |
2003 |
Jan
(25) |
Feb
(59) |
Mar
(9) |
Apr
(21) |
May
(54) |
Jun
(4) |
Jul
(16) |
Aug
(19) |
Sep
(19) |
Oct
(15) |
Nov
(13) |
Dec
(22) |
2004 |
Jan
(19) |
Feb
(8) |
Mar
(20) |
Apr
(16) |
May
(13) |
Jun
(18) |
Jul
(18) |
Aug
(14) |
Sep
(24) |
Oct
(47) |
Nov
(20) |
Dec
(10) |
2005 |
Jan
(23) |
Feb
(31) |
Mar
(11) |
Apr
(29) |
May
(18) |
Jun
(7) |
Jul
(11) |
Aug
(12) |
Sep
(8) |
Oct
(4) |
Nov
(11) |
Dec
(7) |
2006 |
Jan
(7) |
Feb
(8) |
Mar
(15) |
Apr
(3) |
May
(8) |
Jun
(25) |
Jul
(19) |
Aug
(3) |
Sep
(17) |
Oct
(27) |
Nov
(24) |
Dec
(9) |
2007 |
Jan
(6) |
Feb
(43) |
Mar
(33) |
Apr
(8) |
May
(20) |
Jun
(11) |
Jul
(7) |
Aug
(8) |
Sep
(11) |
Oct
(22) |
Nov
(15) |
Dec
(18) |
2008 |
Jan
(14) |
Feb
(6) |
Mar
(6) |
Apr
(37) |
May
(13) |
Jun
(17) |
Jul
(22) |
Aug
(16) |
Sep
(14) |
Oct
(16) |
Nov
(29) |
Dec
(13) |
2009 |
Jan
(7) |
Feb
(25) |
Mar
(38) |
Apr
(57) |
May
(12) |
Jun
(32) |
Jul
(32) |
Aug
(35) |
Sep
(10) |
Oct
(28) |
Nov
(16) |
Dec
(49) |
2010 |
Jan
(57) |
Feb
(37) |
Mar
(22) |
Apr
(15) |
May
(45) |
Jun
(25) |
Jul
(32) |
Aug
(7) |
Sep
(13) |
Oct
(2) |
Nov
(11) |
Dec
(28) |
2011 |
Jan
(35) |
Feb
(39) |
Mar
|
Apr
(25) |
May
(32) |
Jun
(17) |
Jul
(29) |
Aug
(10) |
Sep
(26) |
Oct
(9) |
Nov
(28) |
Dec
(4) |
2012 |
Jan
(24) |
Feb
(47) |
Mar
(4) |
Apr
(8) |
May
(9) |
Jun
(6) |
Jul
(4) |
Aug
(1) |
Sep
(4) |
Oct
(28) |
Nov
(2) |
Dec
(2) |
2013 |
Jan
(11) |
Feb
(3) |
Mar
(4) |
Apr
(38) |
May
(15) |
Jun
(11) |
Jul
(15) |
Aug
(2) |
Sep
(2) |
Oct
(4) |
Nov
(3) |
Dec
(14) |
2014 |
Jan
(24) |
Feb
(31) |
Mar
(28) |
Apr
(16) |
May
(7) |
Jun
(6) |
Jul
(1) |
Aug
(10) |
Sep
(10) |
Oct
(2) |
Nov
|
Dec
|
2015 |
Jan
(6) |
Feb
(5) |
Mar
(2) |
Apr
(1) |
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
(2) |
Oct
(1) |
Nov
(19) |
Dec
|
2016 |
Jan
(6) |
Feb
(1) |
Mar
(7) |
Apr
|
May
(6) |
Jun
|
Jul
(3) |
Aug
(7) |
Sep
|
Oct
(2) |
Nov
(2) |
Dec
|
2017 |
Jan
|
Feb
(6) |
Mar
(8) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(4) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
|
2018 |
Jan
(9) |
Feb
(1) |
Mar
|
Apr
|
May
(1) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(6) |
Jun
(1) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
(7) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2021 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2024 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Mads I. <mp...@co...> - 2009-04-24 08:58:17
|
Hi, I am running an app in an PyQt QGLWidget. If the window is minimized, and the method for rendering the object that should be displayed is called, I get the error 'OpenGL.error.Error: Attempt to retrieve context when no valid context' (included below), when glColorPointerd() is called. Is there: * a way to check whether a valid context is set? * force the context to be set? Best regards, Mads glColorPointerd(colors) File "/home/mpi/svn/quantumconnect/external-libs/build/lib/python2.6/site-packages/OpenGL/wrapper.py", line 410, in wrapperCall cArgs, File "/home/mpi/svn/quantumconnect/external-libs/build/lib/python2.6/site-packages/OpenGL/arrays/arrayhelpers.py", line 66, in __call__ contextdata.setValue( self.constant, pyArgs[self.pointerIndex] ) File "/home/mpi/svn/quantumconnect/external-libs/build/lib/python2.6/site-packages/OpenGL/contextdata.py", line 49, in setValue context = getContext( context ) File "/home/mpi/svn/quantumconnect/external-libs/build/lib/python2.6/site-packages/OpenGL/contextdata.py", line 32, in getContext """Attempt to retrieve context when no valid context""" OpenGL.error.Error: Attempt to retrieve context when no valid context |
From: Gijs <in...@bs...> - 2009-04-21 08:01:43
|
Ian Mallett wrote: > The driver is: 8.552.0.0 (10/28/08). > I have gl_FragData[/n/] just for MRT purposes. Good to know about > these issues though. Why /is/ it an issue? Just to be annoying? > > Ian My guess it is a bug in the driver since other drivers have no issues with it at all (that I know of). And it wouldn't make sense either, to restrict the programmer to only use const integers to index language-specific arrays. Gijs |
From: Ian M. <geo...@gm...> - 2009-04-20 23:12:44
|
The driver is: 8.552.0.0 (10/28/08). I have gl_FragData[*n*] just for MRT purposes. Good to know about these issues though. Why *is* it an issue? Just to be annoying? Ian |
From: Gijs <in...@bs...> - 2009-04-20 17:58:52
|
Ian Mallett wrote: > Yes, this was basically what I came up with. > > The problem turns out to be that for gl_LightSource[n], n must be a > literal int or const int. I'm not sure why this could be. Ideas? > > I solved the problem by passing the light source itself to the function. > > There's a few more other problems, but it's mostly done. > > Ian I have run into a similar problem regarding indexes of arrays like these. I tried to index gl_FragColor using a variable. Something which the Mac OS X driver doesn't like at all. So I unrolled the for-loop and used const integers instead of variables. However, I only saw this problem when I was using my mac. In Windows and Linux it worked like a charm, both using the ATI 9.3 drivers. In Linux the 9.2 driver actually crashed when I used arrays like this. So I don't really know what your problem is, but it could be driver or videocard related. See if updating your drivers fixes any problems. Regards, Gijs |
From: Ian M. <geo...@gm...> - 2009-04-20 17:10:22
|
Yes, this was basically what I came up with. The problem turns out to be that for gl_LightSource[n], n must be a literal int or const int. I'm not sure why this could be. Ideas? I solved the problem by passing the light source itself to the function. There's a few more other problems, but it's mostly done. Ian |
From: Mike C. F. <mcf...@vr...> - 2009-04-20 14:10:47
|
Eric Jonas wrote: > Hello! First my apologies if this has been discussed on the list > recently, I couldn't find the relevant sf page for searching the mailing > list archives. > Don't think we've ever discussed it on-list. > I'm interested in constructing an openGL-based time series viewer for > some of our tens-of-megabyte time series data, that will work > interactively from python. Matplotlib totally fails when looking at data > of this scale, and the speed of navigation is pretty crucial. > > But I'd like to do as much as possible from python/numpy/scipy, and then > pass the loosly-processed data off to the GPU (i've done a bit of GLSL > work) for visualization. My only concern is that, with its new > ctypes-based bindings, pyopengl3 will be too slow for this sort of > application. > Actually, that's the use-case where the ctypes bindings tend to be irrelevant. There is a per-array overhead in the bindings to get the data-pointer out of the array, but once the data-pointer is retrieved it's basically just passing the value directly in to OpenGL. If you're processing huge data-arrays you're likely not going to notice the overhead of the data-pointer retrieval, as it will be swamped in the real work getting done. > ...Which brings me to the accelerator module -- do people think this > would really be necessary for this sort of app? How much work would it > be to prototype things with the existing pyopengl3 interface and then > "drop in" the accelerator module? I've not been able to find much > documentation about the shape of the eventual module. > It's intended to be an entirely transparent accelerator module. The core code already has hooks for most of the accelerator modules, so it will attempt to import from OpenGL_accelerate the various functions that are available. The basic code is already in the bzr/source packages with a script called setupaccel.py which builds the package. Mostly the intent is just to extend and debug it to eliminate significant hotspots. Usage will just be to install the accelerator module, no changes to code should be necessary. HTH, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: Eric J. <jo...@MI...> - 2009-04-20 12:51:19
|
Hello! First my apologies if this has been discussed on the list recently, I couldn't find the relevant sf page for searching the mailing list archives. I'm interested in constructing an openGL-based time series viewer for some of our tens-of-megabyte time series data, that will work interactively from python. Matplotlib totally fails when looking at data of this scale, and the speed of navigation is pretty crucial. But I'd like to do as much as possible from python/numpy/scipy, and then pass the loosly-processed data off to the GPU (i've done a bit of GLSL work) for visualization. My only concern is that, with its new ctypes-based bindings, pyopengl3 will be too slow for this sort of application. ...Which brings me to the accelerator module -- do people think this would really be necessary for this sort of app? How much work would it be to prototype things with the existing pyopengl3 interface and then "drop in" the accelerator module? I've not been able to find much documentation about the shape of the eventual module. Thanks again, I'm excited to get back to hacking OpenGL ! ...Eric |
From: Ian M. <geo...@gm...> - 2009-04-20 04:12:41
|
Yea, normal is custom defined. I'm working on a fix which works, I think. The problem was with sending variable ints to gl_LightSource[n]. |
From: Mike C. F. <mcf...@vr...> - 2009-04-20 04:09:12
|
Ian Mallett wrote: ... > But strangely, glGetInfoLogARB(...) spits out: > > > > Fragment shader(s) failed to link, vertex shader(s) linked. > Fragment Shader not supported by HW > > Needless to say, it crashes later on glUseProgramObjectARB(...) with an 'invalid operation'. Yeah, saw the same with my ATI Radeon 3650, I wound up using both glGetInfoLog and glGetProgramInfoLog and found that with both I'd normally get some description of a failure, but that the shaders would pass validation (i.e. the first programmatic indication of the error was on the invalid operation error). For OpenGLContext's shader support I wound up doing a try:except around the glUseProgram call and if there's a GL error raised I print all of the logs for all of the linked components as well as the program's logs. > These problems occur when certain functions are called in my program. Here's a function that causes such an error: > > > > float diffuse_coefficient(int lightnum) { > vec3 l = normalize(gl_LightSource[lightnum].position.xyz-vVertex); > return max(dot(normal,l),0.0); > } > > My ideas: > vVertex is a varying vec3. Could this be the problem? Doesn't look like a problem to me, I seem to recall using varying vectors in such ways many times. > is max(dot(normal,l),0.0) too much for one line? I saw something > about ALU limits. I don't know if this qualifies. I'd be surprised if that went over any limit, I've certainly written more complex calculations. Sorry I don't have more help to offer here. Might want to check that lightnum is the proper value? Also, stupid question, where'd you get "normal" there? I don't see it in my handy GLSL quickref. Is it from some outer scope (or an attribute/uniform)? HTH, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: Gijs <in...@bs...> - 2009-04-19 22:24:41
|
Ian Mallett wrote: > Hi, > > I've got a great shader library, and it's nearly done. Unfortunately, > certain custom functions have problems on ATI cards. I'm trying to > add error reporting to get useful errors about it. Unfortunately, > glGetShaderInfoLog() seems to fail. It works for me, with NVidia. > > This function: > > def CompileShader(source,shaderType): > shader = glCreateShaderObjectARB(shaderType) > glShaderSourceARB(shader,[source]) > glCompileShaderARB(shader) > return shader > > provides the "shader" that is passed as the argument to > glGetShaderInfoLog(). I have no idea what's wrong, and I really need > to have error reporting to debug this. > > Curiously, glGetInfoLogARB() seems to work fine, but it does not give > useful errors (fragment shader failed to compile successfully before > linking or some such). I tried using ctypes in ways like here > <http://www.pygame.org/wiki/GLSLExample?parent=CookBook> or here > <http://www.pygame.org/wiki/GLSL_ARB_Example?parent=CookBook>, but > they don't work for either of us. > > I need errors. Help. > > Thanks, > Ian Hey Ian, I made some error reporting code for my own stuff a while back. Maybe you can use some of it to see what is going wrong with your code. Regards, Gijs def compileShader(source, shader_type, shader_name): shader = glCreateShaderObjectARB(shader_type) glShaderSourceARB(shader, source) glCompileShaderARB(shader) status = glGetObjectParameterivARB(shader, GL_COMPILE_STATUS) if not status: printShaderLog(shader, shader_name) glDeleteObjectARB(shader) raise ValueError, 'Shader compilation failed' return shader def compileProgram(vertex_source, fragment_source, shader_name): vertex_shader = None fragment_shader = None program = glCreateProgramObjectARB() if (type(vertex_source) == str): vertex_source = [vertex_source] if (type(fragment_source) == str): fragment_source = [fragment_source] if vertex_source: vertex_shader = compileShader(vertex_source, GL_VERTEX_SHADER, shader_name) glAttachObjectARB(program, vertex_shader) if fragment_source: fragment_shader = compileShader(fragment_source, GL_FRAGMENT_SHADER, shader_name) glAttachObjectARB(program, fragment_shader) glLinkProgramARB(program) status = glGetObjectParameterivARB(program, GL_OBJECT_LINK_STATUS_ARB) if not status: print >> sys.stderr, glGetInfoLogARB(program) raise ValueError, 'Failed to link shader ('+str(shader_name)+')' glValidateProgramARB(program) status = glGetObjectParameterivARB(program, GL_OBJECT_VALIDATE_STATUS_ARB) if not status: print >> sys.stderr, glGetInfoLogARB(program) raise ValueError, 'Failed to validate shader ('+str(shader_name)+')' if vertex_shader: glDeleteObjectARB(vertex_shader) if fragment_shader: glDeleteObjectARB(fragment_shader) if glGetObjectParameterivARB(program, GL_INFO_LOG_LENGTH) > 0: print ("Info log for shader '" + str(shader_name) + "':\n" + glGetInfoLogARB(program)) return program def printShaderLog(shader, shader_name): if glGetObjectParameterivARB(shader, GL_INFO_LOG_LENGTH) > 0: log = glGetInfoLogARB(shader) print >> sys.stderr, "Problem with shader '" + shader_name + "'" print >> sys.stderr, log else: print >> sys.stderr, "Problem with shader '" + shader_name + "', but no log is available" |
From: Ian M. <geo...@gm...> - 2009-04-19 20:34:05
|
Hi, I finally got some sort of error checking working for ATI cards. The errors are weird. glGetShaderInfoLog(...) for each part of the program spits out: Vertex shader was successfully compiled to run on hardware. Fragment shader was successfully compiled to run on hardware. But strangely, glGetInfoLogARB(...) spits out: Fragment shader(s) failed to link, vertex shader(s) linked. Fragment Shader not supported by HW Needless to say, it crashes later on glUseProgramObjectARB(...) with an 'invalid operation'. These problems occur when certain functions are called in my program. Here's a function that causes such an error: float diffuse_coefficient(int lightnum) { vec3 l = normalize(gl_LightSource[lightnum].position.xyz-vVertex); return max(dot(normal,l),0.0); } My ideas: vVertex is a varying vec3. Could this be the problem? is max(dot(normal,l),0.0) too much for one line? I saw something about ALU limits. I don't know if this qualifies. Any other ideas? What's going on here? How can I make this work? Ian |
From: Ian M. <geo...@gm...> - 2009-04-19 00:44:24
|
Hi, I've got a great shader library, and it's nearly done. Unfortunately, certain custom functions have problems on ATI cards. I'm trying to add error reporting to get useful errors about it. Unfortunately, glGetShaderInfoLog() seems to fail. It works for me, with NVidia. This function: def CompileShader(source,shaderType): shader = glCreateShaderObjectARB(shaderType) glShaderSourceARB(shader,[source]) glCompileShaderARB(shader) return shader provides the "shader" that is passed as the argument to glGetShaderInfoLog(). I have no idea what's wrong, and I really need to have error reporting to debug this. Curiously, glGetInfoLogARB() seems to work fine, but it does not give useful errors (fragment shader failed to compile successfully before linking or some such). I tried using ctypes in ways like here<http://www.pygame.org/wiki/GLSLExample?parent=CookBook>or here <http://www.pygame.org/wiki/GLSL_ARB_Example?parent=CookBook>, but they don't work for either of us. I need errors. Help. Thanks, Ian |
From: Mike C. F. <mcf...@vr...> - 2009-04-15 17:55:38
|
vwf wrote: > Hello Python-OpenGL Experts, > > I keep having problems with a part of my program. This program once worked, > but stopped working after an upgrade of my system. > > Can someone help me get it running again? The problem appears in the initialisation > phase of the program, during the "prerendering" of the fonts. > > Thank you, > Frits > Hi Frits, This is a known error fixed in current BZR head, if you need the fix immediately you'll need to check out the bzr trunk. Out of curiosity, *what* is value at that point? AFAIK everything is *supposed* to have a __class__ attribute, but obviously *something* doesn't. HTH, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: vwf <vw...@vu...> - 2009-04-15 17:47:36
|
Hello Python-OpenGL Experts, I keep having problems with a part of my program. This program once worked, but stopped working after an upgrade of my system. Can someone help me get it running again? The problem appears in the initialisation phase of the program, during the "prerendering" of the fonts. Thank you, Frits mine:~/fppu/manavnew$ ./manav_01.py Traceback (most recent call last): File "./manav_01.py", line 22, in <module> from networking import * File "/home/frits/fppu/manavnew/networking.py", line 17, in <module> from constant_manav import state,scen File "/home/frits/fppu/manavnew/constant_manav.py", line 119, in <module> class cfont: File "/home/frits/fppu/manavnew/constant_manav.py", line 123, in cfont l1.build('0123456789.') File "/home/frits/fppu/manavnew/pyfont.py", line 97, in build l=self.font.getChar(c) File "/home/frits/fppu/manavnew/pyfont.py", line 127, in getChar current = self.createChar(char) File "/home/frits/fppu/manavnew/pyfont.py", line 150, in createChar list = self.textureToList( dataArray, metrics ) File "/home/frits/fppu/manavnew/pyfont.py", line 188, in textureToList raise File "/home/frits/fppu/manavnew/pyfont.py", line 183, in textureToList glDrawPixelsub( mode, array ) File "/var/lib/python-support/python2.5/OpenGL/wrapper.py", line 1273, in __call__ return self.finalise()( *args, **named ) File "/var/lib/python-support/python2.5/OpenGL/wrapper.py", line 469, in wrapperCall pyArgs = tuple( calculate_pyArgs( args )) File "/var/lib/python-support/python2.5/OpenGL/wrapper.py", line 328, in calculate_pyArgs yield converter(args[index], self, args) File "/var/lib/python-support/python2.5/OpenGL/GL/images.py", line 422, in __call__ return self.arrayType.asArray( arg ) File "/var/lib/python-support/python2.5/OpenGL/arrays/arraydatatype.py", line 55, in asArray return cls.getHandler(value).asArray( value, typeCode or cls.typeConstant ) File "/var/lib/python-support/python2.5/OpenGL/arrays/arraydatatype.py", line 25, in getHandler return cls.getHandler( value ) File "/var/lib/python-support/python2.5/OpenGL/arrays/formathandler.py", line 16, in __call__ typ = value.__class__ AttributeError: ('__class__', <OpenGL.GL.images.TypedImageInputConverter object at 0xba1150c>) The offending code: # Adapted from: # OpenGLContext 2.0.0b2 # # OpenGLContext License: # # Copyright (c) 2000-2003, Michael C. Fletcher and Contributors # All rights reserved. [...] def textureToList( self, array, metrics): # Compile Numeric Python array to a display-list # use a single texture and coordinates for texmap version # special case ' ' so that it's not rendered as an image mode = GL_LUMINANCE_ALPHA list = glGenLists (1) glNewList( list, GL_COMPILE ) try: try: if metrics.char != ' ': glDrawPixelsub( mode, array ) glBitmap( 0,0,0,0, metrics.width,0, None ) #glDisable( GL_BLEND) except Exception: glDeleteLists( list, 1 ) raise finally: glEndList() return list All on Debian Lenny (stable/5.0) python: Installed: 2.5.2-3 python-opengl: Installed: 3.0.0~c1-0 |
From: projetmbc <pro...@cl...> - 2009-04-12 08:47:20
|
Thanks a lot. Christophe. Dirk Reiners a écrit : > > Hi Christophe, > > projetmbc wrote: >> >> Where there are mathematic ( from the OpenGL's point of view) >> definitions of the different perspectives ? > > you can get the actual matrices from the manpages > (http://www.opengl.org/sdk/docs/man) or from the Redbook > (http://www.opengl.org/documentation/red_book, Appendix F), which is a > good resource to have when you're doing OpenGL anyway. > > Yours > > Dirk |
From: Dirk R. <dir...@gm...> - 2009-04-11 15:47:35
|
Hi Christophe, projetmbc wrote: > > Where there are mathematic ( from the OpenGL's point of view) > definitions of the different perspectives ? you can get the actual matrices from the manpages (http://www.opengl.org/sdk/docs/man) or from the Redbook (http://www.opengl.org/documentation/red_book, Appendix F), which is a good resource to have when you're doing OpenGL anyway. Yours Dirk |
From: projetmbc <pro...@cl...> - 2009-04-11 09:28:35
|
Thanks for the information. Finally the problem was another :-[ : GL.glEnable(GL.GL_CULL_FACE) Where there are mathematic ( from the OpenGL's point of view) definitions of the different perspectives ? Best regards and a great thanks for the help. Christophe. > Definitely recommend using a perspective matrix for your first OpenGL > programs. I use this class for perspective: > > class glLibView3D(): > def __init__(self,rect,angle,near=0.1,far=1000.0): > self.rect = list(rect) > self.angle = angle > self.near = near > self.far = far > def set_angle(self,value): > self.angle = angle > def set_near(self,value): > self.near = value > def set_far(self,value): > self.far = value > def set_view(self): > glViewport(*self.rect) > glMatrixMode(GL_PROJECTION) > glLoadIdentity() > > gluPerspective(self.angle,float(self.rect[2])/float(self.rect[3]),\ > self.near,self.far) > glMatrixMode(GL_MODELVIEW) > glLoadIdentity() > > HTH, > Ian |
From: Ian M. <geo...@gm...> - 2009-04-10 18:39:07
|
Definitely recommend using a perspective matrix for your first OpenGL programs. I use this class for perspective: class glLibView3D(): def __init__(self,rect,angle,near=0.1,far=1000.0): self.rect = list(rect) self.angle = angle self.near = near self.far = far def set_angle(self,value): self.angle = angle def set_near(self,value): self.near = value def set_far(self,value): self.far = value def set_view(self): glViewport(*self.rect) glMatrixMode(GL_PROJECTION) glLoadIdentity() gluPerspective(self.angle,float(self.rect[2])/float(self.rect[3]),\ self.near,self.far) glMatrixMode(GL_MODELVIEW) glLoadIdentity() HTH, Ian |
From: projetmbc <pro...@cl...> - 2009-04-10 15:11:35
|
I'm becoming crazy with the definition of the two last parameters of glOrtho. My problem is that I would like to a box with for example XMin=-12, XMax=12, YMin=-12, YMax=12 and ZMin=-5, ZMax=5. I do not understand how to do that simple thing such as nothing in the cube could disapear when manipulating with the mouse. My problem is not how to draw the box but to define a view such as all the box will be always entirely visible. Christophe. |
From: projetmbc <pro...@cl...> - 2009-04-09 07:36:29
|
Mike C. Fletcher a écrit : > projetmbc wrote: >> Hello, >> this is my first post on this list. I've decided to use OpenGL with >> PyQt. My first test is to draw a cartesian surface using quadrilaters. >> My problem is that when I move my scene with the mouse, sometime the >> point of view makes disappear some quadrilaters. I think that is due >> to my lake of knowledge about the definition of the view scene. How >> can I avoid this kind of problem ? >> > I'm guessing what you're seeing is the near clipping plane, which > would "cut" your quadrilaterals if they were to pass it. You can set > the near clipping plane to a reasonably small value, but if you "walk > through" your geometry then the geometry is going to get clipped. > > HTH, > Mike > Thanks, I finally decide to read OpenGL Programming Guide. Then I will be back here with "real" problems. ;-) Christophe. |
From: Mike C. F. <mcf...@vr...> - 2009-04-08 21:45:34
|
projetmbc wrote: > Hello, > this is my first post on this list. I've decided to use OpenGL with > PyQt. My first test is to draw a cartesian surface using quadrilaters. > My problem is that when I move my scene with the mouse, sometime the > point of view makes disappear some quadrilaters. I think that is due to > my lake of knowledge about the definition of the view scene. How can I > avoid this kind of problem ? > I'm guessing what you're seeing is the near clipping plane, which would "cut" your quadrilaterals if they were to pass it. You can set the near clipping plane to a reasonably small value, but if you "walk through" your geometry then the geometry is going to get clipped. HTH, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: Ivo U. <iv...@iu...> - 2009-04-08 12:51:09
|
Mike C. Fletcher wrote: > Hmm, are you saying those ints are supposed to be returned as values > from gluNurbsCurve? My manual says that it is supposed to have a void > return type. Or is this supposed to show up in a glGetError return > value? Basically I'm wondering whether these are supposed to be part of > GLU or part of the wrapper? If they are part of GLU I don't yet know > how to retrieve them. sorry for not responding earlier Mike (but better ever than never :D) No! gluNurbsCurve does not return int (it returns void). I've tracked error through (sgi) source and it goes like this: 1) *gluNurbsCurve* calls *nurbscurve* on GLUnurbs object 2) *nurbscurve* method creates knotvector object and calls *do_check_knots* function on that object 3) *do_check_knots* calls *knotvector::validate* method (which is the one I sent you) and puts the result in the status variable. If there is any error (status!=0) *do_nurbserror(status)* is called 4) *do_nurbs_error* calls *errorHandler* 5) *errorHandler* calls *postError* with appropriate GluError after this I'm not sure what comes next :( > > For now, I've added them to the wrapper and have them controlled by > OpenGL.ERROR_CHECKING, so you can turn them off when your code is no > longer producing invalid values and want to reclaim the performance. > You should be able to check out current head via: > > bzr branch lp:pyopengl > > and check that the code now catches your errors. > > Thanks for the bug report, > Mike > Ok. I'll test it this weekend have fun, -- Ivo Ugrina | Jab: gro.rebbajTAanirgui www.iugrina.com | ICQ: 47508335 ------------------------------------ baza matematickih pojmova http://baza.iugrina.com ------------------------------------ anime, manga, Japan fanzin http://yoshi.iugrina.com |
From: projetmbc <pro...@cl...> - 2009-04-08 12:31:53
|
Hello, this is my first post on this list. I've decided to use OpenGL with PyQt. My first test is to draw a cartesian surface using quadrilaters. My problem is that when I move my scene with the mouse, sometime the point of view makes disappear some quadrilaters. I think that is due to my lake of knowledge about the definition of the view scene. How can I avoid this kind of problem ? Best regards. Christophe PS : I could put herer my python code if it's necessary. |
From: Ian M. <geo...@gm...> - 2009-04-05 01:45:58
|
Thanks. The problem was that __del__() tried to call an OpenGL function (to disable the light). Going "del Light1" before exiting fixed the problem. |
From: Mike C. F. <mcf...@vr...> - 2009-04-05 01:19:18
|
Ian Mallett wrote: > Hi, > > I have code that creates an exception on exit. I can't imagine why. > > Exception exceptions.TypeError: "'NoneType' object is not callable" in > <bound method glLibLight.__del__ of <glLib.glLibLight.glLibLight > instance at 0x034B3F80>> ignored > > This error only happens on exit. Ideas? I'm gathering "glLib.glLibLight" is your code. You'll have a __del__ method on one of those objects that tries to call e.g. an OpenGL function. During interpreter shutdown the global namespaces of modules are cleared out so that every name is set to None. Your __del__ method is trying to call a function by name and the result is an attempt to call the None object. If you need to have access to a function in a __del__ method you need to arrange to be sure that function is available (e.g. by binding as an argument) or check that it is non-null before calling it, or catch the error in the __del__. Incidentally, it is generally better to use weakrefs rather than __del__ methods, as __del__ methods prevent garbage collection from operating if there is a loop in your object references. See the vbo module for an example of usage, though as I read it I realize that it's not properly handling cases where the namespace is cleared out before it's called either. (Should catch the errors to make it safe). HTH, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |