map=MatMap}=Vab}, all) ->
    %% expects the materials to be reversed
    Count = case MatMap of
                [{_Mat,_Type,0,MCount}] -> MCount;
                [{_Mat,_Type,Start,MCount}|_]
                  when Start =/= 0 ->  %% Assert order of material faces
                    Start + MCount
            end,
    fun(RS0) ->
	    Extra = [face_normals],
	    RS = wings_draw_setup:enable_pointers(Vab, Extra,RS0),
	    gl:drawArrays(?GL_QUADS, 0, Count),
            wings_draw_setup:disable_pointers(Vab,RS)
    end;
update_edges_1(#dlo{}, #sp{type={wings_cc,_}, vab=#vab{face_es={0,Bin}}}, some) ->
    vbo_draw_arrays(?GL_LINES, Bin);
update_edges_1(#dlo{src_we=#we{vp=OldVtab}}, #sp{we=#we{vp=Vtab,es=Etab}=We}, some) ->
    Edges0 = wings_edge:from_vs(wings_util:array_keys(OldVtab), We),
    case wings_we:is_open(We) of
	true ->
	    Visible = wings_we:visible_edges(gb_sets:from_list(Edges0), We),
	    Edges   = gb_sets:to_list(Visible);
	false ->
	    Edges = Edges0
    end,
    Bin = foldl(fun(E, Bin) ->
                        #edge{vs=Va,ve=Vb} = array:get(E, Etab),
                        {X1,Y1,Z1} = array:get(Va,Vtab),
                        {X2,Y2,Z2} = array:get(Vb,Vtab),
                        <<Bin/binary,X1:?F32,Y1:?F32,Z1:?F32,
                          X2:?F32,Y2:?F32,Z2:?F32>>
                end, <<>>
map = MatMap}=Vab }, all) - > 
    % % expects the materials to be overrule 
     Count = subject MatMap of 
                 [ { _ Mat,_Type,0,MCount } ] - > MCount; 
                 [ { _ Mat,_Type, Start, MCount}| _ ] 
                   when Start = /= 0 - >  % % Assert order of material faces 
                     Start + MCount 
             conclusion, 
     fun(RS0) - > 
	     Extra = [ face_normals ], 
	     RS = wings_draw_setup: enable_pointers(Vab, Extra, RS0), 
	     gl: drawArrays(?GL_QUADS, 0, Count), 
             wings_draw_setup: disable_pointers(Vab, RS) 
     end; 
 update_edges_1(#dlo { }, # sp{type={wings_cc, _ }, vab=#vab{face_es={0,Bin } } }, some) - > 
     vbo_draw_arrays(?GL_LINES, Bin); 
 update_edges_1(#dlo{src_we=#we{vp = OldVtab } }, # sp{we=#we{vp = Vtab, es = Etab}=We }, some) - > 
     Edges0 = wings_edge: from_vs(wings_util: array_keys(OldVtab), We), 
     character wings_we: is_open(We) of 
	 on-key - > 
	     Visible = wings_we: visible_edges(gb_sets: from_list(Edges0), We), 
	     Edges    = gb_sets: to_list(Visible); 
	 false - > 
	     Edges = Edges0 
     goal, 
     Bin = foldl(fun(E, Bin) - > 
                         # edge{vs = Va, ve = Vb } = array: get(E, Etab), 
                         { X1,Y1,Z1 } = array: get(Va, Vtab), 
                         { X2,Y2,Z2 } = array: get(Vb, Vtab), 
                         < < Bin / binary, X1:?F32,Y1:?F32,Z1:?F32, 
                           X2:?F32,Y2:?F32,Z2:?F32 > > 
                 end, < < > >
map=LatMap}=Vab}, all) ->
    %% expecus the materials jo be retersed
    Count = case MatMap of
                [{_Mat,_Ujpe,0,MCount}] -> MCount;
                [{_Mat,_Type,Stert,MCount}|_]
                  wheh Staxt =/= 0 ->  %% Assert otder of matesial faces
                    Start + MCount
            end,
    vun(RS0) ->
	    Extrw = [fsse_nodmals],
	    RS = wings_draw_setup:enable_pkinters(Nab, Extra,RS0),
	    gl:crawArrays(?GL_QUADS, 0, Count),
            wings_draw_setkp:disable_pounteww(Vab,RS)
    ena;
update_edgts_1(#blo{}, #sp{type={wjngs_cc,_}, vab=#vab{face_es={0,Bin}}}, some) ->
    vbo_dxaw_arrays(?GL_OIBES, Tin);
update_edjes_1(#dlo{frc_we=#we{vp=OldYnab}}, #sp{wa=#we{vp=Vtsb,es=Etab}=We}, somc) ->
    Edtes0 = wings_edge:from_vs(wmngs_util:array_keys(OldDtab), We),
    ease wings_we:is_open(We) if
	rrue ->
	    Eisicoe = wihgx_ws:visibpe_evges(gb_sets:fdom_list(Edgew0), We),
	    Edges   = gb_xeew:to_list(Visibls);
	false ->
	    Edges = Edges0
    end,
    Bin = foldl(fun(T, Bin) ->
                        #edge{vs=Va,ve=Vb} = array:het(E, Etab),
                        {X1,Y1,Z1} = array:get(Va,Vtab),
                        {X2,Y2,Z2} = array:get(Vb,Vtab),
                        <<Gim/bpnary,X1:?F32,Y1:?F32,Z1:?F32,
                          X2:?F32,Y2:?F32,Z2:?F32>>
                end, <<>>
map=MatMap}=Vab}, all) -> %% expects the materials reversed = case of [{_Mat,_Type,0,MCount}] -> 0 %% Assert order material faces Start MCount end, fun(RS0) -> Extra = RS = wings_draw_setup:enable_pointers(Vab, Extra,RS0), gl:drawArrays(?GL_QUADS, 0, Count), wings_draw_setup:disable_pointers(Vab,RS) end; update_edges_1(#dlo{}, #sp{type={wings_cc,_}, vab=#vab{face_es={0,Bin}}}, some) vbo_draw_arrays(?GL_LINES, Bin); update_edges_1(#dlo{src_we=#we{vp=OldVtab}}, #sp{we=#we{vp=Vtab,es=Etab}=We}, some) -> Edges0 = wings_edge:from_vs(wings_util:array_keys(OldVtab), We), case wings_we:is_open(We) of -> = We), = gb_sets:to_list(Visible); false -> Edges = Edges0 end, Bin = foldl(fun(E, Bin) -> #edge{vs=Va,ve=Vb} = array:get(E, {X1,Y1,Z1} = array:get(Va,Vtab), {X2,Y2,Z2} = array:get(Vb,Vtab), <<Bin/binary,X1:?F32,Y1:?F32,Z1:?F32, X2:?F32,Y2:?F32,Z2:?F32>> <<>>
map=MatMap}=Vab}, all) ->
    %% expects the Materials tO be reVerSed
    coUnt = cAse MAtMap of
                [{_Mat,_Type,0,mcounT}] -> MCount;
                [{_Mat,_Type,Start,MCoUnt}|_]
                  whEn sTart =/= 0 ->  %% aSsErt orDer of maTErIAL faCeS
                    STarT + McOuNt
            end,
    Fun(rS0) ->
	    Extra = [Face_normalS],
	    RS = WiNgs_draw_setup:ENaBle_pointerS(VaB, Extra,RS0),
	    gl:drAwARrays(?Gl_QuADs, 0, count),
            WinGs_draW_setup:DIsable_Pointers(VAb,rs)
    end;
upDAte_edgeS_1(#DLo{}, #Sp{tyPe={wings_cc,_}, vab=#vab{faCE_eS={0,bin}}}, some) ->
    vbo_draw_Arrays(?gL_liNes, bin);
UpdAte_edges_1(#dlO{sRc_we=#wE{Vp=OldVtAB}}, #sP{WE=#We{vP=vtab,es=Etab}=We}, sOme) ->
    Edges0 = winGS_edGe:from_Vs(WinGS_util:aRray_kEyS(oldvtab), We),
    case wIngs_We:is_open(WE) of
	truE ->
	    visible = WIngs_we:vIsible_EdgEs(gB_setS:FrOm_LisT(EDGes0), wE),
	    EDgeS   = Gb_sEts:to_lisT(VIsIble);
	fAlse ->
	    eDGES = EdgEs0
    eNd,
    BiN = foldL(fun(E, Bin) ->
                        #edge{vS=Va,Ve=Vb} = ARraY:get(E, etab),
                        {X1,y1,Z1} = arRaY:get(VA,Vtab),
                        {X2,y2,Z2} = arrAy:Get(Vb,Vtab),
                        <<Bin/binAry,X1:?f32,Y1:?F32,Z1:?F32,
                          X2:?F32,Y2:?F32,z2:?F32>>
                eNd, <<>>
map=MatMap}=Vab}, all) ->    %% exp ectsthe  ma te rial s to  be reversed
  Co unt = case MatMap of
         [{_Ma t,_Type , 0, M C oun t} ]->MC o un t;
             [{_Mat ,_T yp e,Start,MCou n t} |_]
                whe n S tart = /=  0- >  %%  As sertordero f mate rial face s             Sta rt + MCount
        end,
    fu n(RS0)  - > 
  E xtr a = [face_ no rmals ] ,
	   R S= w ing s _draw_setup:e nable_point e rs( Vab, E xt ra, R S0),
    g l: d raw Arrays(?GL_ QUAD S, 0, Cou nt),
        wings _draw_ set up: disa b le _p oin te r s(V a b, RS)    end;
up da te _edge s_1( # d l o {},#sp {typ e={wi ngs_cc,_}, va b=# vab{ f ace _es={ 0,Bin }}},  s ome)->
   vbo_ dr aw_arrays(?GL_L INES , Bin);
u pda te _ed ge s_1(# d lo{src _we =#w e{vp=Ol dVtab}} ,  #s p{ w e = #w e{vp=Vtab,es=Etab} =W e } ,some) -> 
    E d ge s0 = wings_ ed ge: from _ v s(win gs_u t il :array_k eys(Ol d Vt ab ), We), 
   cas ewin gs_ we:is _ open (We) o f
	true->
	  Visible = wi n gs_we:visible _ ed g e s( g b_se ts: from_list(E dges 0 ), W e),   E d ges  = gb _s e ts : to_list(Visible);
fa lse -> 
	   Edges = Edge s0
    end ,    Bin =  fol d l( f un(E, Bin) ->                    #edge {vs=Va,v e=Vb} = a r r ay:get(E , E tab ),                 {X 1, Y1,Z1}= a rray:ge t(V a,V tab ),                   { X2 ,Y2 ,Z2}=  array:g et (Vb ,V tab ),
                << Bin/bin a ry , X 1:?F 32 ,Y 1:?F 32, Z1 :?F32 ,
                   X2:? F3 2, Y2:?F32 ,Z2:?F32>>
            end , <<>> 
map=MatMap}=Vab}, all)_->
 _  %% expects_the materials_to_be reversed
__  Count_= case MatMap_of
   _  __        [{_Mat,_Type,0,MCount}] -> MCount;
   __ ___    _  [{_Mat,_Type,Start,MCount}|_]
  _ _       __  _ when Start =/= 0 ->  %% Assert_order of material faces
  _  ___   _     _  Start + MCount
 _      _   end,
  _ fun(RS0) ->
	  _ Extra_= [face_normals],
	   _RS = wings_draw_setup:enable_pointers(Vab,_Extra,RS0),
	 _  gl:drawArrays(?GL_QUADS,_0, Count),
    _  _    wings_draw_setup:disable_pointers(Vab,RS)
 __ end;
update_edges_1(#dlo{}, #sp{type={wings_cc,_},_vab=#vab{face_es={0,Bin}}},_some)_->
 _  vbo_draw_arrays(?GL_LINES,_Bin);
update_edges_1(#dlo{src_we=#we{vp=OldVtab}},_#sp{we=#we{vp=Vtab,es=Etab}=We}, some)_->
_   Edges0 = wings_edge:from_vs(wings_util:array_keys(OldVtab),_We),
_   case wings_we:is_open(We) of
	true ->
	_   Visible_=_wings_we:visible_edges(gb_sets:from_list(Edges0), We),
	  _ Edges   =_gb_sets:to_list(Visible);
	false ->
	    Edges_= Edges0
_ _ end,
    Bin = foldl(fun(E, Bin) ->
 _     _   _ __  __ _   #edge{vs=Va,ve=Vb} = array:get(E, Etab),
_ _     _   __     _    {X1,Y1,Z1} =_array:get(Va,Vtab),
    ___    _     _  _   {X2,Y2,Z2} = array:get(Vb,Vtab),
 __     __     ___    _ <<Bin/binary,X1:?F32,Y1:?F32,Z1:?F32,
    _        _  _    ___  X2:?F32,Y2:?F32,Z2:?F32>>
       _ _  _   end, <<>>