diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/wx/api_gen/gl_gen_erl.erl | 14 | ||||
-rw-r--r-- | lib/wx/src/gen/gl.erl | 14 | ||||
-rw-r--r-- | lib/wx/test/wx_opengl_SUITE.erl | 2 |
3 files changed, 20 insertions, 10 deletions
diff --git a/lib/wx/api_gen/gl_gen_erl.erl b/lib/wx/api_gen/gl_gen_erl.erl index 1be8d775be..1f9407525d 100644 --- a/lib/wx/api_gen/gl_gen_erl.erl +++ b/lib/wx/api_gen/gl_gen_erl.erl @@ -116,7 +116,7 @@ gl_api(Fs) -> w("call(Op, Args) ->~n", []), w(" Port = get(opengl_port), ~n", []), w(" _ = erlang:port_control(Port,Op,Args),~n", []), - w(" rec().~n", []), + w(" rec(Op).~n", []), w(" ~n", []), w("%% @hidden~n", []), w("cast(Op, Args) ->~n", []), @@ -125,11 +125,15 @@ gl_api(Fs) -> w(" ok.~n", []), w(" ~n", []), w("%% @hidden~n", []), - w("rec() ->~n", []), - w(" receive ~n", []), + w("rec(Op) ->~n", []), + w(" receive~n", []), w(" {'_egl_result_', Res} -> Res;~n", []), - w(" {'_egl_error_', Op, Res} -> error({error,Res,Op})~n", []), - w(" end. ~n", []), + w(" {'_egl_error_', Op, Res} -> error({error,Res,Op});~n", []), + w(" {'_egl_error_', Other, Res} ->~n ", []), + w(" Err = io_lib:format(\"~~p in op: ~~p\", [Res, Other]),~n", []), + w(" error_logger:error_report([{gl, error}, {message, lists:flatten(Err)}]),~n", []), + w(" rec(Op)~n", []), + w(" end.~n", []), w("~n", []), w("%% @hidden~n", []), w("send_bin(Bin) when is_binary(Bin) ->~n", []), diff --git a/lib/wx/src/gen/gl.erl b/lib/wx/src/gen/gl.erl index e10b99b10a..3780cca651 100644 --- a/lib/wx/src/gen/gl.erl +++ b/lib/wx/src/gen/gl.erl @@ -283,7 +283,7 @@ call(Op, Args) -> Port = get(opengl_port), _ = erlang:port_control(Port,Op,Args), - rec(). + rec(Op). %% @hidden cast(Op, Args) -> @@ -292,11 +292,15 @@ cast(Op, Args) -> ok. %% @hidden -rec() -> - receive +rec(Op) -> + receive {'_egl_result_', Res} -> Res; - {'_egl_error_', Op, Res} -> error({error,Res,Op}) - end. + {'_egl_error_', Op, Res} -> error({error,Res,Op}); + {'_egl_error_', Other, Res} -> + Err = io_lib:format("~p in op: ~p", [Res, Other]), + error_logger:error_report([{gl, error}, {message, lists:flatten(Err)}]), + rec(Op) + end. %% @hidden send_bin(Bin) when is_binary(Bin) -> diff --git a/lib/wx/test/wx_opengl_SUITE.erl b/lib/wx/test/wx_opengl_SUITE.erl index 643a0df6a3..3de9209fae 100644 --- a/lib/wx/test/wx_opengl_SUITE.erl +++ b/lib/wx/test/wx_opengl_SUITE.erl @@ -111,6 +111,8 @@ canvas(Config) -> ?m(false, wx:is_null(wxGLCanvas:getContext(Canvas))), ?m({'EXIT', {{error, no_gl_context,_},_}}, gl:getString(?GL_VENDOR)), + gl:viewport(0,0,50,50), %% Show cause an error report + ?m(ok, wxGLCanvas:setCurrent(Canvas)), io:format("Vendor: ~s~n", [gl:getString(?GL_VENDOR)]), |