indexing description: "[ OPEN_GL_LIBRARY provides a comfortable way to implement all the openGL stuff you need in a certain class. Simply inherit from this class and you automatically inherit from all classes which contain the openGL functions and constants. In addition, you find some useful openGL macros defined here. This class is part of the XAE Extended Adventure Engine Project. ]" author: "Ralph Wiedemeier, ralphw@student.ethz.ch" date: "$Date$" revision: "$Revision$" class OPEN_GL_LIBRARY inherit EM_GL_CONSTANTS export {NONE} all undefine default_create end EMGL_SETTINGS export {NONE} all undefine out end EMGL_VIEW export {NONE} all undefine out end EMGLU_VIEW export {NONE} all undefine out end EMGL_DRAW export {NONE} all undefine out end EMGL_BASIC_RENDERER export {NONE} all undefine out end feature -- OpenGL macro routines macro_enable_alpha_blending is -- Enable alpha blending do emgl_enable (EM_gl_blend) emgl_blend_func (EM_gl_src_alpha, EM_gl_one_minus_src_alpha) end macro_disable_alpha_blending is -- Disable alpha blending do emgl_disable (EM_gl_blend) end macro_enable_depth_test is -- Enable depth testing do emgl_enable (EM_gl_depth_test) end macro_disable_depth_test is -- Enable depth testing do emgl_disable (EM_gl_depth_test) end macro_disable_texture_mapping is -- Disable texture mapping do emgl_disable (EM_gl_texture_2d) end macro_bind_texture_antialiased_replace (texture: EM3D_TEXTURE_2D[ EMGL_FORMAT_RGBA ]) is -- Bind specified texture and set attributes do emgl_enable (EM_gl_texture_2d) -- texture paint mode: replace emgl_tex_envi (em_gl_texture_env_mode, em_gl_replace) -- texture interpolation: linear (antialiased) texture.set_texture_min_filter (em_gl_linear) texture.set_texture_mag_filter (em_gl_linear) -- bind texture texture.bind end macro_bind_texture_antialiased_modulate (texture: EM3D_TEXTURE_2D[ EMGL_FORMAT_RGBA ]) is -- Bind specified texture and set attributes do emgl_enable (EM_gl_texture_2d) -- texture paint mode: modulate emgl_tex_envi (EM_gl_texture_env_mode, EM_gl_modulate) -- texture interpolation: linear (antialiased) texture.set_texture_min_filter (em_gl_linear) texture.set_texture_mag_filter (em_gl_linear) -- bind texture texture.bind end macro_free_texture (texture: DISPOSABLE) is -- Free memory of texture with specified ID do if texture /= void then texture.dispose end end macro_set_projection_perspective is -- Set up perspective projection parameters do emgl_matrix_mode (EM_gl_projection) emgl_load_identity emglu_perspective (57.5, 1.3333333, 0.1, 2000) emgl_matrix_mode (EM_gl_modelview) end macro_set_projection_credits is -- Set up perspective projection parameters do emgl_matrix_mode (EM_gl_projection) emgl_load_identity emglu_perspective (75, 1.3333333, 0.1, 2000) emgl_matrix_mode (EM_gl_modelview) end macro_make_snapshot (texture: EM3D_TEXTURE_2D[ EMGL_FORMAT_RGBA ]) is -- Store snapshot of current display in texture with specified id do emgl_finish emgl_read_buffer (EM_gl_back) texture.bind texture.copy_tex_image2d (0, 0, 180, 1024, 512, 0) end macro_make_snapshot_blurred (texture: EM3D_TEXTURE_2D[ EMGL_FORMAT_RGBA ]) is -- Store snapshot of current display the specified texture local i: INTEGER do macro_make_snapshot (texture) macro_enable_alpha_blending macro_bind_texture_antialiased_replace (texture) from i := 0 until i = 10 loop emgl_load_identity emgl_translatef ((i - 5) * 2, 52, -700) emgl_begin (EM_gl_quads) emgl_color4d (1, 1, 1, 1 - i/10) emgl_tex_coord2d (0.0, 0.0) emgl_vertex3d (-512, -256, 0) emgl_tex_coord2d (1.0, 0.0) emgl_vertex3d ( 512, -256, 0) emgl_tex_coord2d (1.0, 1.0) emgl_vertex3d ( 512, 256, 0) emgl_tex_coord2d (0.0, 1.0) emgl_vertex3d (-512, 256, 0) emgl_end i := i + 1 end texture.unbind macro_make_snapshot (texture) end end -- class OPEN_GL_LIBRARY