pyopengl-users Mailing List for PyOpenGL (Page 66)
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: vwf <vw...@vu...> - 2007-10-16 08:09:51
|
Hello, Is there any documentation on the use of pygamefont? Thanks, F |
From: vwf <vw...@vu...> - 2007-10-11 08:43:57
|
Hello, I have a rather old problem that fails to work after upgrading. The problem is that font-rendering does not work correctly. The result looks like the a television that lost horizontal sync. I think I use old code, but I don't know what is wrong. I include a small programme that works, but displays incorrectly (it is a Q&D cut from my real programme). Any suggestions, or a pointer to an example I can use? Thanks, F. #!/usr/bin/env python2.4 # -*- coding: utf8 -*- from OpenGL.GL import * from OpenGL.GLUT import * from OpenGL.GLU import * from pygamefont import * import sys ESCAPE = '\033' window = 0 n=0 def InitGL(Width, Height): global v,l1 glShadeModel(GL_SMOOTH) glClearColor(0.0, 0.0, 0.0, 0.5) glClearDepth(1.0) glEnable(GL_DEPTH_TEST) glDepthFunc(GL_LEQUAL) glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST) v=PyGameBitmapFont('verdana.ttf',100) l1=Line(v) l1.build('1') def ReSizeGLScene(Width, Height): if Height == 0: Height = 1 glViewport(0, 0, Width, Height) glMatrixMode(GL_PROJECTION) glLoadIdentity() glMatrixMode(GL_MODELVIEW) glLoadIdentity() def DrawGLScene(): global n n+=1 glColor3d(0,1,0) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glLoadIdentity() glTranslatef (0.0, 0.0, -1.0) glRasterPos2f(0,0) l1.build(str(n)) atextLeft( l1, (-0.9,-0.4)) glutSwapBuffers() return True def keyPressed(*args): global window # If escape is pressed, kill everything. if args[0] == ESCAPE: sys.exit () def main(): global window glutInit(sys.argv) glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH) glutInitWindowSize(300, 100) glutInitWindowPosition(0, 0) window = glutCreateWindow("OpenGL PyGame font-tester") glutDisplayFunc(DrawGLScene) glutIdleFunc(DrawGLScene) glutReshapeFunc(ReSizeGLScene) glutKeyboardFunc(keyPressed) InitGL(300, 100) glutMainLoop() print "Hit ESC key to quit." main() |
From: Mike C. F. <mcf...@vr...> - 2007-10-09 12:44:26
|
V. Armando Sole wrote: ... > Just adding the code below to the previously submitted file > illustrates the problem. I send the file as attachment but it is just > to avoid problems because it is the same file as before. (Just click > on the displayed widget) With the latest CVS version, on clicking I get: mcfletch@raistlin:~/OpenGL-dev/OpenGL-ctypes/OpenGL/tests$ python glreadpixelsubformat.py 1 received uint8 Color = [[[128 128 128 255]]] ... > if color.dtype == 'int8': > print "WARNING: int8 received" > color = color.astype(numpy.uint8) > else: > print "received %s" % color.dtype > print "Color = ", color which suggests that the problem has been fixed between the last release and now. I'm planning to do a beta-1 release this week, incidentally. Good luck, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: V. A. S. <so...@es...> - 2007-10-09 06:43:30
|
Hello, Thank you for your continued PyOpenGL development and support. It is really great. At 22:36 08/10/2007 -0400, Mike C. Fletcher wrote: >I'm using glReadPixelsub in the readpixelleak test in OpenGLContext and >the result is coming back as a uint8 array there. Sorry to be a pain, but >have you got a bit of code where I could see the failure Just adding the code below to the previously submitted file illustrates the problem. I send the file as attachment but it is just to avoid problems because it is the same file as before. (Just click on the displayed widget) def mousePressEvent(self, event): self.lastPos = qt.QPoint(event.pos()) #get the color x = self.lastPos.x() y = self.lastPos.y() y = self.height()- y self.makeCurrent() color = GL.glReadPixelsub(x, y, 1, 1, GL.GL_RGBA) #workaround a PyOpenGL bug if color.dtype == 'int8': print "WARNING: int8 received" color = color.astype(numpy.uint8) else: print "received %s" % color.dtype print "Color = ", color (Well, actually is not needed to use that PyQt specific approach, just adding the lines below to the end of the paintGL method is enough): color = GL.glReadPixelsub(0, 0, 1, 1, GL.GL_RGBA) if color.dtype == 'int8': print "WARNING: int8 received" >(it's pretty easy to fire up pdb and trace through the wrappers to see >where something goes wrong with the 3.x version) After all your effort to convert PyOpenGL to ctypes I guess I will have to learn to use pdb ... :) Best regards, Armando |
From: Mike C. F. <mcf...@vr...> - 2007-10-09 02:49:41
|
Jason Ward wrote: > Hi I am trying to call glDrawPixels but it doesn't seem to be working. > I say: > from numpy import arange > pixels = arange( float( 1024*768*3 )) > for j in range(1024*768*3): > pixels[j]=float(1) > > #Normal opengl setup code etc > glDrawPixels(1024,768,GL_RGB,GL_FLOAT,pixels) > > # I am using a 1D array that will be organised in the right fashion, > but IDLE keeps crashing with this line of code I've attached a simple sample of usage for glDrawPixels. Without seeing the actual failing code I can't be sure what's going wrong, but the likely cause is failing to set up the pixel transfer mode (which can result in trying to read more data than is allowed, causing a protection fault). HTH, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: Mike C. F. <mcf...@vr...> - 2007-10-09 02:36:10
|
so...@es... wrote: > Hello, > > Quoting "Mike C. Fletcher" <mcf...@vr...>: > > >> ... Can you produce a minimal test that shows >> the error occurring? The system *should* be able to convert from double >> to float (as shown with this test). Could be that it's some bug I don't >> recall fixing, but that doesn't seem likely. >> >> > > I send you a file showing the problem. > > python OpenGLTest.py 0 uses float32 > python OpenGLTest.py 1 uses float64 and crashes > python OpenGLTest.py 2 uses float64 and glColorPointerd and does not crash. > > My platform is windows XP. The problem is present on Python 2.4 and Python 2.5 > The problem was actually in the caching of the temporary array. Under the covers, PyOpenGL has to retain a copy of the copied array in order to prevent it going out of scope and causing crashes. There was a bug in the code that stores the copy, so that it was recording based on the array data-type (e.g. float) rather than the array role (e.g. vertex array). So if you used two arrays that both had to be converted and both were of the same final type, you'd overwrite the one array with the next and wind up with a crash when you tried to access the data in the first array. This patch seems to fix the issue: Index: OpenGL/GL/pointers.py =================================================================== RCS file: /cvsroot/pyopengl/OpenGL-ctypes/OpenGL/GL/pointers.py,v retrieving revision 1.22 diff -C3 -r1.22 pointers.py *** OpenGL/GL/pointers.py 8 Feb 2007 02:24:40 -0000 1.22 --- OpenGL/GL/pointers.py 9 Oct 2007 02:13:50 -0000 *************** *** 105,120 **** function= wrapper.wrapper( baseFunction ) assert not getattr( function, 'pyConverters', None ), """Reusing wrappers?""" if arrayType: ! arrayType = arrays.GL_CONSTANT_TO_ARRAY_TYPE[ glType ] ! function.setPyConverter( 'pointer', arrays.asArrayType(arrayType) ) ! function.setCResolver( 'pointer', arrayType.voidDataPointer ) else: function.setPyConverter( 'pointer', arrays.AsArrayOfType('pointer','type') ) function.setCResolver( 'pointer', arrays.ArrayDatatype.voidDataPointer ) function.setCConverter( 'pointer', converters.getPyArgsName( 'pointer' ) ) if 'size' in function.argNames: function.setPyConverter( 'size' ) ! function.setCConverter( 'size', arrays.arraySizeOfFirstType(arrayType,defaultSize) ) if 'type' in function.argNames: function.setPyConverter( 'type' ) function.setCConverter( 'type', glType ) --- 105,120 ---- function= wrapper.wrapper( baseFunction ) assert not getattr( function, 'pyConverters', None ), """Reusing wrappers?""" if arrayType: ! arrayModuleType = arrays.GL_CONSTANT_TO_ARRAY_TYPE[ glType ] ! function.setPyConverter( 'pointer', arrays.asArrayType(arrayModuleType) ) ! function.setCResolver( 'pointer', arrayModuleType.voidDataPointer ) else: function.setPyConverter( 'pointer', arrays.AsArrayOfType('pointer','type') ) function.setCResolver( 'pointer', arrays.ArrayDatatype.voidDataPointer ) function.setCConverter( 'pointer', converters.getPyArgsName( 'pointer' ) ) if 'size' in function.argNames: function.setPyConverter( 'size' ) ! function.setCConverter( 'size', arrays.arraySizeOfFirstType(arrayModuleType,defaultSize) ) if 'type' in function.argNames: function.setPyConverter( 'type' ) function.setCConverter( 'type', glType ) > BTW, glReadPixelsub(x, y, 1, 1, GL_RGBA) returns 'int8' instead of 'uint8' and I > am forced to implement things like: > > color = GL.glReadPixelsub(x, y, 1, 1, GL.GL_RGBA) > #workaround a PyOpenGL bug? > if color.dtype == 'int8': > color = color.astype(numpy.uint8) I'm using glReadPixelsub in the readpixelleak test in OpenGLContext and the result is coming back as a uint8 array there. Sorry to be a pain, but have you got a bit of code where I could see the failure (it's pretty easy to fire up pdb and trace through the wrappers to see where something goes wrong with the 3.x version)? HTH, and thanks for the bug report, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: <so...@es...> - 2007-10-08 21:18:06
|
Hello, Quoting "Mike C. Fletcher" <mcf...@vr...>: > ... Can you produce a minimal test that shows > the error occurring? The system *should* be able to convert from double > to float (as shown with this test). Could be that it's some bug I don't > recall fixing, but that doesn't seem likely. > I send you a file showing the problem. python OpenGLTest.py 0 uses float32 python OpenGLTest.py 1 uses float64 and crashes python OpenGLTest.py 2 uses float64 and glColorPointerd and does not crash. My platform is windows XP. The problem is present on Python 2.4 and Python 2.5 BTW, glReadPixelsub(x, y, 1, 1, GL_RGBA) returns 'int8' instead of 'uint8' and I am forced to implement things like: color = GL.glReadPixelsub(x, y, 1, 1, GL.GL_RGBA) #workaround a PyOpenGL bug? if color.dtype == 'int8': color = color.astype(numpy.uint8) Best regards, Armando ------------------------------------------------- This mail sent through IMP: http://horde.org/imp/ |
From: Mike C. F. <mcf...@vr...> - 2007-10-08 17:24:39
|
Meghna Lowalekar wrote: > Hi, > I have a program which was working in in fedora core 3 and 4. > Now I have installed Fedora core 7(python 2.5) and PyOpenGL-3.0.0a6. The > same program is giving segmentation fault. The part of the code is pasted > below. > Python 2.5 on Gentoo is what I use to develop the system, and is basically the primary deployment target at this point. With current CVS I'm not seeing any failures with a test case in OpenGL-ctypes/OpenGL/tests/test_glutinit.py which is the code you've give (plus some stuff to make it actually do something). Not sure what to suggest. Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: Mike C. F. <mcf...@vr...> - 2007-10-08 17:10:34
|
V. Armando Sole wrote: ... > The following code was working fine on PyOpenGL 2.0.1.09: > > GL.glVertexPointerf(self.vertices) > GL.glColorPointerf(self.vertexColors) > GL.glEnableClientState(GL.GL_VERTEX_ARRAY) > GL.glEnableClientState(GL.GL_COLOR_ARRAY) > GL.glDrawArrays(GL.GL_POINTS, 0, xsize*ysize) > ... > Just changing glColorPointerf(self.vertexColors) by > glColorPointerd(self.vertexColors) solved my problem. > Okay, that's weird. I've just written a test like so (against current CVS): def test_numpyConversion( self ): """Test that we can run a numpy conversion from double to float for glColorArray""" import numpy a = numpy.arange( 0,1.2, .1, 'd' ).reshape( (-1,3 )) glEnableClientState(GL_VERTEX_ARRAY) glColorPointerf( a ) glColorPointerd( a ) and it produced no errors. Can you produce a minimal test that shows the error occurring? The system *should* be able to convert from double to float (as shown with this test). Could be that it's some bug I don't recall fixing, but that doesn't seem likely. Good luck, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: V. A. S. <so...@es...> - 2007-10-05 07:40:58
|
Hello again, PROBLEM The following code was working fine on PyOpenGL 2.0.1.09: GL.glVertexPointerf(self.vertices) GL.glColorPointerf(self.vertexColors) GL.glEnableClientState(GL.GL_VERTEX_ARRAY) GL.glEnableClientState(GL.GL_COLOR_ARRAY) GL.glDrawArrays(GL.GL_POINTS, 0, xsize*ysize) but now it does not work under PyOpenGL 3.0.0.a6: WindowsError: exception: access violation reading 0x0BD20028 If instead of using glDrawArrays, I loop for all the vertices and colors, the program works (of course very slowly): GL.glBegin(GL.GL_POINTS) for i in range(xsize * ysize): GL.glColor4fv(self.vertexColors[i]) GL.glVertex(self.vertices[i]) GL.glEnd() SOLUTION I set a white color with glColor3ub(255, 255, 255) and removed the glEnableClientState(GL_COLOR_ARRAY) and I got my image plotted. I checked the type of my arrays and found out they were float64 (and not float32). It seems glVertexPointerf and glColor4fv convert doubles to floats and nothing happens but glColorPointerf is unable to do it. Just changing glColorPointerf(self.vertexColors) by glColorPointerd(self.vertexColors) solved my problem. I prefer to have the things forced and to avoid automatic transformations, but I would have preferred a clearer error message :-) Thanks for your time, Armando |
From: V. A. S. <so...@es...> - 2007-10-04 09:47:05
|
Hello, The following code was working fine on PyOpenGL 2.0.1.09: GL.glVertexPointerf(self.vertices) GL.glColorPointerf(self.vertexColors) GL.glEnableClientState(GL.GL_VERTEX_ARRAY) GL.glEnableClientState(GL.GL_COLOR_ARRAY) GL.glDrawArrays(GL.GL_POINTS, 0, xsize*ysize) but now it does not work under PyOpenGL 3.0.0.a6: WindowsError: exception: access violation reading 0x0BD20028 If instead of using glDrawArrays, I loop for all the vertices and colors, the program works (of course very slowly): GL.glBegin(GL.GL_POINTS) for i in range(xsize * ysize): GL.glColor4fv(self.vertexColors[i]) GL.glVertex(self.vertices[i]) GL.glEnd() (by the way I also had to change from glVertexf to glVertex in order to get the loop working). The shape of my arrays are (xsize*ysize, 3) for the vertices and (xsize*ysize, 4) for the colors. Do I have to arrange my data in other way now? I have tried to use glVertextPointer and glColorPointer but either it did not work or (most likely) I could not figure out the proper parameter to be passed. Any hint? Thanks, Armando |
From: altern <al...@gm...> - 2007-10-02 14:54:08
|
I think this is correct now (i am not very good at 3D). you were not setting the perspective. you also have to translate in the z axis before drawing to make sure the sphere is with the area rendered. from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * from math import * def display(): global obj1 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) materialColor = [0.1745, 0.0, 0.1, 0.0] #the light scattered off the environment diffuseColor = [0.1, 0.0, 0.6, 0.0] #the light rays coming directly from source specularColor = [0.7, 0.6, 0.8, 0.0] #the light reflected off a shiny surface shininess = 80 glMaterialfv(GL_FRONT, GL_AMBIENT, materialColor) glMaterialfv(GL_FRONT, GL_DIFFUSE, diffuseColor) glMaterialfv(GL_FRONT, GL_SPECULAR,specularColor) glMaterialf(GL_FRONT, GL_SHININESS, shininess) glPushMatrix() ########################## glTranslated(0.0,0.0,-11.0) # translate in the Z axix before drawing ########################## gluSphere(obj1, 3.0, 50, 50) glPopMatrix() glFlush() #glutSwapBuffers() def init(): glClearColor(0, 0, 0, 0) glMatrixMode(GL_PROJECTION) glLoadIdentity() ########################## gluPerspective(45.0, 250/250, 0.1, 10.0) # set perspective ########################## glLightfv(GL_LIGHT0, GL_AMBIENT, [0.0, 0.0, 0.0, 1.0]) glLightfv(GL_LIGHT0, GL_DIFFUSE, [1.0, 1.0, 1.0, 1.0]) glLightfv(GL_LIGHT0, GL_POSITION, [0.0, 3.0, 3.0, 0.0]) glLightModelfv(GL_LIGHT_MODEL_AMBIENT, [0.2, 0.2, 0.2, 1.0]) glEnable(GL_LIGHTING) glEnable(GL_LIGHT0) if __name__ == "__main__": global obj1 obj1 = gluNewQuadric() glutInit([]) glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB) glutInitWindowSize(250, 250) glutCreateWindow('Hello GLUT') #glutSetDisplayFuncCall(display) glutDisplayFunc(display) #gluQuadricDrawStyle(obj1, GLU_FILL) init() glutMainLoop() Eric Germaneau(e)k dio: > PyOpenGL users, > > Does someone can tell me why the following code does not work? > I only get black screen? > Thanks in advance!! > > Eric. > > > *from OpenGL.GL import * > from OpenGL.GLU import * > from OpenGL.GLUT import * > from math import * > > > def display(): > > global obj1 > glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) > > materialColor = [0.1745, 0.0, 0.1, 0.0] #the light scattered off the > environment > diffuseColor = [0.1, 0.0, 0.6, 0.0] #the light rays coming directly > from source > specularColor = [0.7, 0.6, 0.8, 0.0] #the light reflected off a shiny > surface > shininess = 80 > > glMaterialfv(GL_FRONT, GL_AMBIENT, materialColor) > glMaterialfv(GL_FRONT, GL_DIFFUSE, diffuseColor) > glMaterialfv(GL_FRONT, GL_SPECULAR,specularColor) > glMaterialf(GL_FRONT, GL_SHININESS, shininess) > > glPushMatrix() > glTranslated(0.0,0.0,0.0) > gluSphere(obj1, 3.0, 50, 50) > glPopMatrix() > > glFlush() > #glutSwapBuffers() > > > def init(): > glClearColor(0, 0, 0, 0) > glMatrixMode(GL_PROJECTION) > glLoadIdentity() > glLightfv(GL_LIGHT0, GL_AMBIENT, > [0.0, 0.0, 0.0, 1.0]) > glLightfv(GL_LIGHT0, GL_DIFFUSE, > [1.0, 1.0, 1.0, 1.0]) > glLightfv(GL_LIGHT0, GL_POSITION, > [0.0, 3.0, 3.0, 0.0]) > glLightModelfv(GL_LIGHT_MODEL_AMBIENT, > [0.2, 0.2, 0.2, 1.0]) > glEnable(GL_LIGHTING) > glEnable(GL_LIGHT0) > > if __name__ == "__main__": > > global obj1 > > obj1 = gluNewQuadric() > > glutInit([]) > glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB) > glutInitWindowSize(250, 250) > glutCreateWindow('Hello GLUT') > #glutSetDisplayFuncCall(display) > glutDisplayFunc(display) > #gluQuadricDrawStyle(obj1, GLU_FILL) > init() > glutMainLoop()* > > > -- > / "Love, Gift from Life, is given naturally." > / > Eric Germaneau <http://lcr.epfl.ch/page37437.html> > Ecole polytechnique fédérale de Lausanne (EPFL) > FSB - IPMC > Laboratoire de Cristallographie(LCr) <http://lcr.epfl.ch> > BSP 518 > CH-1015 Lausanne > Switzerland > eri...@ep... <mailto:eri...@ep...> > /Tel./: +41 (0)21 / 693 06 36 > /Fax./: +41 (0)21 / 693 05 04 > /msn/: ai...@ho... <mailto:ai...@ho...> > /skype/: aihaike > > / Please consider the environment before printing this email - > Considérez svp l'environnement avant d'imprimer cet email / > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > > ------------------------------------------------------------------------ > > _______________________________________________ > PyOpenGL Homepage > http://pyopengl.sourceforge.net > _______________________________________________ > PyOpenGL-Users mailing list > PyO...@li... > https://lists.sourceforge.net/lists/listinfo/pyopengl-users |
From: Eric G. <eri...@ep...> - 2007-10-02 12:38:30
|
PyOpenGL users, Does someone can tell me why the following code does not work? I only get black screen? Thanks in advance!! Eric. *from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * from math import * def display(): global obj1 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) materialColor = [0.1745, 0.0, 0.1, 0.0] #the light scattered off the environment diffuseColor = [0.1, 0.0, 0.6, 0.0] #the light rays coming directly from source specularColor = [0.7, 0.6, 0.8, 0.0] #the light reflected off a shiny surface shininess = 80 glMaterialfv(GL_FRONT, GL_AMBIENT, materialColor) glMaterialfv(GL_FRONT, GL_DIFFUSE, diffuseColor) glMaterialfv(GL_FRONT, GL_SPECULAR,specularColor) glMaterialf(GL_FRONT, GL_SHININESS, shininess) glPushMatrix() glTranslated(0.0,0.0,0.0) gluSphere(obj1, 3.0, 50, 50) glPopMatrix() glFlush() #glutSwapBuffers() def init(): glClearColor(0, 0, 0, 0) glMatrixMode(GL_PROJECTION) glLoadIdentity() glLightfv(GL_LIGHT0, GL_AMBIENT, [0.0, 0.0, 0.0, 1.0]) glLightfv(GL_LIGHT0, GL_DIFFUSE, [1.0, 1.0, 1.0, 1.0]) glLightfv(GL_LIGHT0, GL_POSITION, [0.0, 3.0, 3.0, 0.0]) glLightModelfv(GL_LIGHT_MODEL_AMBIENT, [0.2, 0.2, 0.2, 1.0]) glEnable(GL_LIGHTING) glEnable(GL_LIGHT0) if __name__ == "__main__": global obj1 obj1 = gluNewQuadric() glutInit([]) glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB) glutInitWindowSize(250, 250) glutCreateWindow('Hello GLUT') #glutSetDisplayFuncCall(display) glutDisplayFunc(display) #gluQuadricDrawStyle(obj1, GLU_FILL) init() glutMainLoop()* -- / "Love, Gift from Life, is given naturally." / Eric Germaneau <http://lcr.epfl.ch/page37437.html> Ecole polytechnique fédérale de Lausanne (EPFL) FSB - IPMC Laboratoire de Cristallographie(LCr) <http://lcr.epfl.ch> BSP 518 CH-1015 Lausanne Switzerland eri...@ep... <mailto:eri...@ep...> /Tel./: +41 (0)21 / 693 06 36 /Fax./: +41 (0)21 / 693 05 04 /msn/: ai...@ho... /skype/: aihaike /Please consider the environment before printing this email - Considérez svp l'environnement avant d'imprimer cet email/ |
From: Eric G. <eri...@ep...> - 2007-10-02 07:03:34
|
from OpenGL.GL import * from OpenGL.GLUT import * from OpenGL.Tk import * from math import * import Pmw def display(canvas): glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) materialColor = (0.0,0.05,0.05,0.0) #the light scattered off the environment diffuseColor = (0.4,0.5,0.5,1.0) #the light rays coming directly from source specularColor = (0.04,0.7,0.7,0.0) #the light reflected off a shiny surface shininess = .078125 glMaterialfv(GL_FRONT, GL_AMBIENT, materialColor) glMaterialfv(GL_FRONT, GL_DIFFUSE, diffuseColor) glMaterialfv(GL_FRONT, GL_SPECULAR,specularColor) glMaterialf(GL_FRONT, GL_SHININESS, shininess) glPushMatrix() glTranslated(points[0][0],points[0][1],points[0][2]) gluSphere(obj, 3.0, 50, 50); glPopMatrix() glPushMatrix() glTranslated(points[1][0],points[1][1],points[1][2]) gluSphere(obj, 3.0, 50, 50); glPopMatrix() vx = points[1][0] - points[0][0] vy = points[1][1] - points[0][2] vz = points[1][2] - points[0][2] v = sqrt( (vx*vx) + (vy*vy) + (vz*vz) ) ax = (180.0/pi)*acos( vz/v ) if ( vz <= 0.0 ): ax = -ax rx = -vy*vz ry = +vx*vz glPushMatrix() glTranslated(points[0][0],points[0][1],points[0][2]) glRotated(ax, rx, ry, 0.0) gluCylinder(obj,1.0,1.0,v,50,50) glPopMatrix() glFlush() def animate(canvas): global points while 1: for n in range(1,20+1): points[1][0] = 2 * points[1][0] * cos(2*pi*n/20) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) materialColor = (0.0,0.05,0.05,0.0) #the light scattered off the environment diffuseColor = (0.4,0.5,0.5,1.0) #the light rays coming directly from source specularColor = (0.04,0.7,0.7,0.0) #the light reflected off a shiny surface shininess = .078125 glMaterialfv(GL_FRONT, GL_AMBIENT, materialColor) glMaterialfv(GL_FRONT, GL_DIFFUSE, diffuseColor) glMaterialfv(GL_FRONT, GL_SPECULAR,specularColor) glMaterialf(GL_FRONT, GL_SHININESS, shininess) glPushMatrix() glTranslated(points[0][0],points[0][1],points[0][2]) gluSphere(obj, 3.0, 50, 50); glPopMatrix() glPushMatrix() glTranslated(points[1][0],points[1][1],points[1][2]) gluSphere(obj, 3.0, 50, 50); glPopMatrix() vx = points[1][0] - points[0][0] vy = points[1][1] - points[0][2] vz = points[1][2] - points[0][2] v = sqrt( (vx*vx) + (vy*vy) + (vz*vz) ) ax = (180.0/pi)*acos( vz/v ) if ( vz <= 0.0 ): ax = -ax rx = -vy*vz ry = +vx*vz glPushMatrix() glTranslated(points[0][0],points[0][1],points[0][2]) glRotated(ax, rx, ry, 0.0) gluCylinder(obj,1.0,1.0,v,50,50) glPopMatrix() canvas.after(200,glFlush()) def run(): canvas.redraw = animate if __name__ == "__main__": obj = gluNewQuadric() canvas = Opengl(width = 250, height = 250, double = 1) points = [[-1.0,1.0,1.0],[2.0,1.0,10.0]] canvas.redraw = display canvas.pack(side = 'top', expand = 1, fill = 'both') root = Pmw.initialise() b1 = Pmw.ButtonBox(root,labelpos = 'nw',label_text = '',frame_borderwidth = 2,frame_relief = 'groove') b1.pack(padx = 10, pady = 10) b1.add('Quit', command = quit) b1.add('Animate',command = run) canvas.mainloop() |
From: Meghna L. <me...@st...> - 2007-10-01 11:03:06
|
Hi, I have a program which was working in in fedora core 3 and 4. Now I have installed Fedora core 7(python 2.5) and PyOpenGL-3.0.0a6. The same program is giving segmentation fault. The part of the code is pasted below. from OpenGL.GL import * from OpenGL.GLUT import * from OpenGL.GLU import * glutInit([]) glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH) glutInitWindowSize(resX, resY) glutInitWindowPosition(0, 0) No error is coming But it gives segmentation fault. The same code is running properly on fedora core4(python2.4) Is there any problem in using pyopengl with python2.5 ? Please suggest what should i do. Regards Meghna Lowalekar |
From: Meghna L. <meg...@gm...> - 2007-10-01 08:19:07
|
Hi I have a program which was working in in fedora core 3 and 4. Now I have installed Fedora core 7(python 2.5) and PyOpenGL-3.0.0a6. The same program is giving segmentation fault. The part of the code is pasted below. from OpenGL.GL import * from OpenGL.GLUT import * from OpenGL.GLU import * glutInit([]) glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH) glutInitWindowSize(resX, resY) glutInitWindowPosition(0, 0) No error is coming But it gives segmentation fault. The same code is running properly on fedora core4(python2.4) Is there any problem in using pyopengl with python2.5 ? Please suggest what should i do. Regards Meghna Lowalekar |
From: Meghna L. <meg...@gm...> - 2007-10-01 08:08:20
|
Hi I have a program which was working in in fedora core 3 and 4. Now I have installed Fedora core 7(python 2.5) and PyOpenGL-3.0.0a6. The same program is giving segmentation fault. The part of the code is pasted below. from OpenGL.GL import * from OpenGL.GLUT import * from OpenGL.GLU import * glutInit([]) glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH) glutInitWindowSize(resX, resY) glutInitWindowPosition(0, 0) No error is coming But it gives segmentation fault. The same code is running properly on fedora core4(python2.4) Is there any problem in using pyopengl with python2.5 ? Please suggest what should i do. Regards Meghna Lowalekar |
From: altern <al...@gm...> - 2007-09-28 07:34:27
|
hi eric as you notice opengl does not include itself the idea of classes, it is based on the concept of "state machine". But you can create your own classes that wrap the opengl commands. However as mike points there is a lot of work done on top of opengl. enrike Mike C. Fletcher(e)k dio: > Eric Germaneau wrote: >> Hello, >> >> On the web one can find example about making a sphere. >> But I've not found yet an example which use the notion of class. >> Is it possible to use oriented object programming with PyOpenGL (or >> OpenGL)? >> If yes, I'm looking for an example which display spheres and >> cylinders. I'm planned to display molecules .... >> Thanks in advance, > Sounds like what you want is a scenegraph engine. There are quite a few > of them available in Python, including OpenGLContext (my own). You can > find pointers to the one's I'm aware of here: > > http://www.vrplumber.com/py3d.py?category=retained > > HTH, > Mike > |
From: Mike C. F. <mcf...@vr...> - 2007-09-27 17:28:14
|
Eric Germaneau wrote: > Hello, > > On the web one can find example about making a sphere. > But I've not found yet an example which use the notion of class. > Is it possible to use oriented object programming with PyOpenGL (or > OpenGL)? > If yes, I'm looking for an example which display spheres and > cylinders. I'm planned to display molecules .... > Thanks in advance, Sounds like what you want is a scenegraph engine. There are quite a few of them available in Python, including OpenGLContext (my own). You can find pointers to the one's I'm aware of here: http://www.vrplumber.com/py3d.py?category=retained HTH, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: Eric G. <eri...@ep...> - 2007-09-27 13:58:10
|
Hello, On the web one can find example about making a sphere. But I've not found yet an example which use the notion of class. Is it possible to use oriented object programming with PyOpenGL (or OpenGL)? If yes, I'm looking for an example which display spheres and cylinders. I'm planned to display molecules .... Thanks in advance, Eric. -- / "Love, Gift from Life, is given naturally." / Eric Germaneau <http://lcr.epfl.ch/page37437.html> Ecole polytechnique fédérale de Lausanne (EPFL) FSB - IPMC Laboratoire de Cristallographie(LCr) <http://lcr.epfl.ch> BSP 518 CH-1015 Lausanne Switzerland eri...@ep... <mailto:eri...@ep...> /Tel./: +41 (0)21 / 693 06 36 /Fax./: +41 (0)21 / 693 05 04 /msn/: ai...@ho... /skype/: aihaike /Please consider the environment before printing this email - Considérez svp l'environnement avant d'imprimer cet email/ |
From: altern <al...@gm...> - 2007-09-27 07:49:54
|
hi eric That function it is not listed on the pyOpenGL documentation http://pyopengl.sourceforge.net/documentation/manual/ there is something called glutDisplayFunc() http://pyopengl.sourceforge.net/documentation/manual/glutDisplayFunc.3GLUT.xml but not the one you are trying to call best enrike Eric Germaneau(e)k dio: > Dear PyOpenGl users, > > After installed PyOpenGL-3.0.0a6 on my Slackware 12.0 with python 2.5 > I've run a simple example and I got the following error: > > / NameError: name 'glutSetDisplayFuncCall' is not defined > / > On the top of the code import lines are: > > /from OpenGL.GL import * > from OpenGL.GLUT import * > > /What's wrong? > > Thanks in advance, > Regards, > > Eric. > > -- > / "Love, Gift from Life, is given naturally." > / > Eric Germaneau <http://lcr.epfl.ch/page37437.html> > Ecole polytechnique fédérale de Lausanne (EPFL) > FSB - IPMC > Laboratoire de Cristallographie(LCr) <http://lcr.epfl.ch> > BSP 518 > CH-1015 Lausanne > Switzerland > eri...@ep... <mailto:eri...@ep...> > /Tel./: +41 (0)21 / 693 06 36 > /Fax./: +41 (0)21 / 693 05 04 > /msn/: ai...@ho... <mailto:ai...@ho...> > /skype/: aihaike > > / Please consider the environment before printing this email - > Considérez svp l'environnement avant d'imprimer cet email / > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > > ------------------------------------------------------------------------ > > _______________________________________________ > PyOpenGL Homepage > http://pyopengl.sourceforge.net > _______________________________________________ > PyOpenGL-Users mailing list > PyO...@li... > https://lists.sourceforge.net/lists/listinfo/pyopengl-users |
From: Eric G. <eri...@ep...> - 2007-09-27 06:41:27
|
Dear PyOpenGl users, After installed PyOpenGL-3.0.0a6 on my Slackware 12.0 with python 2.5 I've run a simple example and I got the following error: /NameError: name 'glutSetDisplayFuncCall' is not defined / On the top of the code import lines are: /from OpenGL.GL import * from OpenGL.GLUT import * /What's wrong? Thanks in advance, Regards, Eric. -- / "Love, Gift from Life, is given naturally." / Eric Germaneau <http://lcr.epfl.ch/page37437.html> Ecole polytechnique fédérale de Lausanne (EPFL) FSB - IPMC Laboratoire de Cristallographie(LCr) <http://lcr.epfl.ch> BSP 518 CH-1015 Lausanne Switzerland eri...@ep... <mailto:eri...@ep...> /Tel./: +41 (0)21 / 693 06 36 /Fax./: +41 (0)21 / 693 05 04 /msn/: ai...@ho... /skype/: aihaike /Please consider the environment before printing this email - Considérez svp l'environnement avant d'imprimer cet email/ |
From: Mike C. F. <mcf...@vr...> - 2007-09-18 14:30:53
|
Miriam English wrote: > So much for putting it aside... > Installed togl and more recent version of PIL (1.1.6 instead of 1.1.5) > and just about everything works... cool! ...except a pesky problem with > the original pygame program glcube.py but that's a problem for the > pygame list. > > Sorry about the 5 hour long monologue on the list. I'll try to write up > a piece on how I managed this and send it. It might be useful for some > other poor lost souls. > It's a good data point. I'd appreciate the write-up so that we can help others get around installation problems... The installation page is still just the 2.x series at the moment and needs to get the 3.x notes up at some point. Take care, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: Mike C. F. <mcf...@vr...> - 2007-09-18 14:25:20
|
Miriam English wrote: ... Wow, name from the deep-dark past. Hi Miriam! > So I go to sourceforge and... ummm... an egg??? OK, so I read up about > them (seems a little like making things more complicated to make them > easier), Yeah, setuptools isn't a slam-dunk win, it's better than what went before (normally), but it's not perfect. Eventually the hope is that *something* will go into Python core that does the same basic job. > download the required tools and install them, then install > PyOpenGL-3.0.0a6. Everything seems to go fine. > > I now try the glcube example again and it gives the same message: > "The GLCUBE example requires PyOpenGL" > Very odd... > > I decide to try another example, just in case it is something related to > that particular file. I select the dots.py example from the > PyOpenGL_Demo-3.0.0a6 collection. This time the error I get is: > ... > ImportError: No module named ctypes > ... > It is true I have no module named ctypes, but I haven't needed it > previously when using Win32 and I can't find mention of it in the > python2.4 documentation. Does anybody know what this means? > ctypes is built-in in Python 2.5. You likely have Python 2.5 on your Windows system and 2.4 on your Puppy Linux system. ctypes can be downloaded and installed from the ctypes page on SourceForge: http://sourceforge.net/project/showfiles.php?group_id=71702 choose the .tar.gz and run the setup.py to build the package. Most linux distributions have a package for it, but I'm guessing puppy doesn't provide one. 3.0.0 is basically just waiting for me to have time to release as beta1, it's recommended for any new development you are doing. The build process for 2.x is just so horribly tortuous that it qualifies as fundamentally broken. > Sheesh. Lucky I'm a ridiculously patient person. I've tried a few other > times to install PyOpenGL on Puppy and run out of time after spending a > day or so at it. This time I've finally decided to turn to the list... > Good luck, and thanks for your ridiculous patience :) . Feel free to turn to the list sooner next time, installation is probably the biggest source of frustration with the project at the moment. Have fun, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: Miriam E. <mi...@mi...> - 2007-09-18 12:38:21
|
So much for putting it aside... Installed togl and more recent version of PIL (1.1.6 instead of 1.1.5) and just about everything works... cool! ...except a pesky problem with the original pygame program glcube.py but that's a problem for the pygame list. Sorry about the 5 hour long monologue on the list. I'll try to write up a piece on how I managed this and send it. It might be useful for some other poor lost souls. Cheers, - Miriam -- ---------=---------=---------=---------=---------=---------=------ A life! Cool! Where can I download one of those from? ---------=---------=---------=---------=---------=---------=------ Website: http://miriam-english.org Blog: http://www.livejournal.com/users/miriam_e/ |