indexing description: " A vertex shader that can be passed to EM_SHADER_PROGRAM " date: "$Date$" revision: "$Revision$" class GL_VERTEX_SHADER inherit MEMORY export {NONE} all redefine dispose end EM_CONSTANTS export {NONE} all end GL_FUNCTIONS export {NONE} all end GLEXT_FUNCTIONS export {NONE} all end create make_from_file, make_and_compile_from_file, make_from_source feature -- Access id: INTEGER feature {NONE} -- Initialization get_file_string( a_filename: STRING ): STRING is -- get the text strig out of a file local text_file: PLAIN_TEXT_FILE do create text_file.make( a_filename ) text_file.open_read text_file.read_stream ( text_file.count ) result := text_file.last_string end make_from_file( a_filename: STRING ) is -- make a new vertex shader from a file require shader_is_supported: is_extension_supported ( "GL_ARB_vertex_shader" ) do make_from_source( get_file_string( a_filename ) ) ensure id >= 0 end make_and_compile_from_file( a_filename: STRING ) is -- make a new vertex shader from a file require shader_is_supported: is_extension_supported ( "GL_ARB_vertex_shader" ) do make_from_source( get_file_string( a_filename ) ) compile ensure id >= 0 end make_from_source( a_source: STRING ) is -- make a new vertex shader from a given source string require shader_is_supported: is_extension_supported ( "GL_ARB_vertex_shader" ) local source: ARRAY[ POINTER ] tmp: ANY do create source.make(0,0) tmp := a_source.to_c source.put( $tmp, 0 ) id := gl_create_shader_object_arb ( em_gl_vertex_shader_arb ) tmp := source.to_c gl_shader_source_arb ( id, 1, $tmp, default_pointer) ensure id >= 0 end feature -- Commands compile is -- compile the shader require id >= 0 local compiled: INTEGER do gl_compile_shader_arb( id ) gl_get_object_parameteriv_arb (id, em_gl_object_compile_status_arb, $compiled) is_compiled := compiled/=0 if not is_compiled then print(log) end ensure shader_compiled: is_compiled end feature {NONE} -- Clean up dispose is -- clean up the opengl memory do gl_delete_object_arb (id) Precursor end feature -- Status is_compiled: BOOLEAN log:STRING is -- Return the error log local tmp_str: STRING tmp: ANY length: INTEGER do gl_get_object_parameteriv_arb ( id, em_gl_info_log_length, $length) create tmp_str.make ( length ) tmp := tmp_str.to_c gl_get_info_log_arb_external ( id, length, $length , $tmp ) create result.make_from_c ( $tmp ) end end