That did the trick! I've attached proof of concept code for embedding a
wxGLCanvas within a wxFrame.  It uses luaglut for the GL calls. I have not
quite yet figured out how to properly handle idle events, as the GL draw
loop hogs UI control. Suggestions welcome. ;)

Thanks,
/joeyo


On Wed, Jan 03, 2007 at 12:56:15PM -0500, John Labenski wrote:
> It looks like we need to add the gl lib to the configure checks eventually.
> 
> For now you use the environment variable before running configure.
> $export LDFLAGS=-lwx_gtk2_gl-2.8
> 
> 
> Regards,
>     John Labenski
> 
> 
> On 1/2/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > Hi John, et al.
> >
> > I've tried again with wxLua_Snapshot_2007-01-01 and pasted the errors
> > below.
> >
> > Thanks,
> > /joeyo
> >
> > k2_adv-2.8 -lwx_base_net-2.8 -lwx_base_xml-2.8 -lwx_gtk2_core-2.8
> > -lwx_base-2.8
> > ../lib/libwxlua_gtk2_wxbind-2.8.so: undefined reference to
> > `wxGLCanvas::SwapBuffers()'
> > ../lib/libwxlua_gtk2_wxbind-2.8.so: undefined reference to
> > `wxGLCanvas::wxGLCanvas(wxWindow*, wxGLContext const*, int, wxPoint const&,
> > wxSize const&, long, wxString const&, int*, wxPalette const&)'
> > ../lib/libwxlua_gtk2_wxbind-2.8.so: undefined reference to
> > `wxGLContext::wxGLContext(wxWindow*, wxGLContext const*)'
> > ../lib/libwxlua_gtk2_wxbind-2.8.so: undefined reference to
> > `wxGLContext::SetCurrent(wxGLCanvas const&) const'
> > ../lib/libwxlua_gtk2_wxbind-2.8.so: undefined reference to
> > `wxGLCanvas::SetCurrent(wxGLContext const&) const'
> > ../lib/libwxlua_gtk2_wxbind-2.8.so: undefined reference to
> > `wxGLContext::ms_classInfo'
> > ../lib/libwxlua_gtk2_wxbind-2.8.so: undefined reference to
> > `wxGLCanvas::ms_classInfo'
> > ../lib/libwxlua_gtk2_wxbind-2.8.so: undefined reference to
> > `wxGLCanvas::SetColour(char const*)'
> > ../lib/libwxlua_gtk2_wxbind-2.8.so: undefined reference to
> > `wxGLCanvas::wxGLCanvas(wxWindow*, wxGLCanvas const*, int, wxPoint const&,
> > wxSize const&, long, wxString const&, int*, wxPalette const&)'
> > ../lib/libwxlua_gtk2_wxbind-2.8.so: undefined reference to
> > `wxGLCanvas::SetCurrent()'
> > ../lib/libwxlua_gtk2_wxbind-2.8.so: undefined reference to
> > `wxGLCanvas::wxGLCanvas(wxWindow*, int, wxPoint const&, wxSize const&,
> > long, wxString const&, int*, wxPalette const&)'
> > collect2: ld returned 1 exit status
> > make[1]: *** [../bin/wxlua] Error 1
> >
> >
> > On Sat, Dec 23, 2006 at 01:19:12AM -0500, John Labenski wrote:
> > > I've applied a fix (well, updated it for 2.8) so it compiles now, but
> > > I haven't checked if the wxgl lib is linked to or not. Please let us
> > > know if it works as expected.
> > >
> > > Regards,
> > >     John Labenski
> > >
> > >
> > > On 12/22/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > > > Hi,
> > > >
> > > > I get the following errors when compiling wxLua_Snapshot_2006-12-22
> > > > with wxLUA_USE_wxGLCanvas enabled. I have enabled openGL and GLCanvas in
> > > > wxGTK and that part seems to be working.
> > > >
> > > > Thanks,
> > > > /joeyo
> > > >
> > > > ./wxbind/src/gdi.cpp: In function 'int wxLua_wxRect_Inside(lua_State*)':
> > > > ./wxbind/src/gdi.cpp:806: warning: 'Inside' is deprecated (declared at
> > > > /usr/local/include/wx-2.8/wx/gdicmn.h:486)
> > > > ./wxbind/src/gdi.cpp: In function 'int
> > > > wxLua_wxGLCanvas_constructor(lua_State*)':
> > > > ./wxbind/src/gdi.cpp:10368: error: invalid conversion from 'const int*' 
> > > > to
> > > > 'int*'
> > > > ./wxbind/src/gdi.cpp:10368: error:   initializing argument 7 of
> > > > 'wxGLCanvas::wxGLCanvas(wxWindow*, wxWindowID, const wxPoint&, const 
> > > > wxSize
> > > > &, long int, const wxString&, int*, const wxPalette&)'
> > > > ./wxbind/src/gdi.cpp: In function 'int
> > > > wxLua_wxGLCanvasFromContext_constructor(lua_State*)':
> > > > ./wxbind/src/gdi.cpp:10405: error: invalid conversion from 'const int*' 
> > > > to
> > > > 'int*'
> > > > ./wxbind/src/gdi.cpp:10405: error:   initializing argument 8 of
> > > > 'wxGLCanvas::wxGLCanvas(wxWindow*, const wxGLContext*, wxWindowID, 
> > > > const wx
> > > > Point&, const wxSize&, long int, const wxString&, int*, const 
> > > > wxPalette&)'
> > > > ./wxbind/src/gdi.cpp: In function 'int
> > > > wxLua_wxGLCanvasFromCCanvas_constructor(lua_State*)':
> > > > ./wxbind/src/gdi.cpp:10442: error: invalid conversion from 'const int*' 
> > > > to
> > > > 'int*'
> > > > ./wxbind/src/gdi.cpp:10442: error:   initializing argument 8 of
> > > > 'wxGLCanvas::wxGLCanvas(wxWindow*, const wxGLCanvas*, wxWindowID, const 
> > > > wxP
> > > > oint&, const wxSize&, long int, const wxString&, int*, const 
> > > > wxPalette&)'
> > > > ./wxbind/src/gdi.cpp: In function 'int
> > > > wxLua_wxGLContext_constructor(lua_State*)':
> > > > ./wxbind/src/gdi.cpp:10565: error: no matching function for call to
> > > > 'wxGLContext::wxGLContext(bool&, wxGLCanvas*&, const wxPalette&)'
> > > > /usr/local/include/wx-2.8/wx/gtk/glcanvas.h:39: note: candidates are:
> > > > wxGLContext::wxGLContext(wxWindow*, const wxGLContext*)
> > > > /usr/local/include/wx-2.8/wx/gtk/glcanvas.h:37: note:
> > > > wxGLContext::wxGLContext(const wxGLContext&)
> > > > ./wxbind/src/gdi.cpp: In function 'int
> > > > wxLua_wxGLContextOther_constructor(lua_State*)':
> > > > ./wxbind/src/gdi.cpp:10592: error: no matching function for call to
> > > > 'wxGLContext::wxGLContext(bool&, wxGLCanvas*&, const wxPalette&, const
> > > > wxGLContext*&)'
> > > > /usr/local/include/wx-2.8/wx/gtk/glcanvas.h:39: note: candidates are:
> > > > wxGLContext::wxGLContext(wxWindow*, const wxGLContext*)
> > > > /usr/local/include/wx-2.8/wx/gtk/glcanvas.h:37: note:
> > > > wxGLContext::wxGLContext(const wxGLContext&)
> > > > ./wxbind/src/gdi.cpp: In function 'int
> > > > wxLua_wxGLContext_GetWindow(lua_State*)':
> > > > ./wxbind/src/gdi.cpp:10613: error: 'class wxGLContext' has no member 
> > > > named
> > > > 'GetWindow'
> > > > ./wxbind/src/gdi.cpp: In function 'int
> > > > wxLua_wxGLContext_SetCurrent(lua_State*)':
> > > > ./wxbind/src/gdi.cpp:10628: error: no matching function for call to
> > > > 'wxGLContext::SetCurrent()'
> > > > /usr/local/include/wx-2.8/wx/gtk/glcanvas.h:44: note: candidates are: 
> > > > void
> > > > wxGLContext::SetCurrent(const wxGLCanvas&) const
> > > > ./wxbind/src/gdi.cpp: In function 'int
> > > > wxLua_wxGLContext_SetColour(lua_State*)':
> > > > ./wxbind/src/gdi.cpp:10643: error: 'class wxGLContext' has no member 
> > > > named
> > > > 'SetColour'
> > > > ./wxbind/src/gdi.cpp: In function 'int
> > > > wxLua_wxGLContext_SwapBuffers(lua_State*)':
> > > > ./wxbind/src/gdi.cpp:10656: error: 'class wxGLContext' has no member 
> > > > named
> > > > 'SwapBuffers'
> > > > make[1]: *** [wxbind_dll_gdi.o] Error 1
> > > >
> > > > -------------------------------------------------------------------------
> > > > Take Surveys. Earn Cash. Influence the Future of IT
> > > > Join SourceForge.net's Techsay panel and you'll get the chance to share 
> > > > your
> > > > opinions on IT & business topics through brief surveys - and earn cash
> > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > > > _______________________________________________
> > > > wxlua-users mailing list
> > > > wxlua-users@lists.sourceforge.net
> > > > https://lists.sourceforge.net/lists/listinfo/wxlua-users
> > > >
> > >
> > > -------------------------------------------------------------------------
> > > Take Surveys. Earn Cash. Influence the Future of IT
> > > Join SourceForge.net's Techsay panel and you'll get the chance to share 
> > > your
> > > opinions on IT & business topics through brief surveys - and earn cash
> > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > > _______________________________________________
> > > wxlua-users mailing list
> > > wxlua-users@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/wxlua-users
> >
> > --
> > pub  1024D/B663781B 2001-11-13 Joey O'Doherty <joey(at)odoherty(dot)net>
> >      Key fingerprint = F76B 9ACA 4197 C707 6E4D  2B78 E430 101A B663 781B
> >
> >      The sad fact is that "national security" has become the root password
> >      to the Constitution. -- Phil Karn
> >
> > -------------------------------------------------------------------------
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to share your
> > opinions on IT & business topics through brief surveys - and earn cash
> > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > _______________________________________________
> > wxlua-users mailing list
> > wxlua-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wxlua-users
> >
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> wxlua-users mailing list
> wxlua-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wxlua-users

-- 
pub  1024D/B663781B 2001-11-13 Joey O'Doherty <joey(at)odoherty(dot)net>
     Key fingerprint = F76B 9ACA 4197 C707 6E4D  2B78 E430 101A B663 781B

     The sad fact is that "national security" has become the root password 
     to the Constitution. -- Phil Karn
-- glcanvas.wx.lua

require 'luagl'
require 'luaglut'

frame = nil

function main()

        frame = wx.wxFrame(wx.wxNull,
                        wx.wxID_ANY,
                        "wx.GLCanvas test",
                        wx.wxDefaultPosition,
                        wx.wxSize(550, 350))
        
        -- create a simple file menu
        local fileMenu = wx.wxMenu()
        fileMenu:Append(wx.wxID_EXIT, "E&xit", "Quit the program")
        -- create a simple help menu
        local helpMenu = wx.wxMenu()
        helpMenu:Append(wx.wxID_ABOUT, "&About","About")

        -- create a menu bar and append the file and help menus
        local menuBar = wx.wxMenuBar()
        menuBar:Append(fileMenu, "&File")
        menuBar:Append(helpMenu, "&Help")
        -- attach the menu bar into the frame
        frame:SetMenuBar(menuBar)
                        
        glcanvas = wx.wxGLCanvas(frame,
                                        wx.wxID_ANY,
                                        wx.wxDefaultPosition,
                                        wx.wxDefaultSize,
                                        wx.wxSUNKEN_BORDER)
        
        frame:Show(true)

        -- connect the selection event of the exit menu item to an
        -- event handler that closes the window
        frame:Connect(wx.wxID_EXIT, wx.wxEVT_COMMAND_MENU_SELECTED,
                function(event)
                        frame:Close(true)
                end)

        -- connect the selection event of the about menu item
        frame:Connect(wx.wxID_ABOUT, wx.wxEVT_COMMAND_MENU_SELECTED,
                function (event)
                        wx.wxMessageBox('This is the "About" dialog.',
                        "About",
                        wx.wxOK + wx.wxICON_INFORMATION,frame)
                end)
        
        frame:Connect(wx.wxEVT_IDLE,
                function(event)
                        glcanvas:SetCurrent()
                        wx.wxSafeYield()
                        glClearColor(0.0, 0.0, 0.0, 0.0)
                        glViewport(0, 0, 200, 200)
                        glColor3d(1.0, 0.0, 0.0)
    
                        glBegin(GL_POLYGON)
                        glVertex2d(-0.5, -0.5)
                        glVertex2d(-0.5, 0.5)
                        glVertex2d(0.5, 0.5)
                        glVertex2d(0.5, -0.5)
                        glEnd()
                        glFinish()

                        glcanvas:SwapBuffers()
        
                        event:RequestMore()

                end)
        
end

main()
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to