Re: [PyOpenGL-Users] Converting C++ code to python code
Brought to you by:
mcfletch
|
From: Derakon <de...@gm...> - 2011-04-17 17:14:54
|
On Sun, Apr 17, 2011 at 10:02 AM, Abhijeet Rastogi
<abh...@gm...> 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.
Any time that the C version of OpenGL code returns something by
reference, the Python version will just return the value directly. So
you should be able to do this:
selectBuff = glSelectBuffer(BUFFER_LENGTH)
viewport = glGetIntegerv(GL_VIEWPORT)
|