[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] more opengl



enrike wrote:

hi all

sorry this is a bit off topic i guess.
i am trying out the glcanvas from wxPython to display openGL graphics
but i cannot find some simple example or some tutorial about this
especific issue. I tried out the example from wxpython demo but i am
totally unable to extract the code from there and run it outside the
demo application.
I don't really have any *simple* wxPython examples, my simplest example is dozens of times more complex than the one in the wxPython demo, as it uses OpenGLContext's wxContext (which does *far* more than the demo).

I have been learning opengl using a GLUT window and events and this
seems to be different.
It's fairly similar, just event-driven instead of callback-driven. GLUT is a simpler environment all in all, with that being both a strength and a weakness.

So far I manage to create a frame with a ogl canvas inside and i can
change the backg color but i cannot get much further ....
also i dont understand how to init the glcanvas class as there is a
parameter called 'attribList' but its not explained either on the
wxWidgets help. Obviously once again i am doing sthg wrong :-)
From OpenGLContext.wxcontext:
attribList = [
WX_GL_RGBA,
#WX_GL_BUFFER_SIZE, 8, # alternative to WX_GL_RGBA
#WX_GL_LEVEL, #0 for main buffer, >0 for overlay, <0 for underlay
WX_GL_DOUBLEBUFFER, # use doublebuffer #
#WX_GL_STEREO, # use stereoscopic display #
#WX_GL_AUX_BUFFERS, 1, # number of auxiliary buffers #
#WX_GL_MIN_RED, 8, # use red buffer with most bits (> MIN_RED bits) #
#WX_GL_MIN_GREEN, 8, # use green buffer with most bits (> MIN_GREEN bits) #
#WX_GL_MIN_BLUE, 8, # use blue buffer with most bits (> MIN_BLUE bits) #
#WX_GL_MIN_ALPHA, 8, # use alpha buffer with most bits (> MIN_ALPHA bits) #
#WX_GL_DEPTH_SIZE, 16, # bits for Z-buffer (0,16,32) #
WX_GL_STENCIL_SIZE, 8, # bits for stencil buffer #
#WX_GL_MIN_ACCUM_RED, 8, # use red accum buffer with most bits (> MIN_ACCUM_RED bits) #
#WX_GL_MIN_ACCUM_GREEN, 8, # use green buffer with most bits (> MIN_ACCUM_GREEN bits) #
#WX_GL_MIN_ACCUM_BLUE, 8, # use blue buffer with most bits (> MIN_ACCUM_BLUE bits) #
#WX_GL_MIN_ACCUM_ALPHA, 8, # use blue buffer with most bits (> MIN_ACCUM_ALPHA bits) #
]

I think I took that from the wxPython source-code originally.

I already asked in the wxpython list but they dont seem to be very interested on this.
As a fraction of total users, OpenGL is a pretty small subset of the wxPython userbase. The PyOpenGL-users list is probably the correct venue for questions about wxPython's wxGLCanvas that aren't specifically related to the GUI library itself. I'm on the wxPython list, but I don't really have a "simple" wxPython demo available, so didn't post a response to your original message, hoping someone else would have one.

You may find that reading the source of OpenGLContext.wxcontext gives you most of the "translation" you need to move from GLUT to wxPython operation. OpenGLContext is designed so that the common OpenGL code is in the base class and each GUI library has a sub-class that defines the GUI-library-specific code.

Good luck,
Mike

________________________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://www.vrplumber.com
http://blog.vrplumber.com