DI-Guy API, OpenGL Graphics Module

Generated from diguy_graphics_ogl.h

DI-Guy API Version 12.5.1

This file was automatically generated from diguy_graphics_ogl.h. Do not edit this file directly; the changes will be lost.
Includes: diguy_api.h | graphics_init_ogl.h | declspec_diguy_graphics.h

Contents:

Alphabetical Index

Link against: libdiguy_graphics_ogl

Functions

function diguy_ogl_initialize

Prototype:

diguy_ogl_initialize(bdiGraphicsInitOgl* init);
Description:

This function initializes the DI-Guy Runtime API for the OpenGL environment.

This function should only be called once per program execution.

Do not call this function again, even after calling

diguy_deinitialize().

Use diguy_ogl_get_defaults() to fill out the init structure before changing specific entries.

Arguments:

initpointer to type bdiGraphicsInitOgl; passing NULL will cause defaults to be used for all values
Returns:

0 on success, non-zero error code on failure

Refer to diguy_constants.h for error code values.

function diguy_ogl_get_defaults

Prototype:

diguy_ogl_get_defaults(bdiGraphicsInitOgl* init);
Description:

Fills out the init structure with default values. Selected entries can then be changed before calling diguy_ogl_initialize().

Arguments:

initpointer to type bdiGraphicsInitOgl
Returns:

0 on success, -1 on failure

function diguy_default_fire_weapon_intersection_function

Prototype:

int diguy_default_fire_weapon_intersection_function(diguyImpact* impact,
    float from_x,
    float from_y,
    float from_z,
    float to_x,
    float to_y,
    float to_z,
    diguyScenario* scenario);
Description:

This function is the default fire intersection function. It uses a minimal render of the scene and characters into the back buffer to fill out the impact structure.

It may be useful to combine your intersection results with the results from this function.

Experimental Functions
The following functions are experimental and may change or disappear with no warning.

function diguy_ogl_generate_character_texture_list

Prototype:

int diguy_ogl_generate_character_texture_list(diguyScenario* scenario,
    int character_index);
Description:

This function queries the character for the OpenGL texture objects it is using and stores them in an internal list. This internal list can then be accessed via the following functions:

diguy_ogl_get_character_texture_list_num_textures();
diguy_ogl_get_character_texture_list_texture_object_at_index();
diguy_ogl_get_character_texture_list_texture_filename_at_index();
The function diguy_ogl_release_character_texture_list() should be called once query calls are complete to avoid a resource leak.

Note that there is currently only one internal texture list; there are not separate lists per character. Calling this function again, even with a different scenario pointer and/or character index, will clobber the previous texture list.

Arguments:

scenario pointer to character's scenario
character_index index of character to be queried
Returns:

0 on success, -1 on failure

C++ Example:

diguy_ogl_generate_character_texture_list(scenario,
    character_index);

int texture_count = diguy_ogl_get_character_texture_list_num_textures(scenario,
    character_index);

if (texture_count > 0)
{
    int texture_index;

    for (texture_index = 0;
        texture_index < texture_count;
        texture_index++)
    {
        GLuint texture_object = diguy_ogl_get_character_texture_list_texture_object_at_index(scenario,
            character_index,
            texture_index);

        const char* texture_filename = diguy_ogl_get_character_texture_list_texture_filename_at_index(scenario,
            character_index,
            texture_index);

        bdi_log_printf(BDI_LOG_WARN, "\ttexture object = %ld, filename = %s\n",
            texture_object,
            texture_filename);
    }

    GLuint texture_object = diguy_ogl_get_character_texture_list_texture_object_at_index(scenario,
        character_index,
        0); // the first texture in the list

    //
    //  (Code to override/replace the texture)
    //

    diguy_ogl_set_character_texture_objects_modified(scenario,
        character_index);

    diguy_ogl_release_character_texture_list(scenario,
        character_index);
}

function diguy_ogl_release_character_texture_list

Prototype:

int diguy_ogl_release_character_texture_list(diguyScenario* scenario,
    int character_index);
Description:

This function releases a texture list generated by diguy_ogl_generate_character_texture_list().

Arguments:

scenario pointer to character's scenario
character_index index of character to be queried
Returns:

0 on success, -1 on failure

function diguy_ogl_get_character_texture_list_num_textures

Prototype:

int diguy_ogl_get_character_texture_list_num_textures(diguyScenario* scenario,
    int character_index);
Description:

This function returns the number of textures used by the specified character.

The function diguy_ogl_generate_character_texture_list() must be called before this function. The scenario and character_index arguments passed to this function must match those passed to the generate function.

Arguments:

scenario pointer to character's scenario
character_index index of character to be queried
Returns:

number of textures in texture list

function diguy_ogl_get_character_texture_list_texture_object_at_index

Prototype:

GLuint diguy_ogl_get_character_texture_list_texture_object_at_index(diguyScenario* scenario,
    int character_index,
    int texture_list_index);
Description:

This function returns the OpenGL texture object at the specified index.

The function diguy_ogl_generate_character_texture_list() must be called before this function. The scenario and character_index arguments passed to this function must match those passed to the generate function.

Arguments:

scenario pointer to character's scenario
character_index index of character to be queried
texture_list_index index of texture in texture list
Returns:

OpenGL texture object

function diguy_ogl_get_character_texture_list_texture_filename_at_index

Prototype:

const char* diguy_ogl_get_character_texture_list_texture_filename_at_index(diguyScenario* scenario,
    int character_index,
    int texture_list_index);
Description:

This function returns the filename of the texture at the specified index.

The function diguy_ogl_generate_character_texture_list() must be called before this function. The scenario and character_index arguments passed to this function must match those passed to the generate function.

Arguments:

scenario pointer to character's scenario
character_index index of character to be queried
texture_list_index index of texture in texture list
Returns:

filename of the texture

function diguy_ogl_set_character_texture_objects_modified

Prototype:

int diguy_ogl_set_character_texture_objects_modified(diguyScenario* scenario,
    int character_index);
Description:

This function notifies the character that its texture objects have been modified and that it should take any steps necessary to update its internal state to ensure proper display.

Arguments:

scenario pointer to character's scenario
character_index index of character to be queried
Returns:

0 on success, -1 on failure

function diguy_ogl_get_texture_unit

Prototype:

int diguy_ogl_get_texture_unit();
Description:

This function returns the texture unit that DI-Guy is currently set to use.

Returns:

integer identifying texture unit; e.g., 0 for texture unit 0

function diguy_ogl_set_texture_unit

Prototype:

int diguy_ogl_set_texture_unit(int texture_unit);
Description:

This function sets the texture unit that DI-Guy should use.

Arguments:

texture_unitinteger identifying texture unit
Possible values are:

0use GL_TEXTURE0
1use GL_TEXTURE1
2use GL_TEXTURE2
3use GL_TEXTURE3
Returns:

0 on success, -1 on failure

function diguy_ogl_set_use_far_positions

Prototype:

void diguy_ogl_set_use_far_positions(int val);
Description:

This function turns far position rendering on or off. See diguyViewCamera for more information on far positions.

Arguments:

valpass 1 to use far positions, 0 to not use them

function diguy_ogl_get_use_far_positions

Prototype:

int diguy_ogl_get_use_far_positions();
Returns:

1 if far positions are in use, else 0

function diguy_ogl_set_default_shader_source_files

Prototype:

void diguy_ogl_set_default_shader_source_files(const char* shader_name,
    const char* vert_filename,
    const char* pixel_filename);
Description:

This function sets the shader source files that will be used for the specified shader.

The default filenames for the "diguy_character" shader are "diguy_character_glsl.vert" and "diguy_character_glsl.frag".

Arguments:

shader_name name with which vertex/pixel shader pair can be referenced
vert_filename name of vertex shader source file
pixel_filenamename of pixel (fragment) shader source file

function diguy_ogl_render_shadow_map

Prototype:

int diguy_ogl_render_shadow_map(unsigned int texture_unit,  // 0 to 7, not GL_TEXTURE0 to GL_TEXTURE7
    diguyViewLight* light,
    diguyScenario* scenario,
    float pos_above_terrain);
Description:

Renders a shadow pass of the world and binds into the target texture unit.

function diguy_ogl_apply_active_lights

Prototype:

int diguy_ogl_apply_active_lights(diguyScenario* scenario);
Description:

Applies active lights to the OpenGL state, also updates default shader uniforms and calls diguyScenario::set_num_active_point_lights()

Returns:

The number of active lights

Experimental Heads-Up Display Functions
The following functions are experimental and may change or disappear with no warning.

function diguy_ogl_2d_set_color

Prototype:

int diguy_ogl_2d_set_color(float r, float g, float b, float a);

function diguy_ogl_2d_draw_filled_rect

Prototype:

int diguy_ogl_2d_draw_filled_rect(int x0, int y0, int x1, int y1);

function diguy_ogl_2d_draw_text

Prototype:

int diguy_ogl_2d_draw_text(int x, int y, const char* text);

function diguy_ogl_2d_get_text_width

Prototype:

int diguy_ogl_2d_get_text_width(const char* text);

function diguy_ogl_2d_get_text_height

Prototype:

int diguy_ogl_2d_get_text_height(const char* text);

function diguy_ogl_get_fbo_texture_id

Prototype:

int diguy_ogl_get_fbo_texture_id();

function diguy_ogl_reload_changed_textures

Prototype:

int diguy_ogl_reload_changed_textures();
Experimental frame stats API
Currently available stats:

Stats should be cleared once a frame to get accurate results.

function diguy_ogl_get_num_frame_stats

Prototype:

int diguy_ogl_get_num_frame_stats();

function diguy_ogl_frame_stat_name

Prototype:

const char* diguy_ogl_frame_stat_name(int index);

function diguy_ogl_get_frame_stat

Prototype:

int diguy_ogl_get_frame_stat(const char* stat_name);

function diguy_ogl_clear_all_frame_stats

Prototype:

int diguy_ogl_clear_all_frame_stats();

function diguy_ogl_draw_frame_stats

Prototype:

int diguy_ogl_draw_frame_stats(int sx, int sy);

Alphabetical Index




Copyright (C) 1992-2012 Boston Dynamics

ALL RIGHTS RESERVED.

These coded instructions, statements, and computer programs contain unpublished proprietary information of Boston Dynamics and are protected by Copyright Laws of the United States. They may not be used, duplicated, or disclosed in any form, in whole or in part, without the prior written consent from Boston Dynamics.

RESTRICTED RIGHTS LEGEND

Use, duplication, or disclosure by the government is subject to restrictions as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Sofware clause at DFARS 252.227-7013 and/or in similar or successor clauses in the FAR, or the DOD or NASA FAR Supplement, or to subparagraphs (c)(1) and (c)(2) of the Commercial Computer Software--Restricted Rights at 48 CFR 52.227-19, as applicable. Unpublished-rights reserved under the Copyright Laws of the United States.

Contractor/Manufacturer is:

Boston Dynamics/78 Fourth Avenue/Waltham MA 02451.