Re: [PyOpenGL-Users] Converting C++ code to python code
Brought to you by:
mcfletch
From: Joshua R. D. <joshuardavis@q.com> - 2011-04-17 17:55:44
|
Converting C/C++ OpenGL code to PyOpenGL code takes a little practice, due to small alterations in how PyOpenGL function calls use parameters. Rather than directly answering your question, let me point you to completely abstracted PyOpenGL picking and collision-testing functions on my web site: http://www.joshuadavis.us/software/selection.py You can use this code as-is, or you can view it as a tutorial. Also, please be aware that the selection mechanism is deprecated in OpenGL now. It is preferable to pick using the back buffer, for example. Hope this helps. Josh On 2011 Apr 17, at 12:02 PM, Abhijeet Rastogi wrote: > I have a function in C++ which goes like this . > > void selection(int x, int y, int win) { > // Space for selection buffer > static GLuint selectBuff[BUFFER_LENGTH]; > GLint hits, viewport[4]; > > // Setup selection buffer and get the view port > glSelectBuffer(BUFFER_LENGTH, selectBuff); > glGetIntegerv(GL_VIEWPORT, viewport); > > // Switch to projection and save the matrix > glMatrixMode(GL_PROJECTION); > glPushMatrix(); > ... > ... > > OK. So, now, first of all, in C++ code, it has defined the variables and then called glGetIntegerv. How am I supposed to do the same in python code. > Please help. I am just beginner trying to learn opengl. > > For the full code, you can search for function selection in http://sprunge.us/fAaf > > -- > Regards, > Abhijeet Rastogi (shadyabhi) > http://www.google.com/profiles/abhijeet.1989 > ------------------------------------------------------------------------------ > Benefiting from Server Virtualization: Beyond Initial Workload > Consolidation -- Increasing the use of server virtualization is a top > priority.Virtualization can reduce costs, simplify management, and improve > application availability and disaster protection. Learn more about boosting > the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev_______________________________________________ > PyOpenGL Homepage > http://pyopengl.sourceforge.net > _______________________________________________ > PyOpenGL-Users mailing list > PyO...@li... > https://lists.sourceforge.net/lists/listinfo/pyopengl-users |