pyopengl-users Mailing List for PyOpenGL (Page 61)
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: Mike C. F. <mcf...@vr...> - 2008-06-15 19:13:22
|
Ulas Türkmen wrote: ... > The Image object is from PIL. As you can see, thread locks are > necessary to stop the display functions from changing the displays; > otherwise, an OpenGL error is thrown. > > When this routine is called from the display class of which it is a > member, there are no errors; the image is saved in the given path. > When it is called from outside the thread, however, glutSetWindow > causes a segmentation fault. This happens not each and every time but > most of the time, which puzzled me even more. Before we put in locks > for the drawing functions, segfaults and OpenGL errors would each > happen. > I would have been surprised had it worked, actually. Most GUI libraries are inherently non-thread-safe and will mess up rather badly when you try to call functions from another thread. Normally you get around this by having a queue of tasks to accomplish in the GUI thread and adding your operation to that queue. The GUI thread checks the queue (non-blocking) and executes the operations when it is in a stable state, returning the result on another queue that you (the client code) wait on (blocking). Not to say you *couldn't* make it work with enough locks and the like, but I'd be tempted to go with an "all GUI code in one thread" approach for stability. HTH, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: U. T. <afr...@go...> - 2008-06-15 15:45:01
|
Hi people, We are working on a small program using pyode and pyopengl to simulate a very simple robot. Nearly all the modelling is finished, and the last thing left is a virtual camera that takes a snapshot of the field of view of the robot. A class called display handles visualization and the virtual camera. This class is in a thread of its own. Our program has two windows; one displays the complete simulation environment, the other displays the viewpoint of the camera. In order to save what is in the camera window as an image, we do the following: def capture(self, path): self.draw_lock.acquire() glutSetWindow(self.subwindow) glPixelStorei(GL_PACK_ALIGNMENT, 1) data = glReadPixelsub(0, 0, self.subwindow_width, self.subwindow_height, GL_RGB) image = Image.fromstring( 'RGB', (int(self.subwindow_width),int(self.subwindow_height)), data ) image = image.transpose( Image.FLIP_TOP_BOTTOM) image.save(path) self.draw_lock.release() return True The Image object is from PIL. As you can see, thread locks are necessary to stop the display functions from changing the displays; otherwise, an OpenGL error is thrown. When this routine is called from the display class of which it is a member, there are no errors; the image is saved in the given path. When it is called from outside the thread, however, glutSetWindow causes a segmentation fault. This happens not each and every time but most of the time, which puzzled me even more. Before we put in locks for the drawing functions, segfaults and OpenGL errors would each happen. I am suspecting that there is another resource which has to be locked, but no idea what and how. Any ideas what the reason might be, or how to find a workaround? Cheers, Ulas |
From: <cat...@gm...> - 2008-06-09 16:06:00
|
StumbleUpon Discover new web sites Catafest wants to Share Favorites with you Likes 1 page 1 fan& I just discovered some cool websites and videos using StumbleUpon. If you join too we can see if we like the same websites and videos. Join StumbleUpon for Free & http://www.stumbleupon.com/redirect.php?t=j&u=8700572&d=http%3A%2F%2Fwww.stumbleupon.com%2Fjoin.php%3Ffriend%3D5529397%26emailcode%3Dv8xn4lnv61zyms09&l=2&c=v8xn4lnv61zyms09 -&catafest & cat...@gm... p.s. If you're new to StumbleUpon, try the demo http://www.stumbleupon.com/redirect.php?t=j&u=8700572&d=http%3A%2F%2Fwww.stumbleupon.com%2Fdemo%2F%3Ffriend%3D5529397&l=5&c=v8xn4lnv61zyms09 for yourself :) About StumbleUpon Channel surf the internet with StumbleUpon! Discover great web content recommended by your friends and like-minded stumblers by just clicking the Stumble! button - learn more http://www.stumbleupon.com/redirect.php?t=j&u=8700572&l=3&c=v8xn4lnv61zyms09 . If you do not wish to receive e-mails sent by your friends via StumbleUpon, please click here http://www.stumbleupon.com/redirect.php?t=j&u=8700572&d=http%3A%2F%2Fwww.stumbleupon.com%2Fnotifications.php%3Femailcode%3Dv8xn4lnv61zyms09&l=4&c=v8xn4lnv61zyms09 . (c) StumbleUpon 2001-2008 |
From: Mike C. F. <mcf...@vr...> - 2008-06-06 21:10:46
|
Jon Wright wrote: > Hello, > > I noticed that the windows download of PyOpenGL (3.0.0b2 via > easy_install) does not include Togl? It appears to work to get > Togl2.0-8.4-Windows.zip from : > > http://sourceforge.net/project/showfiles.php?group_id=519 > There's a quick hack script in the src subdirectory that downloads the .zip file, unpacks it and tries to install the files. What I'd prefer is a setuptools/disutils package that could be turned into a dependency that could auto-download on Win32 platforms. What I'd prefer even more is if there were someone to deal with all that nasty Tk/Togl stuff for me :) . > I seem to have been bouncing my head on these PyOpenGl/Togl problems for > some time. Since the Togl folks are now making binaries available it may > be possible to fix pyopengl by using them. Do you need some help with > this? If so, please let me know whereabouts in CVS I could start to take > a look. > Yay, a volunteer. If you could create a simple setuptools package that does the installation we can put it up on the PyOpenGL download section. Take care, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: Mike C. F. <mcf...@vr...> - 2008-06-06 20:46:20
|
jrb wrote: > i'm running the latest PyOpenGL (pyopengl-3.0.0b2-py2.5.egg) on the > latest windows python (2.5.2) and am getting access violations when > running the simplest examples. they occur when using the keyboard > handler function (set using glutKeyboardFunc and even if it does nothing > but return), mouse handler (set using glutMouseFunc), and when using > glutFullScreen. they all crash with: > > Traceback (most recent call last): > File "./simple-spheres.py", line 93, in <module> > glutMainLoop() > WindowsError: exception: access violation reading 0x00000000 > > crashing in the glutMainLoop after hitting a key or clicking the mouse > or just right away in the case of the glutFullScreen call. > > anybody know what's going on or what i'm doing wrong? > There was a bug in the Win32 GLUT callback registration. Turns out they use C calling convention despite the functions all being Win32 calling convention. Latest CVS should solve the problem. HTH, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: jrb <jr...@cs...> - 2008-06-06 17:20:23
|
i'm running the latest PyOpenGL (pyopengl-3.0.0b2-py2.5.egg) on the latest windows python (2.5.2) and am getting access violations when running the simplest examples. they occur when using the keyboard handler function (set using glutKeyboardFunc and even if it does nothing but return), mouse handler (set using glutMouseFunc), and when using glutFullScreen. they all crash with: Traceback (most recent call last): File "./simple-spheres.py", line 93, in <module> glutMainLoop() WindowsError: exception: access violation reading 0x00000000 crashing in the glutMainLoop after hitting a key or clicking the mouse or just right away in the case of the glutFullScreen call. anybody know what's going on or what i'm doing wrong? here's the simple-sphere's file i'm using (that i got from the net (thanks)): #!/usr/bin/env python from OpenGL.GLUT import * from OpenGL.GLU import * from OpenGL.GL import * name = "Hello, World" height = 400 width = 400 rotate = 0 beginx = 0. beginy = 0. rotx = 0. roty = 0. def display(): glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT) glLoadIdentity() gluLookAt(0,0,10,0,0,0,0,1,0) glRotatef(roty,0,1,0) glRotatef(rotx,1,0,0) glCallList(1) glutSwapBuffers() return def mouse(button,state,x,y): global beginx,beginy,rotate if button == GLUT_LEFT_BUTTON and state == GLUT_DOWN: rotate = 1 beginx = x beginy = y if button == GLUT_LEFT_BUTTON and state == GLUT_UP: rotate = 0 return def motion(x,y): global rotx,roty,beginx,beginy,rotate if rotate: rotx = rotx + (y - beginy) roty = roty + (x - beginx) beginx = x beginy = y glutPostRedisplay() return def keyboard(a,b,c): return glutInit(name) glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH) glutInitWindowSize(height,width) glutCreateWindow(name) glClearColor(0.,0.,0.,1.) # setup display list glNewList(1,GL_COMPILE) glPushMatrix() glTranslatef(0.,1.,0.) #move to where we want to put object glutSolidSphere(1.,20,20) # make radius 1 sphere of res 10x10 glPopMatrix() glPushMatrix() glTranslatef(0.,-1.,0.) #move to where we want to put object glutSolidSphere(1.,20,20) # make radius 1 sphere of res 10x10 glPopMatrix() glEndList() #setup lighting glEnable(GL_CULL_FACE) glEnable(GL_DEPTH_TEST) glEnable(GL_LIGHTING) lightZeroPosition = [10.,4.,10.,1.] lightZeroColor = [0.8,1.0,0.8,1.0] # greenish glLightfv(GL_LIGHT0, GL_POSITION, lightZeroPosition) glLightfv(GL_LIGHT0, GL_DIFFUSE, lightZeroColor) glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 0.1) glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.05) glEnable(GL_LIGHT0) #setup cameras glMatrixMode(GL_PROJECTION) gluPerspective(40.,1.,1.,40.) glMatrixMode(GL_MODELVIEW) gluLookAt(0,0,10,0,0,0,0,1,0) glPushMatrix() #setup callbacks glutDisplayFunc(display) glutMouseFunc(mouse) glutMotionFunc(motion) glutKeyboardFunc(keyboard) glutMainLoop() |
From: Greg E. <gre...@ca...> - 2008-06-03 00:19:14
|
Jason Ward wrote: > If your going to be doing manipulations like that on the GPU I think you > will have to use shaders for that kind of customized computation. Also be aware that what OpenGL calls a "matrix" has nothing to do with what you're talking about here. OpenGL matrices are 4x4 matrices used for coordinate transformations only. -- Greg |
From: Jason H. <jas...@vo...> - 2008-06-02 21:58:46
|
Ignore my previous post. I just learned about display lists and I no longer have any performance problems. In fact, I can now easily render over 120,000 points. -Jason From: Jason Hayes Sent: Monday, June 02, 2008 3:57 PM To: 'pyo...@li...' Subject: Rendering performance under wxPython Hi, I am pretty new to using PyOpenGL (and OpenGL in general) and had a rendering performance question. I am embedding an opengl canvas into a wx.Frame. On my canvas, I am simply rendering ~10,000 points and the performance is chugging. I'm trying to determine if the limiting factor is wxPython or PyOpenGL? I doubt that OpenGL really has a problem with this many points, but maybe I'm doing something wrong. Attached is a text file of the code. Any feedback is appreciated. Thanks. _________________________________ Jason Hayes Technical Art Director THQ / Volition "Whenever I'm about to do something, I think "would an idiot do that?" and if they would, I do not do that thing." - Dwight Schrute |
From: Jason H. <jas...@vo...> - 2008-06-02 20:57:17
|
import wx from wx import glcanvas from OpenGL.GL import * from OpenGL.GLUT import * class Viewport(glcanvas.GLCanvas): def __init__(self, parent, canvasSize): glcanvas.GLCanvas.__init__(self, parent, -1, size=canvasSize) self.init = False self.size = canvasSize self.Viewpoint = (0.0, 0.0, 0.0) self.NearClip = -100.0 self.FarClip = 100.0 self.CurrentCursorPos = None self.LastClickPos = None self.LastCursorPos = None self.IsDragging = False self.Zoom = 1.0 self.ZoomSpeed = 0.1 self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground) self.Bind(wx.EVT_SIZE, self.OnSize) self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_MIDDLE_DOWN, self.OnMiddleButtonDown) self.Bind(wx.EVT_MIDDLE_UP, self.OnMiddleButtonUp) self.Bind(wx.EVT_MOTION, self.OnMouseMove) self.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheel) def AddZoomPct(self, zoomPct): self.Zoom += zoomPct if self.Zoom < 0.1: self.Zoom = 0.1 if self.Zoom > 2.0: self.Zoom = 2.0 def OnMouseWheel(self, event): wheelRotation = event.GetWheelRotation() # Zoom In if wheelRotation > 0: self.AddZoomPct(-self.ZoomSpeed) cursor = wx.StockCursor(wx.CURSOR_MAGNIFIER) self.SetCursor(cursor) # Zoom Out elif wheelRotation < 0: self.AddZoomPct(self.ZoomSpeed) cursor = wx.StockCursor(wx.CURSOR_MAGNIFIER) self.SetCursor(cursor) cursor = wx.StockCursor(wx.CURSOR_DEFAULT) self.SetCursor(cursor) self.Refresh() def OnMouseMove(self, event): """ """ self.CurrentCursorPos = event.GetPosition() if self.IsDragging: diff = wx.Point() diff[0] = self.CurrentCursorPos[0] - self.LastClickPos[0] diff[1] = self.CurrentCursorPos[1] - self.LastClickPos[1] self.Viewpoint = (self.Viewpoint[0] + (float(diff[0]) / self.Size[0]), self.Viewpoint[1] - (float(diff[1]) / self.Size[1]), 0.0) self.LastClickPos = event.GetPosition() self.Refresh() def OnMiddleButtonUp(self, event): """ """ self.IsDragging = False self.CurrentCursorPos = event.GetPosition() self.LastCursorPos = self.CurrentCursorPos cursor = wx.StockCursor(wx.CURSOR_DEFAULT) self.SetCursor(cursor) def OnMiddleButtonDown(self, event): """ """ cursor = wx.StockCursor(wx.CURSOR_HAND) self.SetCursor(cursor) self.CurrentCursorPos = event.GetPosition() self.IsDragging = True self.LastClickPos = self.CurrentCursorPos self.LastCursorPos = self.CurrentCursorPos def OnEraseBackground(self, event): pass def OnSize(self, event): size = self.size = self.GetClientSize() if self.GetContext(): self.SetCurrent() glViewport(0, 0, size.width, size.height) event.Skip() def OnPaint(self, event): dc = wx.PaintDC(self) self.SetCurrent() if not self.init: self.InitGL() self.init = True self.OnDraw() class ViewportCanvas(Viewport): def InitGL(self): glMatrixMode(GL_PROJECTION) glLoadIdentity() glOrtho(-1.0, 1.0, -1.0, 1.0, self.NearClip, self.FarClip) glMatrixMode(GL_MODELVIEW) glShadeModel(GL_FLAT) def OnDraw(self): glLoadIdentity() glScalef(1.0 / self.Zoom, 1.0 / self.Zoom, 1.0) glTranslatef(self.Viewpoint[0], self.Viewpoint[1], 0.0) glClearColor(0.5, 0.5, 0.5, 0.0) glClear(GL_COLOR_BUFFER_BIT) glPointSize(4.0) a = 0.0 b = 0.0 x = 0.0 y = 0.0 dis = 0.1 num = 100 glBegin(GL_POINTS) for h in range(1,num): x = 0.0 for w in range(1, num): glVertex2f(a + x, b + y) x += dis y += dis glEnd() self.size = self.GetClientSize() self.SwapBuffers() class EditorWindow(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, size=(700, 500)) self.sizer = wx.BoxSizer() self.viewport = ViewportCanvas(self, self.Size) self.sizer.Add(self.viewport) self.SetSizer(self.sizer) self.Show() if __name__ == '__main__': app = wx.App() frame = EditorWindow(None, -1, "Editor") app.MainLoop() |
From: Jason W. <ny...@gm...> - 2008-06-02 04:48:08
|
On Mon, Jun 2, 2008 at 2:31 AM, Brendan Simons <bre...@ya...> wrote: > Hi all, > > Sorry for the basic level of this question. I'm absolutely new to GL > programming. I'm trying to implement a very simple demosaicing > algorithm on the graphics card (in order to render data from a really > high-res bayer-filtered ccd sensor to the screen in real time). I > need to be able to do the following: > > 1) given a "raw" image, copy the data (a matrix of unsigned bytes) to > video memory three times. > > 2) multiply each copy element-wise by a precomputed "mask" of 1s and > 0s, so that the first copy records only the red values (all others > become 0), the second green, and the last blue. > > 3) Interpolate the missing colour info. This step is different for > green, and for red/blue, but it goes something like this: Copy a > crop of the green matrix exactly one row and one column narrower on > all sides. Now add (again element-wise) to that copy another crop of > the green matrix, but this time shifted up one row. And again shifted > down one row. And again shifted left on column. And one more shifted > right one column. Divide the total (element-wise) by 4. > > 4) Copy the interpolated red, green and blue matrices to an opengl > texture. Map the texture to a 2d square, and render the square to the > screen (resizing / rotating / flipping as desired). > > I can figure out steps 1 and 4. Ideally steps 2 and 3 would be done > in video memory, using opengl functions, but I can't find anything > that would do element-wise multiplication, addition or cropping of > matrices in the opengl stack. Can anyone point me in the right > direction? > > Thanks, > Brendan > -- > Brendan Simons > > If your going to be doing manipulations like that on the GPU I think you will have to use shaders for that kind of customized computation. Other than that you will have to do it on the CPU with arrays before sending it to GPU...which is slower. To send it three times you will need to make 3 different textures or send it with glDrawPixels. You could also use FBOs to hold it in graphics memory instead if you want. For step 2 the Redbook will be able to help, there are colorMasks and bitfields for excluding texture information which may be of help. > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > 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: Brendan S. <bre...@ya...> - 2008-06-02 00:33:14
|
Hi all, Sorry for the basic level of this question. I'm absolutely new to GL programming. I'm trying to implement a very simple demosaicing algorithm on the graphics card (in order to render data from a really high-res bayer-filtered ccd sensor to the screen in real time). I need to be able to do the following: 1) given a "raw" image, copy the data (a matrix of unsigned bytes) to video memory three times. 2) multiply each copy element-wise by a precomputed "mask" of 1s and 0s, so that the first copy records only the red values (all others become 0), the second green, and the last blue. 3) Interpolate the missing colour info. This step is different for green, and for red/blue, but it goes something like this: Copy a crop of the green matrix exactly one row and one column narrower on all sides. Now add (again element-wise) to that copy another crop of the green matrix, but this time shifted up one row. And again shifted down one row. And again shifted left on column. And one more shifted right one column. Divide the total (element-wise) by 4. 4) Copy the interpolated red, green and blue matrices to an opengl texture. Map the texture to a 2d square, and render the square to the screen (resizing / rotating / flipping as desired). I can figure out steps 1 and 4. Ideally steps 2 and 3 would be done in video memory, using opengl functions, but I can't find anything that would do element-wise multiplication, addition or cropping of matrices in the opengl stack. Can anyone point me in the right direction? Thanks, Brendan -- Brendan Simons |
From: justin w. <war...@gm...> - 2008-06-01 22:27:41
|
Thanks, It still doesn't work. I tried installing PyOpenGL with setuptools, and I'm fairly sure I did it right, but I got the same error. How can I check to make sure its properly installed? After adding Astan's code, I just got the error: Traceback (most recent call last): File "C:\Documents and Settings\HP_Administrator\Desktop\Prgms\Game.py", line 17, in <module> formathandler.FormatHandler.chooseOutput( 'ctypesarrays' ) File "C:\Documents and Settings\HP_Administrator\Desktop\Prgms\OpenGL\arrays\formathandler.py", line 75, in chooseOutput """Unable to find any output handler at all (not even ctypes/numpy ones!)""" RuntimeError: Unable to find any output handler at all (not even ctypes/numpy ones!) That sounds like it might be easy to fix, but I'm not sure what it means still. |
From: Jon W. <wr...@es...> - 2008-05-30 08:20:41
|
Hello, I noticed that the windows download of PyOpenGL (3.0.0b2 via easy_install) does not include Togl? It appears to work to get Togl2.0-8.4-Windows.zip from : http://sourceforge.net/project/showfiles.php?group_id=519 ... and unzip the Togl2.0 either into C:\python25\tcl\tcl8.4\ , or, put the Togl files into : pyopengl-3.0.0b2-py2.5.egg\OpenGL\Tk\win32-tk8.4 and patch your Tk/__init__.py script to actually append TOGL_DLL_PATH in: =========================================== # add this file's directory to Tcl's search path # on Linux Togl is installed in ./linux2-tk8.0 # on Windows (Python2.0) in ./win32-tk8.3 try: TOGL_DLL_PATH = os.path.join( os.path.dirname(__file__), sys.platform + "-tk" + _default_root.getvar("tk_version") ) # ******* This line added - use the path *************** _default_root.tk.call('lappend', 'auto_path', TOGL_DLL_PATH) except NameError, err: # no __file__, likely running as an egg TOGL_DLL_PATH = "" # ******* Is this intentional, or should it be indented ? _default_root.tk.call('lappend', 'auto_path', ) try: _default_root.tk.eval('load {} Togl') except TclError: pass ============================================ ... when 'load {} Togl' gives a TclError this might be a good time to print something on stdout to help the user to fix their installation. I seem to have been bouncing my head on these PyOpenGl/Togl problems for some time. Since the Togl folks are now making binaries available it may be possible to fix pyopengl by using them. Do you need some help with this? If so, please let me know whereabouts in CVS I could start to take a look. Best, Jon |
From: Mike C. F. <mcf...@vr...> - 2008-05-28 02:22:46
|
justin warfield wrote: > I've been stuck on this problem for a while now, so I'd really > appreciate any help. > > I'm trying to run code that ran fine on a different computer. > > This line: > glTexImage2D(GL_TEXTURE_2D, 0, 3, each.w, each.h, 0, GL_RGBA, > GL_UNSIGNED_BYTE, each.image) > > Gives this error: > OpenGL\arrays\arraydatatype.py", line 36, in getHandler > typ, repr(value)[:50] > TypeError: No array-type handler for type <type 'str'> (value: > 'Zw#\xff]\x83,\xffi\x850\xffTx\x1e\xffFm\x12\xffYz) registered > I guess I'm missing file or something, but I have no idea. > Does anyone please know what that means? That would normally mean that on one machine you didn't use setuptools/easy-install to install PyOpenGL. setuptools is what registers the data-type handlers for PyOpenGL 3.x. HTH, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: justin w. <war...@gm...> - 2008-05-26 22:38:50
|
I've been stuck on this problem for a while now, so I'd really appreciate any help. I'm trying to run code that ran fine on a different computer. This line: glTexImage2D(GL_TEXTURE_2D, 0, 3, each.w, each.h, 0, GL_RGBA, GL_UNSIGNED_BYTE, each.image) Gives this error: OpenGL\arrays\arraydatatype.py", line 36, in getHandler typ, repr(value)[:50] TypeError: No array-type handler for type <type 'str'> (value: 'Zw#\xff]\x83,\xffi\x850\xffTx\x1e\xffFm\x12\xffYz) registered I guess I'm missing file or something, but I have no idea. Does anyone please know what that means? |
From: Gary H. <gh...@is...> - 2008-05-25 15:31:23
|
Nick Shaforostoff wrote: > Hi. I'm learning NURBS. I get this error: > GL.glMap2f(GL.GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, ctrlpoints[0][0][0]) > TypeError: glMap2f() takes exactly 6 arguments (10 given) > > though documentation says glMap2f has 10 params and all code snippets found on the internet pass 10 params too. > According to the PyOpenGL manual: C Specification void glMap2d ( GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points); void glMap2f ( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points); Python Specification glMap2d ( target, u1, u2, v1, v2, points[][][]) → None glMap2f ( target, u1, u2, v1, v2, points[][][]) → None The C calls take 10 parameters, but the Python versions take far fewer. Instead of passing in a pointer and some stride and order information describing how it is organized as an array, Python just accepts the array Gary Herron > ii python-opengl 3.0.0~b1-2 Python bindings to OpenGL > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > 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: Nick S. <sh...@uk...> - 2008-05-24 23:30:07
|
Hi. I'm learning NURBS. I get this error: GL.glMap2f(GL.GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, ctrlpoints[0][0][0]) TypeError: glMap2f() takes exactly 6 arguments (10 given) though documentation says glMap2f has 10 params and all code snippets found on the internet pass 10 params too. ii python-opengl 3.0.0~b1-2 Python bindings to OpenGL |
From: Black <py...@bl...> - 2008-05-23 13:53:56
|
On May 22, 2008, at 10:59 PM, Astan Chee wrote: > Hi, > I am trying to see how big/far my objects can be in (py)opengl. I > thought there was no limit and everything should be visible but a > sphere > with radius 70 and the camera is 150 units away, only half of the > sphere > is visible. What is causing this? Is it plane clipping? How do I set > it > so that it renders regardless of distance and size? Im not after > performance so I dont care if it is slow. > Cheers > Astan > PS: Here is the code I use: > > gluPerspective(45, 1.0*width/height, 0.1, 100.0) This line sets the far clipping plane to be 100 units out from the camera. As you are 150 units away and the sphere has a radius of 70 you are seeing the outer 20 units of the sphere. There isn't really a way to make it render "regardless of distance and size". The concern with increasing the size of the viewing volume isn't actually performance, it is that when the difference between the near and far planes grows, the accuracy of the depth calculations decreases. As we don't know what you are trying to do, it is hard to advise you as the best approach to take. |
From: Astan C. <st...@al...> - 2008-05-23 03:00:06
|
Hi, I am trying to see how big/far my objects can be in (py)opengl. I thought there was no limit and everything should be visible but a sphere with radius 70 and the camera is 150 units away, only half of the sphere is visible. What is causing this? Is it plane clipping? How do I set it so that it renders regardless of distance and size? Im not after performance so I dont care if it is slow. Cheers Astan PS: Here is the code I use: from OpenGL.GL import * from OpenGL.GLU import * import pygame from pygame.locals import * rtri = 0.0 dlBody = None def resize((width, height)): if height==0: height=1 glViewport(0, 0, width, height) glMatrixMode(GL_PROJECTION) glLoadIdentity() gluPerspective(45, 1.0*width/height, 0.1, 100.0) glMatrixMode(GL_MODELVIEW) glLoadIdentity() def init(): global dlBody glShadeModel(GL_SMOOTH) glClearColor(0.0, 0.0, 0.0, 0.0) glClearDepth(1.0) glEnable(GL_DEPTH_TEST) glDepthFunc(GL_LEQUAL) glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_FASTEST) glEnable(GL_COLOR_MATERIAL) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE) radius = 70 color = (0.7,1.5,0.5) dlBody = glGenLists(1) glNewList(dlBody,GL_COMPILE) Sphere = gluNewQuadric() gluSphere(Sphere, radius, 32, 32) gluQuadricNormals(Sphere, GLU_SMOOTH) gluQuadricDrawStyle(Sphere, GLU_FILL) glEndList() def draw(): global dlBody global rtri if dlBody: glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glLoadIdentity() glTranslatef(0.0,0.0,-150) glPushMatrix() glColor3f(0.7,1.5,0.5) glRotatef(10,1,0,0) glRotatef(rtri, 0.0, 1.0, 0.0) glCallList(dlBody) glPopMatrix() rtri+=1 if rtri == 360: rtri = 0 def main(): video_flags = OPENGL|DOUBLEBUF pygame.init() pygame.display.set_mode((640,480), video_flags) resize((640,480)) init() frames = 0 ticks = pygame.time.get_ticks() while 1: event = pygame.event.poll() if event.type == QUIT or (event.type == KEYDOWN and event.key == K_ESCAPE): break draw() pygame.display.flip() frames = frames+1 print "fps: %d" % ((frames*1000)/(pygame.time.get_ticks()-ticks)) pygame.quit() if __name__ == '__main__': main() -- "Formulations of number theory: Complete, Consistent, Non-trivial. Choose two." Animal Logic http://www.animallogic.com Please think of the environment before printing this email. This email and any attachments may be confidential and/or privileged. If you are not the intended recipient of this email, you must not disclose or use the information contained in it. Please notify the sender immediately and delete this document if you have received it in error. We do not guarantee this email is error or virus free. |
From: Prashant S. <ani...@ya...> - 2008-05-22 15:31:02
|
Hi, I have recently installed ubuntu 'Gusty' and updated all the packages required. I am getting this error in a script: NameError: global name 'glSelectWithCallback' is not defined How ever same script is running fine on windows and function is returning proper results. Am I missing something here? Regards. |
From: Krazy <kra...@ho...> - 2008-05-22 12:56:02
|
Ok, so I have one problem. When I go to command prompt and type in "easy_setup PyOpenGL", it tells me that it is not an internal or external command or operable batch file. How can I fix that? Also, is there an installer for it, like Pygame's? Also, does anyone know how I can use 3d sound too? And does PyOpenGL have any other functions other than the functions straight from OpenGL? Thanks for any responses! |
From: Astan C. <st...@al...> - 2008-05-17 07:02:09
|
Hi, Im trying to do glGenLists while a program is running and it keeps returning 0 and whenever I try to do a glCallList, it fails with a 'invalid value' error. Is this a known issue? why would my program give valid glGenList while being initialized but not while it is running? Im using wx to create a new pygame thread that uses pyopengl. This is the glGenList snippet: dlBody = glGenLists(1) glNewList(dlBody,GL_COMPILE) SphereT = gluNewQuadric() gluSphere(SphereT, 0.5, 32, 32) gluQuadricNormals(SphereT, GLU_SMOOTH) gluQuadricDrawStyle(SphereT, GLU_FILL) glEndList() and here is how I init: glShadeModel(GL_SMOOTH) glClearColor(0.0, 0.0, 0.0, 0.0) glClearDepth(1.0) glEnable(GL_DEPTH_TEST) glDepthFunc(GL_LEQUAL) glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST) glEnable (GL_LIGHT0) glEnable (GL_LIGHTING) glEnable(GL_TEXTURE_2D) LightAmbient = ( (0., 0., 0., 0.,1.) ) glLightModelfv( GL_LIGHT_MODEL_AMBIENT, LightAmbient ) glEnable(GL_COLOR_MATERIAL) glViewport(0, 0, width, height) glMatrixMode(GL_PROJECTION) glLoadIdentity() gluPerspective(45, 1.0*width/height, 1.0, 10000.0) glMatrixMode(GL_MODELVIEW) glLoadIdentity() -- "Formulations of number theory: Complete, Consistent, Non-trivial. Choose two." Animal Logic http://www.animallogic.com Please think of the environment before printing this email. This email and any attachments may be confidential and/or privileged. If you are not the intended recipient of this email, you must not disclose or use the information contained in it. Please notify the sender immediately and delete this document if you have received it in error. We do not guarantee this email is error or virus free. |
From: Astan C. <st...@al...> - 2008-05-06 03:32:08
|
Hi, I have a python script that uses wx, pygame and pyopengl. I've combined wx and pygame similar to http://wiki.wxpython.org/IntegratingPyGame (in windows) and the pygame has a separate thread. The pygame part of it uses pyopengl for a display window and to load images. When I create a .exe from this script, the executable works fine on the pc that i compiled it on (my one), but it wont run anywhere else; even ones that are almost identical build to mine (it doesnt have python, pygame or pyopengl installed). It gives me a wierd error that I dont know what it means. Does anyone know what might cause it? or how do I debug these problems? Why would it work on my pc and not anywhere else? Thanks for any help It gives me the following error: Unhandled exception in thread started by Traceback (most recent call last): File "wxSolOutWindow.py", line 637, in Run File "wxSolOutWindow.py", line 152, in Inited File "wxSolOutWindow.py", line 241, in ObjMain File "c:\Documents and Settings\$USER\Desktop\2\dist\PyOpenGL-3.0.0b1-py2.5.egg\OpenGL\wrapper.py", line 1624 in __call__ File "c:\Documents and Settings\$USER\Desktop\2\dist\PyOpenGL-3.0.0b1-py2.5.egg\OpenGL\wrapper.py", line 924 in wrapperCall OpenGL.error.GLError: GLError( err = 1281, description = 'invalid value', baseOperation = glTexImage2D, pyArgs = [ GL_TEXTURE_2D, 0, GL_RGBA, 750, 750, 0, GL_RGBA, GL_UNSIGNED_BYTE, '\x00\x00\x00\xff\x00\x00\x00\xff\x00... ], cArgs = [ GL_TEXTURE_2D, 0, GL_RGBA, 750, 750, 0, GL_RGBA, GL_UNSIGNED_BYTE, '\x00\x00\x00\xff\x00\x00\x00\xff\x00... ], cArguments = ( GL_TEXTURE_2D, 0, GL_RGBA, 750, 750, 0, GL_RGBA, GL_UNSIGNED_BYTE, c_void_p(146210868), ) ) -- "Formulations of number theory: Complete, Consistent, Non-trivial. Choose two." Animal Logic http://www.animallogic.com Please think of the environment before printing this email. This email and any attachments may be confidential and/or privileged. If you are not the intended recipient of this email, you must not disclose or use the information contained in it. Please notify the sender immediately and delete this document if you have received it in error. We do not guarantee this email is error or virus free. |
From: Harry T. <Har...@di...> - 2008-05-04 04:43:36
|
Hi All, PyGame SF is an informal group meet up in San Francisco for Software engineers interested in Python, OpenGL, wxPython, Pyglet, PyOpenGL, Pygame, SDL, programming and generally anything to do with multimedia development. The format of our meetings typically involve several people giving presentations on projects they are developing followed by group discussion and feedback. The meet up's occur once a month on a Monday at around 7.30pm This month's PyGAME SF meet up is on Monday May 5th at 7.30pm at the Metreon food court in San Francisco. This month's presentations are: - Casey Duncan "Getting off the ground with Pyglet and OpenGL". This talk will cover Basic Pyglet setup and event handling, an introduction to Pyglet's OpenGL wrapper, Creating and using 3D models in Pyglet and more. - Niall O'Higgins, Harry Tormey "Building an intelligent P2P download suggestion engine with wxPython". This talk will cover analysis of P2P networks and early efforts at presenting this data using wxPython and discussion of plans to visualize this information using OpenGL. If anyone else would like to give a micro presentation, show demos or just talk about what they are doing or generally give examples on anything to do with cross platform development, games, widget tool kits or anything else relating to software development please feel free to head along. To subscribe to the pygamesf mailing list simply email pyg...@un... |
From: Astan C. <st...@al...> - 2008-04-28 04:46:35
|
Hi, Im trying to display opengl in a tab of a wxnotebook using pygame for image loading. I've attached my code (and image if necessary) and the problem Im having is that it is supposed to look 3D instead it comes out as 2D and it seems that the image that I load never gets displayed. What am I doing wrong? Thanks for any help Astan -- "Formulations of number theory: Complete, Consistent, Non-trivial. Choose two." Animal Logic http://www.animallogic.com Please think of the environment before printing this email. This email and any attachments may be confidential and/or privileged. If you are not the intended recipient of this email, you must not disclose or use the information contained in it. Please notify the sender immediately and delete this document if you have received it in error. We do not guarantee this email is error or virus free. |