Projects‎ > ‎WOGL‎ > ‎

Documentation with examples

It is recommend reviewing the functions provided from WOGL. There are about 10 functions.

Library documentation

Basic program

#include <stdio.h>

#include <stdlib.h>


#include "wogl.h"


// when a key is pressed

void mykeypressedfunc(int key) 

{

    if (key == WOGL_KEY_ESCAPE)

    {

        // exit nicely

        exit(0);

    }

}


void displayfunc() 

{

    // display nothing, print something

    printf("display function called\n");

}


int main(int argc, char *argv[]) 

{    

    int err;

    

    // initialise wogl

    err = wogl_init(400, 400);

    if (err != WOGL_SUCCESS)

    {

        printf("WOGL init failed\n");

        return -1;

    }

    

    // tell wogl which functions to call

    wogl_set_keyboard_callback(mykeypressedfunc);

    wogl_set_display_callback(displayfunc);

    

    // begin the event loop

    err = wogl_start_rendering();

    if (err != WOGL_SUCCESS)

    {

        printf("WOGL start render failed\n");

        return -2;

    }

    

    return 0;

}


Linking to WOGL library with Microsoft Visual Studio

You can use the visual studio template solution that includes:
  • wogl header file
  • wogl development library
  • wogl runtime library DLL
  • and sample code
Alternatively, you can add wogl as a dependency to an existing project.

1) Add the wogl.h source file to the project.




2) Right click on the project name and select Properties


3) Under Linker option, choose Input. type in wogl.lib followed by a delimiter colon ';'


4) Ensure that your library search path includes the location of wogl.lib. This is found under Linker, General. Using a period '.' sets the current project directory as the location of wogl.lib.


Comments