diff options
author | Dan Gudmundsson <[email protected]> | 2013-01-15 09:18:49 +0100 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2013-01-15 09:18:49 +0100 |
commit | 0e044f3525d22de4c4c471f601de50ad3acda304 (patch) | |
tree | dfbbcc31814b0890fcb7774a48cf43322b29ac94 /lib/wx/test/wx_opengl_SUITE.erl | |
parent | fdd0b38e2c85d897a240e5f8f79e268c6540dbfd (diff) | |
parent | c384a91846f7d0aff189fb51d1d502330d7abef4 (diff) | |
download | otp-0e044f3525d22de4c4c471f601de50ad3acda304.tar.gz otp-0e044f3525d22de4c4c471f601de50ad3acda304.tar.bz2 otp-0e044f3525d22de4c4c471f601de50ad3acda304.zip |
Merge branch 'dgud/wx/fix-wx-2.9-compat/OTP-10407'
* dgud/wx/fix-wx-2.9-compat/OTP-10407: (26 commits)
wx: Fix comments
wx: Workaround wx-2.9 bugs
wx: Mac fixes
wx: Fix demo and tests
wx: Allow 64 bits compilation on mac, requires wxWidgets-2.9
appmon: Move runtime part to runtime_tools app
reltool: fix wxWidgets-2.9 compability
debugger: Fix 2.9 compat
observer: Fix check for graphics contexts
Observer: Fix distribution dialog
observer: Fix font sizes
wx: Fix the demo
wx: Fix loading icons and cursors in Windows
wx: Remove unnecessary casts
wx: Fix changed getfunctions
wx: Depricate wxCursor new functions
wx: Fix int to enum
wx: Include correct m4 file in 2.9
wx: Update examples so they work with both wxWidgets 2.8 and 2.9
wx: Modify tests so they work on wxWidgets-2.9
...
Diffstat (limited to 'lib/wx/test/wx_opengl_SUITE.erl')
-rw-r--r-- | lib/wx/test/wx_opengl_SUITE.erl | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/lib/wx/test/wx_opengl_SUITE.erl b/lib/wx/test/wx_opengl_SUITE.erl index e8fdf603d6..f351bc93ed 100644 --- a/lib/wx/test/wx_opengl_SUITE.erl +++ b/lib/wx/test/wx_opengl_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2008-2011. All Rights Reserved. +%% Copyright Ericsson AB 2008-2012. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -92,10 +92,22 @@ canvas(TestInfo) when is_atom(TestInfo) -> wx_test_lib:tc_info(TestInfo); canvas(Config) -> WX = ?mr(wx_ref, wx:new()), Frame = wxFrame:new(WX,1,"Hello 3D-World",[]), - Attrs = [{attribList, [?WX_GL_RGBA,?WX_GL_DOUBLEBUFFER,0]}], - Canvas = ?mt(wxGLCanvas, wxGLCanvas:new(Frame, Attrs)), + Attrs = [{attribList, [?WX_GL_RGBA, + ?WX_GL_DOUBLEBUFFER, + ?WX_GL_MIN_RED,8, + ?WX_GL_MIN_GREEN,8, + ?WX_GL_MIN_BLUE,8, + ?WX_GL_DEPTH_SIZE,24,0]}], + Canvas = ?mt(wxGLCanvas, wxGLCanvas:new(Frame, [{style,?wxFULL_REPAINT_ON_RESIZE}| + Attrs])), + wxFrame:connect(Frame, show), ?m(true, wxWindow:show(Frame)), + + receive #wx{event=#wxShow{}} -> ok + after 1000 -> exit(show_timeout) + end, + ?m(false, wx:is_null(wxGLCanvas:getContext(Canvas))), ?m({'EXIT', {{error, no_gl_context,_},_}}, gl:getString(?GL_VENDOR)), @@ -111,7 +123,7 @@ canvas(Config) -> %%gl:frustum( -2.0, 2.0, -2.0, 2.0, 5.0, 25.0 ), gl:ortho( -2.0, 2.0, -2.0*H/W, 2.0*H/W, -20.0, 20.0), gl:matrixMode(?GL_MODELVIEW), - gl:loadIdentity(), + gl:loadIdentity(), gl:enable(?GL_DEPTH_TEST), gl:depthFunc(?GL_LESS), {R,G,B,_} = wxWindow:getBackgroundColour(Frame), @@ -122,7 +134,7 @@ canvas(Config) -> ?m([], flush()), Env = wx:get_env(), Tester = self(), - spawn_link(fun() -> + spawn_link(fun() -> wx:set_env(Env), ?m(ok, wxGLCanvas:setCurrent(Canvas)), ?m(ok, drawBox(1, Data)), @@ -131,11 +143,20 @@ canvas(Config) -> %% This may fail when window is deleted catch draw_loop(2,Data,Canvas) end), + %% Needed on mac with wx-2.9 + wxGLCanvas:connect(Canvas, paint, + [{callback, fun(_,_) -> + wxGLCanvas:setCurrent(Canvas), + DC= wxPaintDC:new(Canvas), + wxPaintDC:destroy(DC) + end}]), + + ?m_receive(works), ?m([], flush()), io:format("Undef func ~p ~n", [catch gl:uniform1d(2, 0.75)]), timer:sleep(500), - ?m([], flush()), + flush(), wx_test_lib:wx_destroy(Frame, Config). flush() -> @@ -150,6 +171,8 @@ flush(Collected) -> draw_loop(Deg,Data,Canvas) -> timer:sleep(15), + {NW,NH} = wxGLCanvas:getClientSize(Canvas), + gl:viewport(0,0,NW,NH), drawBox(Deg,Data), ?m(ok, wxGLCanvas:swapBuffers(Canvas)), draw_loop(Deg+1, Data,Canvas). @@ -181,7 +204,12 @@ glu_tesselation(Config) -> Frame = wxFrame:new(WX,1,"Hello 3D-World",[]), Attrs = [{attribList, [?WX_GL_RGBA,?WX_GL_DOUBLEBUFFER,0]}], Canvas = ?mt(wxGLCanvas, wxGLCanvas:new(Frame, Attrs)), + wxFrame:connect(Frame, show), ?m(true, wxWindow:show(Frame)), + + receive #wx{event=#wxShow{}} -> ok + after 1000 -> exit(show_timeout) + end, ?m(ok, wxGLCanvas:setCurrent(Canvas)), {RL1,RB1} = ?m({_,_}, glu:tesselate({0,0,1}, [{-1,0,0},{1,0,0},{0,1,0}])), |