Hello guys, I'm sorry if this has been asked before, but I'm having a heck
of a time, probably putting 16 hours of trying on this, and Google and the
archive have been no help so far.

I'm using wxLua on OSX10.5 and attempting to get a "Hello world" type
program working on wxGLCanvas().

Basic problem:
    - Have my own custom wxWindows program, running as an OSX app.  Using a
wxLua interpreter.
    - Used the wxLua binding system to create rudimentary OpenGL bindings
(I've tried other pre-made GL bindings, but those approaches but got crashes
when dynamic libraries were being loaded that I couldn't track down).
    - Linked against the stock OSX OpenGL.framework.
    - Created a window in lua, added a wxGLContext.

Result:
    - It shows up grey, no rendering.

Any help is appreciated.  I can provide any further information that might
be needed.

Lua Code:
--------------------------------------------------------------------------------------------------------------

package.cpath = package.cpath ..
";./?.dll;./?.so;../lib/?.so;../lib/vc_dll/?.dll;../lib/bcc_dll/?.dll;../lib/mingw_dll/?.dll;./lua/?.so;"
package.path  = package.path .. ";./lua/?.lua;./lua/LuaCommon/?.lua;"

require 'wx'
require 'lpc'

require 'Utility'

require 'consoleTextCtrl_wx'

widgets    = { }
timers     = { }

function UpdateGL()
    Log("Test Timer!\n")

    local win = widgets.gl

    win:GetContext():SetCurrent()

    gl.glLoadIdentity()
    gl.glTranslatef(-1.5,0.0,-6.0)
    gl.glBegin(GL_TRIANGLES)
        gl.glVertex3f( 0.0, 1.0, 0.0)
        gl.glVertex3f(-1.0,-1.0, 0.0)
        gl.glVertex3f( 1.0,-1.0, 0.0)
    gl.glEnd()

    gl.glTranslatef(3.0,0.0,0.0)
    gl.glBegin(GL_QUADS)
        gl.glVertex3f(-1.0, 1.0, 0.0)
        gl.glVertex3f( 1.0, 1.0, 0.0)
        gl.glVertex3f( 1.0,-1.0, 0.0)
        gl.glVertex3f(-1.0,-1.0, 0.0)
    gl.glEnd()

    win:SwapBuffers()
end

function CreateMainWindow()
    widgets.test = wx.wxFrame(wx.NULL, wx.wxID_ANY, "Test")
    widgets.test:SetSize(wx.wxRect(860, 200, 480, 360))
    widgets.test:Show(true)

    widgets.gl = wx.wxGLCanvas(widgets.test, -1)
    timers.gl  = wx.wxTimer(widgets.gl)

    widgets.gl:Connect(wx.wxEVT_TIMER, UpdateGL)
    timers.gl:Start(500)

    widgets.gl:SetCurrent()
    widgets.gl:SetFocus(true)
    widgets.gl:Show(true)

    gl.glShadeModel(gl.GL_SMOOTH)
    gl.glClearColor(1.0, 0.0, 0.0, 0.5)
    gl.glClearDepth(1.0)
    gl.glEnable(gl.GL_DEPTH_TEST)
    gl.glDepthFunc(gl.GL_LEQUAL)
    gl.glHint(gl.GL_PERSPECTIVE_CORRECTION_HINT, gl.GL_NICEST)
end

----------------------------------------------------------------------------------------------------
-- Get this party started!
-------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------

CreateMainWindow()

wx.wxGetApp():MainLoop()
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to