From 8ecbdaf5eb54052d7b4756037e6dc481a36358ed Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Mon, 15 Nov 2010 15:24:58 +0100 Subject: Initilize opengl after setCurrent No rendering context is available until setCurrent is called the first time, opengl extensions can not be loaded before the rendering context is created. --- lib/wx/src/gen/wxGLCanvas.erl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/wx/src') diff --git a/lib/wx/src/gen/wxGLCanvas.erl b/lib/wx/src/gen/wxGLCanvas.erl index e5d7bec4ca..032d42535d 100644 --- a/lib/wx/src/gen/wxGLCanvas.erl +++ b/lib/wx/src/gen/wxGLCanvas.erl @@ -105,7 +105,6 @@ new(#wx_ref{type=ParentT,ref=ParentRef}, Options) ({palette, #wx_ref{type=PaletteT,ref=PaletteRef}}, Acc) -> ?CLASS(PaletteT,wxPalette),[<<7:32/?UI,PaletteRef:32/?UI>>|Acc]; (BadOpt, _) -> erlang:error({badoption, BadOpt}) end, BinOpt = list_to_binary(lists:foldl(MOpts, [<<0:32>>], Options)), - {ok, _} = wxe_master:init_opengl(), wxe_util:construct(?wxGLCanvas_new_2, <>). @@ -131,7 +130,6 @@ new(#wx_ref{type=ParentT,ref=ParentRef},#wx_ref{type=SharedT,ref=SharedRef}, Opt ({palette, #wx_ref{type=PaletteT,ref=PaletteRef}}, Acc) -> ?CLASS(PaletteT,wxPalette),[<<7:32/?UI,PaletteRef:32/?UI>>|Acc]; (BadOpt, _) -> erlang:error({badoption, BadOpt}) end, BinOpt = list_to_binary(lists:foldl(MOpts, [<<0:32>>], Options)), - {ok, _} = wxe_master:init_opengl(), wxe_util:construct(SharedOP, <>). @@ -146,8 +144,10 @@ getContext(#wx_ref{type=ThisT,ref=ThisRef}) -> %% @doc See external documentation. setCurrent(#wx_ref{type=ThisT,ref=ThisRef}) -> ?CLASS(ThisT,wxGLCanvas), - wxe_util:cast(?wxGLCanvas_SetCurrent, - <>). + _Result = wxe_util:cast(?wxGLCanvas_SetCurrent, + <>), + {ok, _} = wxe_master:init_opengl(), + _Result. %% @spec (This::wxGLCanvas()) -> ok %% @doc See external documentation. -- cgit v1.2.3