class ExecuteOpenGl
OpenGL.load_lib() GLUT.load_lib()
Public Instance Methods
draw(background, projectiles, player)
click to toggle source
include Gl include Glu include Glut
# File line-em-up/models/execute_open_gl.rb, line 34 def draw background, projectiles, player # @zoom = -14 Gosu.gl do # init_scene # glEnable(GL_TEXTURE_2D) # glShadeModel(GL_SMOOTH) # glClearColor(0.0, 0.2, 0.5, 1.0) glClearColor(0.0, 0.0, 0.0, 0.0) glClearDepth(0) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) # glBlendFunc(GL_SRC_ALPHA,GL_ONE) #see nehe08 # glEnable(GL_BLEND) # glMatrixMode(GL_MODELVIEW) #see lesson 01 # glLoadIdentity #see lesson 01 # glTranslatef(0, 0, -13) #see lesson 01 background.exec_gl glShadeModel(GL_SMOOTH) # selects smooth shading glLoadIdentity #see lesson 01 # puts "-projectile.get_draw_ordering - 10: #{-projectile.get_draw_ordering - 10}" glTranslatef(0, 0, -13) #see lesson 01 @ambient_light = [0.5, 0.5, 0.5, 1] mat_shininess = [50] glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess) glLightfv(GL_LIGHT1, GL_AMBIENT, @ambient_light) # sets ambient light for light source glEnable(GL_LIGHT1) projectiles.each_with_index do |projectile, i| glMatrixMode(GL_MODELVIEW) #see lesson 01 glLoadIdentity #see lesson 01 # puts "-projectile.get_draw_ordering - 10: #{-projectile.get_draw_ordering - 10}" glTranslatef(0, 0, -13) #see lesson 01 # glTranslatef(0, 0, -14) #see lesson 01 projectile.draw_gl end player.draw_gl_list.each do |item| glMatrixMode(GL_MODELVIEW) #see lesson 01 glLoadIdentity #see lesson 01 glTranslatef(0, 0, -13) #see lesson 01 item.draw_gl end end end