This section contains the following topics:
This section contains the following topics:
• OpenGL Extension Wrapper Flags
The Realtime Shader API version 2.0 provides services to allow you to easily use OpenGL extensions.
The supported extensions are:
• GL_ARB_multitexture
• GL_ARB_transpose_matrix
• GL_ARB_multisample
• GL_ARB_texture_env_add
• GL_ARB_texture_cube_map
• GL_ARB_texture_compression
• GL_ARB_texture_border_clamp
• GL_ARB_point_parameters
• GL_ARB_vertex_blend
• GL_ARB_matrix_palette
• GL_ARB_texture_env_combine
• GL_ARB_texture_env_crossbar
• GL_ARB_texture_env_dot3
• GL_ARB_texture_mirrored_repeat
• GL_ARB_depth_texture
• GL_ARB_shadow
• GL_ARB_shadow_ambient
• GL_ARB_window_pos
• GL_ARB_vertex_program
• GL_ARB_fragment_program
• GL_EXT_abgr
• GL_EXT_blend_color
• GL_EXT_polygon_offset
• GL_EXT_texture
• GL_EXT_texture3D
• GL_SGIS_texture_filter4
• GL_EXT_subtexture
• GL_EXT_copy_texture
• GL_EXT_histogram
• GL_EXT_convolution
• GL_SGI_color_matrix
• GL_SGI_color_table
• GL_SGIS_pixel_texture
• GL_SGIX_pixel_texture
• GL_SGIS_texture4D
• GL_SGI_texture_color_table
• GL_EXT_cmyka
• GL_EXT_texture_object
• GL_SGIS_detail_texture
• GL_SGIS_sharpen_texture
• GL_EXT_packed_pixels
• GL_SGIS_texture_lod
• GL_SGIS_multisample
• GL_EXT_rescale_normal
• GL_EXT_vertex_array
• GL_EXT_misc_attribute
• GL_SGIS_generate_mipmap
• GL_SGIX_clipmap
• GL_SGIX_shadow
• GL_SGIS_texture_edge_clamp
• GL_SGIS_texture_border_clamp
• GL_EXT_blend_minmax
• GL_EXT_blend_subtract
• GL_EXT_blend_logic_op
• GL_SGIX_interlace
• GL_SGIS_texture_select
• GL_SGIX_sprite
• GL_SGIX_texture_multi_buffer
• GL_EXT_point_parameters
• GL_SGIX_instruments
• GL_SGIX_texture_scale_bias
• GL_SGIX_framezoom
• GL_SGIX_tag_sample_buffer
• GL_SGIX_reference_plane
• GL_SGIX_flush_raster
• GL_SGIX_depth_texture
• GL_SGIS_fog_function
• GL_SGIX_fog_offset
• GL_HP_image_transform
• GL_HP_convolution_border_modes
• GL_SGIX_texture_add_env
• GL_EXT_color_subtable
• GL_PGI_vertex_hints
• GL_PGI_misc_hints
• GL_EXT_paletted_texture
• GL_EXT_clip_volume_hint
• GL_SGIX_list_priority
• GL_SGIX_ir_instrument1
• GL_SGIX_texture_lod_bias
• GL_SGIX_shadow_ambient
• GL_EXT_index_texture
• GL_EXT_index_material
• GL_EXT_index_func
• GL_EXT_index_array_formats
• GL_EXT_compiled_vertex_array
• GL_EXT_cull_vertex
• GL_SGIX_ycrcb
• GL_EXT_fragment_lighting
• GL_IBM_rasterpos_clip
• GL_HP_texture_lighting
• GL_EXT_draw_range_elements
• GL_WIN_phong_shading
• GL_WIN_specular_fog
• GL_EXT_light_texture
• GL_SGIX_blend_alpha_minmax
• GL_EXT_scene_marker
• GL_SGIX_pixel_texture_bits
• GL_EXT_bgra
• GL_SGIX_async
• GL_SGIX_async_pixel
• GL_SGIX_async_histogram
• GL_INTEL_texture_scissor
• GL_INTEL_parallel_arrays
• GL_HP_occlusion_test
• GL_EXT_pixel_transform
• GL_EXT_pixel_transform_color_table
• GL_EXT_shared_texture_palette
• GL_EXT_separate_specular_color
• GL_EXT_secondary_color
• GL_EXT_texture_env
• GL_EXT_texture_perturb_normal
• GL_EXT_multi_draw_arrays
• GL_EXT_fog_coord
• GL_REND_screen_coordinates
• GL_EXT_coordinate_frame
• GL_EXT_texture_env_combine
• GL_APPLE_specular_vector
• GL_APPLE_transform_hint
• GL_SUNX_constant_data
• GL_SUN_global_alpha
• GL_SUN_triangle_list
• GL_SUN_vertex
• GL_EXT_blend_func_separate
• GL_INGR_color_clamp
• GL_INGR_interlace_read
• GL_EXT_stencil_wrap
• GL_EXT_422_pixels
• GL_NV_texgen_reflection
• GL_SGIX_texture_range
• GL_SUN_convolution_border_modes
• GL_EXT_texture_env_add
• GL_EXT_texture_lod_bias
• GL_EXT_texture_filter_anisotropic
• GL_EXT_vertex_weighting
• GL_NV_light_max_exponent
• GL_NV_vertex_array_range
• GL_NV_register_combiners
• GL_NV_fog_distance
• GL_NV_texgen_emboss
• GL_NV_blend_square
• GL_NV_texture_env_combine4
• GL_MESA_resize_buffers
• GL_MESA_window_pos
• GL_EXT_texture_compression_s3tc
• GL_IBM_cull_vertex
• GL_IBM_multimode_draw_arrays
• GL_IBM_vertex_array_lists
• GL_3DFX_texture_compression_FXT1
• GL_3DFX_multisample
• GL_3DFX_tbuffer
• GL_SGIX_vertex_preclip
• GL_SGIX_resample
• GL_SGIS_texture_color_mask
• GL_EXT_texture_env_dot3
• GL_ATI_texture_mirror_once
• GL_NV_fence
• GL_IBM_static_data
• GL_IBM_texture_mirrored_repeat
• GL_NV_evaluators
• GL_NV_packed_depth_stencil
• GL_NV_register_combiners2
• GL_NV_texture_compression_vtc
• GL_NV_texture_rectangle
• GL_NV_texture_shader
• GL_NV_texture_shader2
• GL_NV_vertex_array_range2
• GL_NV_vertex_program
• GL_SGIX_texture_coordinate_clamp
• GL_OML_interlace
• GL_OML_subsample
• GL_OML_resample
• GL_NV_copy_depth_to_color
• GL_ATI_envmap_bumpmap
• GL_ATI_fragment_shader
• GL_ATI_pn_triangles
• GL_ATI_vertex_array_object
• GL_EXT_vertex_shader
• GL_ATI_vertex_streams
• GL_ATI_element_array
• GL_SUN_mesh_array
• GL_SUN_slice_accum
• GL_NV_multisample_filter_hint
• GL_NV_depth_clamp
• GL_NV_occlusion_query
• GL_NV_point_sprite
• GL_NV_texture_shader3
• GL_NV_vertex_program1_1
• GL_EXT_shadow_funcs
• GL_EXT_stencil_two_side
• GL_ATI_text_fragment_shader
• GL_APPLE_client_storage
• GL_APPLE_element_array
• GL_APPLE_fence
• GL_APPLE_vertex_array_object
• GL_APPLE_vertex_array_range
• GL_APPLE_ycbcr_422
• GL_ARB_vertex_buffer_object
• GL_S3_s3tc
• GL_ATI_draw_buffers
• GL_ATI_texture_env_combine3
• GL_ATI_texture_float
• GL_NV_float_buffer
• GL_NV_fragment_program
• GL_NV_half_float
• GL_NV_pixel_data_range
• GL_NV_primitive_restart
• GL_NV_texture_expand_normal
• GL_NV_vertex_program2
• GL_ATI_map_object_buffer
• GL_ATI_separate_stencil
• GL_ATI_vertex_attrib_array_object
OpenGL Extension Wrapper Flags
You can access these flags via the m_pGLExt member of the system parameters. This is a pointer to a XGSExtensionsGL structure.
The OpenGL extension wrapper flags [m_pGLExt] indicate whether a particular OpenGL extension is used. Simply test the appropriate field in that structure.
For example, if you want to test whether your hardware supports the GL_ARB_multitexture extension, then simply check if m_pGS->_GL_ARB_multitexture is set to TRUE.
You can access these flags via the m_pGLExtFuncs member of the system parameters. This is a pointer to a XGSGLExtensionsFuncs structure.
The OpenGL extension wrapper functions [m_pGLExtFuncs] can be called directly from that structure.
For example, if you want to call the glClientActiveTextureARB extension function, just use m_pGLExtFuncs->glClientActiveTextureARB.
XSI_OGLHelper is a helper library that is provided with the Realtime Shader API version 2.0. To use it, include the XSI_OGLHelper.h file and link with the XSI_OGLHelpr.lib library.
This section contains the follwoing topics:
• Texture Target and Texture Coordinate Management
• XSI_OGLHelper_NearestPowerOf2
Returns the nearest power of 2 of a value.
• XSI_OGLHelper_ComputeTransforms
Computes a 4x4 transformation matrix from a translation, rotation and scaling vector.
• XSI_OGLHelper_MatrixTranspose
Transposes a 4x4 matrix.
• XSI_OGLHelper_MatrixInvert
Inverts a 4x4 matrix.
• XSI_OGLHelper_MatrixMultiply
Multiplies 2 4x4 matrices
• XSI_OGLHelper_MatrixTrackWorld
Returns the current world matrix.
• XSI_OGLHelper_MatrixTrackView
Returns the current view matrix.
• XSI_OGLHelper_DrawGeometry
Draws the geometry using OpenGL.
Texture Target and Texture Coordinate Management
The drawing function needs to know which texture coordinate set is going to be used for a particular target. In order to do this, there is a structure called XSI_OGLHelper_TexCoordMap that is used. If your shader needs a texture coordinate set to be bound to a texture target, then it needs to fill in this structure. You should never overwrite existing data, instead check for the current active UVs, using the nbActiveUVs member and fill in starting from there.
For example, if the shader needs texture coordinate set 1 to be bound to texture target 2, then the following code should be used.
XSI_OGLHelper_TexCoordMap *pTexCoordMap = XSI_OGLHelper_GetTextureCoordMap(); pTexCoordMap->target[pTexCoordMap->nbActiveUVs] = 2; pTexCoordMap->UVSet[pTexCoordMap->nbActiveUVs] = 1; pTexCoordMap->nbActiveUVs ++;
If your shader has a texture projection parameter, then this parameter is converted to a LONG value. This value is the texture coordinate set to use for this shader.
• XSI_OGLHelper_GetTextureCoordMap
Gets the texture coordinate map
• XSI_OGLHelper_ResetTextureCoordMap
Resets the texture coordinate maps for the next draw