OSDN Git Service

Display2 update:
[eos/hostdependX86MAC64.git] / lib / molvieDisplay.rb
1 #!/usr/bin/ruby
2
3 require 'sdl'
4 #require "opengl"
5 require "rubygems"
6 require "opengl"
7 require "glut"
8 require 'molvie_ver'
9 require 'keyboard_Func'
10 require 'pdbFile'
11 require 'molvieRuby'
12
13 class MolvieDisplay 
14         
15         def display(width,height)
16                         #puts "display"
17                 case Molvie_ver.new.molvie_ver
18                         
19                         #molvieViewer
20                         when 0
21                                 puts "display_mode molvieViewer"
22                                 MolvieRuby::lmolvieInitNormal();
23                                 MolvieRuby::lmolvieDisplayNormal();
24                                 SDL::GL_swap_buffers()
25                                 MolvieRuby::lmolvieReshapeNormal(width ,height);
26                                 
27                         #molvieFlight
28                         when 1
29                                 #if ((flag == 0 || 1 )
30                                 MolvieRuby::operationModeSet(1)
31                                 puts "display_mode molvieFlight"        
32                                 MolvieRuby::lmolvieInitNormal();
33                                 MolvieRuby::lmolvieDisplayNormal();
34                                 puts "Into setDriveMyCamera() こいつのせいで消えるみたい。"
35                                 #MolvieRuby::setDriveMyCamera();
36                                 #puts "Into setCameraCentreTag"
37                                 #MolvieRuby::setCameraCentreTag(0);
38                                 puts "Into lmolvieFlightDisplay"
39                                 #MolvieRuby::lmolvieFlightDisplay;
40                                 puts "Into SDL::GL_swap_buffers()"
41                                 SDL::GL_swap_buffers()
42                                 puts "Into lmolvieReshapeNormal"
43                                 MolvieRuby::lmolvieReshapeNormal(width ,height);
44                         
45                         #molvieProjection
46                         when 2
47                                 puts "display_mode molvieProjection"
48                                 MolvieRuby::lmolvieInitParallel();
49                                 #puts "display_Func2: Into lmolvieDisplaySDLNormal()"
50                                 MolvieRuby::lmolvieViewerParallel();
51                                 #puts "display_Func3: SDL::GL_swap_buffers!します"
52                                 SDL::GL_swap_buffers()
53                                 #puts "display_Func4:Into lmolvieReshapeNormal() "
54                                 MolvieRuby::lmolvieReshapeParallel(width ,height);
55                                 #parallelwindow設定作るか検討中                         
56                                 #puts "display_Func_End"
57                         when 3
58                                 #puts "display_Func1: Into lmolvieInitNormal()"
59                                 MolvieRuby::lmolvieInitNormal();
60                                 #puts "display_Func2: Into lmolvieDisplaySDLNormal()"
61                                 MolvieRuby::lmolvieDisplayNormal();
62                                 #puts "display_Func3: SDL::GL_swap_buffers!します"
63                                 SDL::GL_swap_buffers()
64                                 #puts "display_Func4:Into lmolvieReshapeNormal() "
65                                 MolvieRuby::lmolvieReshapeNormal(width ,height);
66                                 #puts "display_Func_End"
67                         when 4
68                                 #puts "display_Func1: Into lmolvieInitNormal()"
69                                 MolvieRuby::lmolvieInitNormal();
70                                 #puts "display_Func2: Into lmolvieDisplaySDLNormal()"
71                                 MolvieRuby::lmolvieDisplayNormal();
72                                 #puts "display_Func3: SDL::GL_swap_buffers!します"
73                                 SDL::GL_swap_buffers()
74                                 #puts "display_Func4:Into lmolvieReshapeNormal() "
75                                 MolvieRuby::lmolvieReshapeNormal(width ,height);
76                                 #puts "display_Func_End"
77                         when 5
78                                 #puts "display_Func1: Into lmolvieInitNormal()"
79                                 MolvieRuby::lmolvieInitNormal();
80                                 #puts "display_Func2: Into lmolvieDisplaySDLNormal()"
81                                 MolvieRuby::lmolvieDisplayNormal();
82                                 #puts "display_Func3: SDL::GL_swap_buffers!します"
83                                 SDL::GL_swap_buffers()
84                                 #puts "display_Func4:Into lmolvieReshapeNormal() "
85                                 MolvieRuby::lmolvieReshapeNormal(width ,height);
86                                 #puts "display_Func_End"
87                         
88                         else
89                                 MolvieRuby::lmolvieInitNormal();
90                                 GL::Clear(GL::COLOR_BUFFER_BIT)
91                                 #puts "display default2"
92                                 GL::Begin(GL::LINE_LOOP);
93                                 #puts "display default3"
94                                 #GL::Color3d(1.0,0.0,0.0)
95                                 GL::Vertex2d(-0.9, -0.9);
96                                 GL::Vertex2d(0.9, -0.9);
97                                 GL::Vertex2d(0.9, 0.9);
98                                 GL::Vertex2d(-0.9, 0.9);
99                                 GL::End()
100                                 #puts "display default4"
101                                 GLUT::SolidTeapot(0.4);
102                                 SDL::GL_swap_buffers()
103                                 #puts "display default5"
104                                 GL.ShadeModel(GL::SMOOTH)
105                         end
106                 SDL::GL_swap_buffers()
107         end
108 end
109