<div class="gmail_quote">
<div>Hello,</div>
<div> </div>
<div>i found an example for OpenGL in windows.</div>
<div>It is incredibly helpful, but how to rewrite it to be useful in Python.</div>
<div> </div>
<div>
<div>How to give address of pfd in Python?:</div>
<div><font color="#1370e3">iFormat = ChoosePixelFormat( hDC, <font color="#ff6666">&</font>pfd );<br>SetPixelFormat( hDC, iFormat, <font color="#ff0000">&</font>pfd );</font> </div></div>
<div> </div>
<div>I found syntax for sizeof and pfd:</div>
<div> </div>
<div>#! /usr/include/pyhton2.4 python</div>
<div>from OpenGL.GLUT import *<br>from OpenGL.GLU import *<br>from OpenGL.GL import *<br>import win32api<br>import sizeof</div>
<div><font color="#000000">pfd=Gdi.PIXELFORMATDESCRIPTOR()<br>ZeroMemory( pfd, ctypes.sizeof( pfd ) )</font></div>
<div> </div>
<div>regards,</div>
<div>Gintare Statkute</div>
<div> </div>
<div>p.s. whole code which i want to use in Python:</div>
<div><a href="http://www.nullterminator.net/opengl32.html" target="_blank">http://www.nullterminator.net/opengl32.html</a> </div>
<div>only the addresses and pointer are not clear (marked in red above)</div>
<div> </div>
<div><pre><font color="#1370e3" size="2">void EnableOpenGL(HWND hWnd, HDC * hDC, HGLRC * hRC)
{
PIXELFORMATDESCRIPTOR pfd;
int iFormat;
// get the device context (DC)
*hDC = GetDC( hWnd );
// set the pixel format for the DC
ZeroMemory( &pfd, sizeof( pfd ) );
pfd.nSize = sizeof( pfd );
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
PFD_DOUBLEBUFFER;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 24;
pfd.cDepthBits = 16;
pfd.iLayerType = PFD_MAIN_PLANE;
iFormat = ChoosePixelFormat( *hDC, &pfd );
SetPixelFormat( *hDC, iFormat, &pfd );
// create and enable the render context (RC)
*hRC = wglCreateContext( *hDC );
wglMakeCurrent( *hDC, *hRC );
}
void DisableOpenGL(HWND hWnd, HDC hDC, HGLRC hRC)
{
wglMakeCurrent( NULL, NULL );
wglDeleteContext( hRC );
ReleaseDC( hWnd, hDC );
}</font></pre></div><font color="#888888">
<div> </div>
<div> </div></font></div><br>