Skip to content

GL Loader System #21

@Lokathor

Description

@Lokathor

Separate from initializing a GL context (very platform specific) is the issue of making that GL context even slightly easy to use (fairly platform neutral).

Basically you usually end up with a function like:

fn gl_get_proc_address(name: &[u8]) -> *mut c_void;

And from there you fill in a struct of pointers or you fill in some global static values.

// global fn style
glClearColor(1.0, 1.0, 0.5, 1.0);

// struct style
gl.Clear(GL_COLOR_BUFFER_BIT);

The global functions style is a hair easier to use, but the struct style connects the fns more closely to their context (which is essentially "more correct").

So we should have a lesson about how you do all this. We don't have to do the full thing necessarily, since our actual GL usage is very modest. We can just show people what they would do and then say "now go use the crate".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions