For an example of the code to create a window surface, see file example\cube\main.c.
example\cube\main.c