Re: [PyOpenGL-Users] coordinate system axes
Brought to you by:
mcfletch
From: Ian M. <ia...@ge...> - 2013-07-10 04:42:02
|
On Mon, Jul 1, 2013 at 6:39 AM, Jano Ferencik <fer...@gm...>wrote: > Hello there, > > i am fairly new to pyopengl and I am facing some difficulties. > I am trying to create a indicator for the global coordinate system in the > corner of a glcanvas wndow. I managed to create the lines but I am not able > to rotate them when the object rotates > I suspect I am not isolating the transform matrices correctly. > > Currently I can see the cube and the coordinate system indicator but the > latter is fixed when I rotate the cube. I would lie the indicator to rotate > so it will be clear in which direction the object was rotated > > The code comes from a bunch of examples i found online a > You should probably find some better examples. I only skimmed the code, but already I could see there's some very dodgy stuff there--initializing glut every time you draw, the resize and view methods (ultimately from NeHe), and just general stylistic things that tell me the author didn't really *get * it (e.g. ".createCube(self)" does no such thing). The GUI part is probably more okay, but honestly if you want my advice, redo the OpenGL part entirely. Amazingly, there's not a lot of great code demonstrating how to do this on the web, but, at the risk of self-promotion, I do have an Introductory OpenGL Tutorial<http://www.geometrian.com/programming/tutorials/introgl/index.php>that would probably be very helpful for getting started with OpenGL 2 style programs. It's written for C++/C99, but it's quite readable to Python users. Once you understand the theory behind this stuff, you might like my PyOpenGL Base Code<http://www.geometrian.com/programming/tutorials/OpenGL%20Program%20Shell.py.txt>, which is a well-tested, proven Python template for starting PyOpenGL code. It requires PyGame, which works very nicely with PyOpenGL. Theoretically, you could alter it to use GLUT, but you shouldn't be using that anyway. Lastly, my suggestions for future help might point you to the forums at GameDev.net, which has a special OpenGL board, lots of OpenGL-related resources, and a generally faster turnaround time. HTH, Ian |