Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-23 Thread Ian Mallett
On 8/23/07, Greg Ewing <[EMAIL PROTECTED]> wrote: > > Ulf Ekström wrote: > > But for just drawing bonds you can use some element specific distance > > cutoff, that's how all the other programs do it. > > If you already know the positions of the atoms. But it > sounds like the OP wants to calculate

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-23 Thread Greg Ewing
Ulf Ekström wrote: But for just drawing bonds you can use some element specific distance cutoff, that's how all the other programs do it. If you already know the positions of the atoms. But it sounds like the OP wants to calculate these from first principles, which can get pretty involved if yo

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-22 Thread Ian Mallett
OK, so if I've got a 2D cursor on a 2D surface tilted towards the user in 3D space, how do I use glu*Project() to make the center of the cursor move to center on the mouse position? Ian

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-22 Thread Ian Mallett
OK, I've got lumina, and it seems to be mostly what I want. Only a few tutorials run though... Do you mean gluProject()/gluUnProject()? Ian

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-22 Thread Ulf Ekström
> atomic bond folding within a molecule does not follow the same physical > laws as solid balls with joints. http://en.wikipedia.org/wiki/Molecular_dynamics#Empirical_potentials > It's a real shame that [EMAIL PROTECTED] has never posted any of their source > code. You can easily find open sourc

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-22 Thread David
Try: http://cheeseshop.python.org/pypi/PyODE/1.0.0 http://cheeseshop.python.org/pypi/Lamina/0.2 The cheeseshop isn't quite comprehensive, but it is pretty good. http://cheeseshop.python.org/pypi David On 8/22/07, Ian Mallett <[EMAIL PROTECTED]> wrote: > > On 8/22/07, Michael George <[EMAIL PRO

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-22 Thread James Paige
On Wed, Aug 22, 2007 at 12:35:56PM -0400, Michael George wrote: > You might try pyode. It's pretty simple to set up springy things using > it, and you might be able to use simple joints to do the positioning. atomic bond folding within a molecule does not follow the same physical laws as solid

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-22 Thread Ian Mallett
On 8/22/07, Michael George <[EMAIL PROTECTED]> wrote: > > You might try pyode. It's pretty simple to set up springy things using > it, and you might be able to use simple joints to do the positioning. > > --Mike I'll look into it. Is there a comprehensive list of available python modules or some

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-22 Thread Michael George
You might try pyode. It's pretty simple to set up springy things using it, and you might be able to use simple joints to do the positioning. --Mike Ian Mallett wrote: The molecular project has been canceled; not because of the problem we were discussing, but because I don't want to try to wri

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-22 Thread Ian Mallett
The molecular project has been canceled; not because of the problem we were discussing, but because I don't want to try to write a program that links the atoms together. Though at first it seems simple, atom bond angles are extremely variable, and the ways they can fold in 3D space are endless. An

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-18 Thread David
I am a little (ok, very) late getting into this discussion, but Mr LeCompte's suggestions are right on. I can add to the discussion that glUnproject is complemented by glProject. Assuming that you can read the depth buffer in PyOpenGL, one way to approach the molecular modelers problem is by: 1)

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-02 Thread Ian Mallett
On 8/2/07, Brian Fisher <[EMAIL PROTECTED]> wrote: > > There isn't really a workaround available to you. Basically you can't > use pygame surface functions on pygame's opengl surfaces (some people > are writing stuff so you can into SDL, but it's not really available > in pygame) > Yep. Ian

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-02 Thread Greg Ewing
Ian Mallett wrote: I want to draw a circle on this surface with pygame.draw.circle(). On most systems you can't use any of the 2D pygame drawing functions on an OpenGL surface. It's either one or the other, unfortunately. -- Greg Ewing, Computer Science Dept, +-

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-02 Thread Greg Ewing
Michael George wrote: I think what you actually want is http://pyopengl.sourceforge.net/documentation/manual/gluPickMatrix.3G.xml this lets you render a small portion of the scene (like the portion that's under the cursor) and stores the rendered objects into a selection buffer. That's always

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-02 Thread Michael George
Dave LeCompte (really) wrote: "Michael George" <[EMAIL PROTECTED]> wrote: Just out of curiousity, have you compared your approach the gluPick and the selection buffer infrastructure in openGL? I haven't done performance tests, but several of my concerns about glReadPixel from the color

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-02 Thread Richard Jones
On Fri, 3 Aug 2007, Ian Mallett wrote: > I want to draw a circle on this surface with pygame.draw.circle(). It > doesn't crash, which makes me think it should work, but I don't see the > circle, which makes me think it doesn't. > > Also, blitting surfaces crashes. Is there a workaround? pygame.d

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-02 Thread Ian Mallett
I thought as much. I think I'll make a texture of a circle and scale it to the right size in OpenGL. Ian On 8/2/07, Brian Fisher <[EMAIL PROTECTED]> wrote: > > There isn't really a workaround available to you. Basically you can't > use pygame surface functions on pygame's opengl surfaces (some pe

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-02 Thread Brian Fisher
There isn't really a workaround available to you. Basically you can't use pygame surface functions on pygame's opengl surfaces (some people are writing stuff so you can into SDL, but it's not really available in pygame) You need to use PyOpenGL to use OpenGL functions to get stuff onto the back bu

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-02 Thread Ian Mallett
I want to draw a circle on this surface with pygame.draw.circle(). It doesn't crash, which makes me think it should work, but I don't see the circle, which makes me think it doesn't. Also, blitting surfaces crashes. Is there a workaround? Ian

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-02 Thread Ian Mallett
On 8/2/07, Dave LeCompte (really) <[EMAIL PROTECTED]> wrote: > > "Ian Mallett" <[EMAIL PROTECTED]> wrote: > > There's a selection buffer? I don't know how to use buffers, though I > > think > > I see what you're saying. > > > Have you read this? I have now :-) http://www.opengl.org/resources/fa

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-02 Thread Ian Mallett
On 8/2/07, Dave LeCompte (really) <[EMAIL PROTECTED]> wrote: > > "Michael George" <[EMAIL PROTECTED]> wrote: > > Just out of curiousity, have you compared your approach the gluPick and > > the selection buffer infrastructure in openGL? > > I haven't done performance tests, but several of my concern

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-02 Thread Dave LeCompte (really)
"Ian Mallett" <[EMAIL PROTECTED]> wrote: > There's a selection buffer? I don't know how to use buffers, though I > think > I see what you're saying. Have you read this? http://www.opengl.org/resources/faq/technical/selection.htm It talks about several methods, including - your method, using gl

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-02 Thread Dave LeCompte (really)
"Michael George" <[EMAIL PROTECTED]> wrote: > Just out of curiousity, have you compared your approach the gluPick and > the selection buffer infrastructure in openGL? I haven't done performance tests, but several of my concerns about glReadPixel from the color buffer remain valid with the selectio

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-02 Thread Ian Mallett
On 8/2/07, Michael George <[EMAIL PROTECTED]> wrote: > > Just out of curiousity, have you compared your approach the gluPick and > the selection buffer infrastructure in openGL? Sorry? Also, some of the things I've read about selection suggest using the > back buffer for selection but not flippi

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-02 Thread Michael George
Just out of curiousity, have you compared your approach the gluPick and the selection buffer infrastructure in openGL? Also, some of the things I've read about selection suggest using the back buffer for selection but not flipping. This means you can actually really use different colors for e

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-02 Thread Ian Mallett
You're right about the multiple atoms of the same type. This should only be a problem if two of the same atom are behind each other, then a simple depth test should do it. If you think that doesn't work, let me know here. I'll try this "glReadPixelsb(x, y, 1, 1, GL_RGB)" right now.

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-02 Thread Dave LeCompte (really)
"Ian Mallett" <[EMAIL PROTECTED]> wrote: > Hi, > I'm making a program for visualizing molecules. Each atom will be > selected > by the mouse. Since I know the color of each atom, my idea for detecting > if > a mouse is over one is as follows: > > 1: get the color of the pixel the mouse is over >

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-02 Thread Brian Fisher
This is just me assuming based on the documentation link I sent you... but wouldn't: glReadPixelsb(x, y, 1, 1, GL_RGB) return you a 3 tuple of Red, Green Blue? ... one other note, doing this as a way of doing mouse hit detection is possibly a bad idea - some older video cards don't actually do

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-02 Thread Ian Mallett
On 8/2/07, Brian Fisher <[EMAIL PROTECTED]> wrote: > > glReadPixels reads from the frame buffer - I'm not sure if it means > back buffer or front buffer, but I think it's back > http://pyopengl.sourceforge.net/documentation/manual/glReadPixels.3G.xml > > On 8/2/07, Ian Mallett <[EMAIL PROTECTED]> w

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-02 Thread Brian Fisher
glReadPixels reads from the frame buffer - I'm not sure if it means back buffer or front buffer, but I think it's back http://pyopengl.sourceforge.net/documentation/manual/glReadPixels.3G.xml On 8/2/07, Ian Mallett <[EMAIL PROTECTED]> wrote: > Hi, > I'm making a program for visualizing molecules.

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-02 Thread Michael George
In fact I was just reading a bit more on picking since I was a little curious myself and I came across this tutorial (also in C) which describes both approaches: http://www.lighthouse3d.com/opengl/picking/ --Mike Jason Massey wrote: Doesn't OpenGL have something similar to the surface functi

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-02 Thread Michael George
I'm not entirely sure, but I think what you actually want is http://pyopengl.sourceforge.net/documentation/manual/gluPickMatrix.3G.xml this lets you render a small portion of the scene (like the portion that's under the cursor) and stores the rendered objects into a selection buffer. --Mike I

Re: [pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-02 Thread Jason Massey
Doesn't OpenGL have something similar to the surface functions? A quick google turned up: http://gpwiki.org/index.php/OpenGL_Selection_Using_Unique_Color_IDs Admittedly it's in C but the OpenGL functions should all be very similar. On 8/2/07, Ian Mallett <[EMAIL PROTECTED]> wrote: > > Hi, > I'

[pygame] Collision Detection with Pygame/OpenGL Surfaces

2007-08-02 Thread Ian Mallett
Hi, I'm making a program for visualizing molecules. Each atom will be selected by the mouse. Since I know the color of each atom, my idea for detecting if a mouse is over one is as follows: 1: get the color of the pixel the mouse is over 2: if the color is __ select the atom with that color. Th