indexing description: "[ A factory to create pyramids. ]" date: "$Date$" revision: "$Revision$" class PYRAMID_FACTORY inherit EM_3D_OBJECT_FACTORY EM_SHARED_BITMAP_FACTORY export {NONE} all end EM_SHARED_ERROR_HANDLER export {NONE} all end EM_CONSTANTS export {NONE} all end GL_FUNCTIONS export {NONE} all end create make feature -- Initialization make is -- Initialise factory. do Bitmap_factory.create_bitmap_from_image ("hello_world.gif") create bottom_texture.make_from_surface (Bitmap_factory.last_bitmap) end feature -- Measurement object_width: DOUBLE is 2.0 -- Size of bounding box in x direction of created objects object_height: DOUBLE is 2.0 -- Size of bounding box in y direction of created objects object_depth: DOUBLE is 2.0 -- Size of bounding box in z direction of created objects feature {NONE} -- Implementation bottom_texture: GL_STATIC_MIPMAP_TEXTURE -- Bottom texture specify_object is -- Specify an object that can be drawn in the origin -- (front, left, lower corner of bounding box = 0,0,0) do gl_disable (Em_gl_texture_2d) gl_begin (Em_gl_triangles) -- Front gl_color3f(1, 0, 0) -- Red gl_vertex3d (1, 2, -1) gl_vertex3d (0, 0, 0) gl_vertex3d (2, 0, 0) -- Right gl_color3f(0, 1, 0) -- Green gl_vertex3d (1, 2, -1) gl_vertex3d (2, 0, 0) gl_vertex3d (2, 0, -2) -- Back gl_color3f(0, 0, 1) -- Blue gl_vertex3d (1, 2, -1) gl_vertex3d (2, 0, -2) gl_vertex3d (0, 0, -2) -- Left gl_color3f (1, 1, 0) -- Yellow gl_vertex3d (1, 2, -1) gl_vertex3d (0, 0, -2) gl_vertex3d (0, 0, 0) gl_end -- get texture gl_enable (Em_gl_texture_2d) gl_begin (Em_gl_quads) -- Bottom gl_color3f (1, 1, 1) gl_bind_texture (Em_gl_texture_2d, bottom_texture.id) gl_tex_coord2f (0, 0) gl_vertex3d (0, 0, 0) gl_tex_coord2f (0, 1) gl_vertex3d (0, 0, -2) gl_tex_coord2f (1, 1) gl_vertex3d (2, 0, -2) gl_tex_coord2f (1, 0) gl_vertex3d (2, 0, 0) gl_end end invariant bottom_texture_not_void: bottom_texture /= Void end