IceTContext icetCreateContext(IceTCommunicator comm)
{
    int idx;

    for (idx = 0; idx < num_contexts; idx++) {
        if (context_list[idx].state == NULL) {
            break;
        }
    }

    if (idx >= num_contexts) {
        num_contexts += 4;
        context_list = realloc(context_list,
                               num_contexts*sizeof(struct IceTContext));
        memset(context_list + idx, 0, 4 * sizeof(struct IceTContext));
    }

    context_list[idx].communicator = comm->Duplicate(comm);

    context_list[idx].buffer = NULL;
    context_list[idx].buffer_size = 0;
    context_list[idx].buffer_offset = 0;

    context_list[idx].display_inflate_texture = 0;

    context_list[idx].state = icetStateCreate();

    icetSetContext(idx);
    icetStateSetDefaults();

    return idx;
}
Exemple #2
0
IceTContext icetCreateContext(IceTCommunicator comm)
{
    IceTContext context = malloc(sizeof(struct IceTContextStruct));

    context->magic_number = CONTEXT_MAGIC_NUMBER;

    context->communicator = comm->Duplicate(comm);

    context->state = icetStateCreate();

    icetSetContext(context);
    icetStateSetDefaults();

    return context;
}