サンプル移植中 その2
私が使っているテンプレート
require 'opengl'
include Gl,Glu,Glut
#初期設定なんか
def init()
end
#画面を作る場所
display = proc do
end
#再描写なんかだっけ?
reshape = proc do |w, h|
end
keyBoard = proc do |key, x, y|
case(key)
when ?\e
exit(0)
else
end
end
mouse = proc do |key, state, x, y|
end
motion = proc do |x, y|
end
glutInit
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH)
init()
glutInitWindowSize(400, 300)
glutInitWindowPosition(0,0)
glutCreateWindow("3D half spherical")
glutDisplayFunc(display)
glutReshapeFunc(reshape)
glutKeyboardFunc(keyBoard)
glutMotionFunc(motion)
glutMouseFunc(mouse)
glutMainLoop()
結構楽々に移植できる。
さてと、ファイル読み込みが楽なんだかよくわからない。
if(((File.exist?("pcat_face.dat"))&&(File.exist?("tcat_face.dat")))==true)
File.open("pcat_face.dat"){|file|
while line = file.gets
line = line.split(/,/)
d1 = line[0]
d2 = line[1]
@pdat[pn][0] = d1.to_f * @m
@pdat[pn][1] = d2.to_f * @m
pn +=1
end
}
end
でどうにか読めた、明日にはどうにか、サンプル移植終わりそうかな。
- 作者: 青木峰郎,後藤裕蔵,高橋征義,まつもとゆきひろ
- 出版社/メーカー: ソフトバンク クリエイティブ
- 発売日: 2007/02/01
- メディア: 単行本
- 購入: 9人 クリック: 182回
- この商品を含むブログ (97件) を見る
サンプルとにらっめこすれば楽勝