• Website
  • Search
  • Member List
  • Help
  • Old Forum
  • Social Media
    •   @Wings3dOfficial
    •   @Wings3dOfficial
    •   Wings3dOfficial
    •   Wings3dOfficial
  • Register
  • Login
  • Website
  • Search
  • Member List
  • Help
  • Old Forum
  • Register
  • Login
Wings 3D Development Forum Wings 3D Gripes & Grumbles v
« Previous 1 … 3 4 5 6 7 8 Next »
Why is minor component displayed at left ?

 
  • 0 Vote(s) - 0 Average
Why is minor component displayed at left ?

ggaliens
Offline

Erlang Hacker
Posts: 954
Threads: 143
Joined: Nov 2012
#1
09-12-2015, 06:26 PM
Code:
minor_gl_version() ->
    Major = 2,
    Minor = 1,
    Req = {Major,Minor,0},
    case ets:lookup(wings_gl_ext, version) of
    [{_,VerTuple}] when VerTuple < Req ->
        fatal("Wings3D requires OpenGL ~p.~p or higher.",
          [Minor,Major]);
    _ ->
        ok
    end.
micheus
Offline

Forum's Admin and Support | Bug fixer
Posts: 3,676
Threads: 183
Joined: Jun 2012
#2
09-12-2015, 08:11 PM (This post was last modified: 09-12-2015, 08:28 PM by micheus.)
ggaliens, if you are coming to work in wx development version I recommend you follow the proper bug's thread. Wink

That was fixed in accord wit this post: http://www.wings3d.com/forum/showthread....61#pid7861
As well as you can fix by trying to keep your branch updated by following the Don't branch at git: https://github.com/dgud/wings/commit/645...b76898b591

It's the the way I have been doing . Smile
[Image: tw.png] @MicheusVieira [Image: yt.png] @MicheusVieira [Image: da.png] Micheuss [Image: ig.png] micheus4wings3d
* Wings3D Team stands for: Björn and Dan
ggaliens
Offline

Erlang Hacker
Posts: 954
Threads: 143
Joined: Nov 2012
#3
09-19-2015, 12:22 AM (This post was last modified: 09-19-2015, 12:30 AM by ggaliens.)
Micheus ... Dan ... I think I'm seeing a potential weakness in OpenGL version vetting ...
Look at this testing I have done on command line ...

Code:
1> {2,1} < {3,1,2}.
true
2> {2,1} < {2,1,2}.
true
3> {2,1} < {2,0,2}.
true
4>

My thought would be to put in an "assertion" that both tuples are three tuples ... else toss in a fatal.
Anyways ... I'm going to try to PUSH an improved version for you guys to ponder.

Maybe something like this is better ...

Code:
minor_gl_version() ->
    Major = 2,
    Minor = 1,
    Req = {Major,Minor,0},
    case ets:lookup(wings_gl_ext, version) of
    [{_,{MajorCurrent,MinorCurrent,_}=VerTuple}] when VerTuple < Req ->
        fatal("Wings3D requires OpenGL ~p.~p or higher.\nYour available version ~p.~p",
          [Major,Minor,   MajorCurrent,MinorCurrent]);
    [{_,{_,_,_}=_VerTuple}]  ->  % assert that a 3 tuple is returned as expected
        ok;
    Unexpected ->
        fatal("Unexpected current OpenGL info : ~p", [ Unexpected ])
    end.
micheus
Offline

Forum's Admin and Support | Bug fixer
Posts: 3,676
Threads: 183
Joined: Jun 2012
#4
09-19-2015, 04:17 AM
ggaliens, there is no reason for all that extra code you want to add:
Code:
[{_,{_,_,_}=_VerTuple}]  ->  % assert that a 3 tuple is returned as expected
        ok;
    Unexpected ->
        fatal("Unexpected current OpenGL info : ~p", [ Unexpected ])

The version tuple is already ensured to have three elements. Just look in wings_gl.erl - init_extensions/0, where the version is stored:
Code:
init_extensions() ->
    ets:new(wings_gl_ext, [named_table,public,ordered_set]),
    Exts0 = lists:sort(string:tokens(gl:getString(?GL_EXTENSIONS), " ")),
    Exts = [{list_to_atom(E)} || E <- Exts0],
    ets:insert(wings_gl_ext, Exts),
    Ver = case catch get_version() of
          {_,_,_}=V -> V;
          _ -> {1,1,0}
      end,
    ets:insert(wings_gl_ext, {version,Ver}).
[Image: tw.png] @MicheusVieira [Image: yt.png] @MicheusVieira [Image: da.png] Micheuss [Image: ig.png] micheus4wings3d
* Wings3D Team stands for: Björn and Dan
ggaliens
Offline

Erlang Hacker
Posts: 954
Threads: 143
Joined: Nov 2012
#5
09-19-2015, 03:12 PM
Each unit of code should be a bit independent when possible. Assumptions that cut across modules are ugly.

I find aspects of init_extentions to also be scary. If the items besides major and minor version can be hard to predict ... why try to cast this stuff to zero 0 ? Just catch what is there and pass it on to the next consumer.

Then just let the compare happen on two digits. That should be enough.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D - Powered by MyBB

Linear Mode
Threaded Mode