Thread: [PyOpenGL-Users] Problems creating a simple 3D engine
Brought to you by:
mcfletch
From: soul <sou...@te...> - 2004-11-08 22:29:13
|
Hi! I'm creating a simple 3D engine using pyopengl. At firt time, i developing camera movement and I have found with these problems.=20 - To implement mouse view, i must put mouse position in the middle of my aplicaci=F3n windows and i don't know how to do it? Maybe using pySDL ? I don't know - How can i put a pyopengl window in a wxpython aplication ? - There are some way to solve the "fedora core 2/glut functions like glutKeyboardUpFunc" problem ? or i must wait fot next version on pyopengl ? Thanks a lot! Soul =20 |
From: Tom D. <td...@yo...> - 2004-11-08 22:58:05
|
soul wrote: > Hi! I'm creating a simple 3D engine using pyopengl. At firt time, i > developing camera movement and I have found with these problems. > > - To implement mouse view, i must put mouse position in the middle of my > aplicación windows and i don't know how to do it? Maybe using pySDL ? I > don't know pygame is built on top of SDL and up to date. > > - How can i put a pyopengl window in a wxpython aplication ? An example... "Use wxPython/OpenGL to draw a sphere" http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/325392 > > - There are some way to solve the "fedora core 2/glut functions like > glutKeyboardUpFunc" problem ? or i must wait fot next version on > pyopengl ? > Don't know, but if you're working with wx and/or pygame, they provide access to the mouse. |
From: Mike C. F. <mcf...@ro...> - 2004-11-11 19:03:01
|
soul wrote: >Hi! I'm creating a simple 3D engine using pyopengl. At firt time, i >developing camera movement and I have found with these problems. > >- To implement mouse view, i must put mouse position in the middle of my >aplicación windows and i don't know how to do it? Maybe using pySDL ? I >don't know > > Not really sure what you're trying to do, whether you mean "moving the mouse cursor to the center of the window", which is often called "warping" the pointer, or whether you mean you want access to the mouse position in your window. Both are functions of the GUI library you use (i.e. PyGame, GLUT, Tkinter, FxPy or wxPython). >- How can i put a pyopengl window in a wxpython aplication ? > > There is a wxGLCanvas class which provides a fairly generic OpenGL canvas. You can see such a canvas in the wxPython demo, as well as in OpenGLContext's wxcontext.py module. >- There are some way to solve the "fedora core 2/glut functions like >glutKeyboardUpFunc" problem ? or i must wait fot next version on >pyopengl ? > > You'll have to wait for the next release or use the CVS repository and rebuild the wrappers with swig 1.3.13. I'll be trying to get enough time to do a release this upcoming weekend. BTW, you might want to check out some of the other simple Python 3D scenegraph engines, such as Zoe or SPyRE, you can find links to them here: http://www.vrplumber.com/py3d.py?category=retained and consider using them as a starting point (keeping in mind that those two are LGPL-licensed). Have fun, Mike ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: soul <sou...@te...> - 2004-11-11 21:02:35
|
El jue, 11-11-2004 a las 14:02 -0500, Mike C. Fletcher escribi=F3: > Not really sure what you're trying to do, whether you mean "moving the=20 > mouse cursor to the center of the window", which is often called=20 > "warping" the pointer, or whether you mean you want access to the mouse=20 > position in your window. Both are functions of the GUI library you use=20 > (i.e. PyGame, GLUT, Tkinter, FxPy or wxPython). >=20 I mean "moving cursor to the center of the window" :-P. Sorry! My is not very good. I'm trying to implement a mouse view like 3th person games and i need to hold mouse in center of my application window to do this.=20 I know how to get mouse position using GLUT but i don't know how to set mouse coords. Can you explain me? =20 Thanks Soul Soul ************************************************* ( sou...@te... ) |
From: Mike C. F. <mcf...@ro...> - 2004-11-11 21:47:11
|
soul wrote: ... >I mean "moving cursor to the center of the window" :-P. Sorry! My is not >very good. I'm trying to implement a mouse view like 3th person games >and i need to hold mouse in center of my application window to do >this. > >I know how to get mouse position using GLUT but i don't know how to set >mouse coords. Can you explain me? > > I think you are probably looking for something like what you see in this: *set_visible * pygame.mouse.set_visible(bool) -> bool Shows or hides the mouse cursor. This will return the previous visible state of the mouse cursor. Note that when the cursor is hidden and the application has grabbed the input. pygame will force the mouse to stay in the center of the screen. Since the mouse is hidden it won't matter that it's not moving, but it will keep the mouse from the edges of the screen so the relative mouse position will always be true. which seems tailor-made for what I gather you're trying to do (i.e. create a Quake/Doom style navigation mechanism, where you draw something in the center of the screen and pretend that's the mouse cursor, and moving the mouse moves the head of the avatar to change what you're looking at). Don't know of a similar mechanism under wxPython or GLUT, but I'd guess *someone* has written them at some point. HTH, Mike ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |
From: soul <sou...@te...> - 2004-11-15 18:30:22
|
I have solved the "mouse view" problem with this function: void glutWarpPointer(int x, int y); This function set the mouse in the x,y positon and this other hide the cursor. glutSetCursor(GLUT_CURSOR_NONE) Using this i don't need use pygame,wxpython or pysdl. Thanks Mike! Soul ************************************************* ( sou...@te... ) |
From: altern <en...@al...> - 2004-11-21 19:25:27
|
hi i am doing a 2D engine with ortographic proyection. I need to implement alpha blend and also depth, so that the shapes can be drawn at different z depths but also that the ones on front get blended against the ones behind. I am getting problems to achive this as either they wont blend or they wont get drawn on the depth they should. After checking out for the whole day and read the redbook and some online examples ... as far as i understand i need to play around with these parameters glEnable(GL_BLEND) glDepthMask (GL_FALSE) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) #before i draw the alpha shapes, and this: glDepthMask (GL_TRUE) glDisable (GL_BLEND) #before the shapes with no alpha But still i doesnt work properly. Maybe i need to switch alpha on before drawing alpha shapes and as soon as they are drawn switch it off. i am not sure, i have done hundreds of tests today and i am really confused. can anyone point into some example or solution? thanks -- enrike |