Hi,
I'm stumped. I'm trying to setup a Boa app with OpenGL Context using the wxcontext class. I'm following the instructions in Example 5-1 in the Red Book (Version 1.1). I would appreicate some pointers. The sphere is not reflecting light as it should. I've eliminated surface normals as a potential problem by calling glutSolidSphere.
 
Thanks,
Joseph
 
#Code Starts Here
 
 
#Boa:Frame:wxFrame1
 
from wxPython.wx import *
from OpenGLContext import wxcontext
from OpenGL import *
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
from Numeric import *
def create(parent):
    return wxFrame1(parent)
 
[wxID_WXFRAME1, wxID_WXFRAME1SPLITTERWINDOW1,
] = map(lambda _init_ctrls: wxNewId(), range(2))
 
class DrawProperties:
    """Holds Properties for OpenGL parameters"""
    def __init__(self):
        """Initialization Method"""
       
       
class DrawContext(wxcontext.wxContext):
    """OpenGL Context Class"""
    def __init__(self,parent,objProps=None):
        """Initialization Method"""
        wxcontext.wxContext.__init__(self,parent)
        self.objProps = objProps
       
    def DoInit(self):
        """Init Method"""
        glClearColor(0.0,0.0,0.0,0.0)
        mat_specular = array([1.0,1.0,1.0,1.0])
        mat_shininess = array([50.0])
       
        glShadeModel(GL_SMOOTH)
        glMaterialfv(GL_FRONT,GL_SPECULAR,mat_specular)
        glMaterialfv(GL_FRONT,GL_SHININESS,mat_shininess)
       
        light_model_ambient = array([0.2,0.2,0.2,1.0])
        glLightModelfv(GL_LIGHT_MODEL_AMBIENT,light_model_ambient)
        glLightfv(GL_LIGHT0,GL_AMBIENT,light_model_ambient)
       
        glEnable(GL_LIGHTING);
        glEnable(GL_LIGHT0);
        glEnable(GL_DEPTH_TEST);
       
    def Render( self, mode = None):
        """This method is call repeatly"""
        glTranslated (0,0,0);
        gluLookAt(2.0,2.0,2.0,0.0,0.0,0.0,0.0,1.0,0.0);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
        #drawcube.drawCube()
        glutSolidSphere(1.0,20,16);
        glFlush()
       
    def Viewpoint(self,mode=None):
        """Overloaded Method"""
        glLoadIdentity()
        # calculate a 3D perspective view
        glFrustum(-0.5, 0.5, -0.5, 0.5, .5, 5.0);
   
    def Lights(self,mode=None):
        """pass"""
 
class wxFrame1(wxFrame):
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wxFrame.__init__(self, id=wxID_WXFRAME1, name='', parent=prnt,
              pos=wxPoint(444, 241), size=wxSize(502, 411),
              style=wxDEFAULT_FRAME_STYLE, title='wxFrame1')
        self.SetClientSize(wxSize(494, 376))
 
        self.splitterWindow1 = wxSplitterWindow(id=wxID_WXFRAME1SPLITTERWINDOW1,
              name='splitterWindow1', parent=self, point=wxPoint(296, 144),
              size=wxSize(376, 280), style=wxSP_3D)
 
    def init_context(self):
        """Context Initialization Code """
        self.objProps = DrawProperties()
        self.p1 = wxWindow(self.splitterWindow1, -1)
        self.DrawContext = DrawContext(self.splitterWindow1,objProps=self.objProps)
 
        self.splitterWindow1.SetMinimumPaneSize(0)
        self.splitterWindow1.SplitVertically(self.p1, self.DrawContext, 100)
 
    def init_SetProps(self):
        """Initilize OpenGL Props"""
 
    def __init__(self, parent):
        self._init_ctrls(parent)
        self.init_context()
        self.init_SetProps()
       
    def OnSlider1Scroll(self, event):
        #self.staticText2.SetLabel(str(self.slider1.GetValue()))
        event.Skip()
 
class BoaApp(wxApp):
    def OnInit(self):
        wxInitAllImageHandlers()
        self.main = create(None)
        # needed when running from Boa under Windows 9X
        self.SetTopWindow(self.main)
        self.main.Show();self.main.Hide();self.main.Show()
        return True
 
def main():
    application = BoaApp(0)
    application.MainLoop()
 
if __name__ == '__main__':
    main()
#Code Ends Here