Skip to content

Instantly share code, notes, and snippets.

@grahamsellers
Created February 20, 2014 22:18
Show Gist options
  • Save grahamsellers/9124481 to your computer and use it in GitHub Desktop.
Save grahamsellers/9124481 to your computer and use it in GitHub Desktop.
Option 1: WHAT WE HAVE TODAY
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
// Blah
glDisable(GL_DEPTH_TEST);
Option 2: ONE ENTRY POINT, EXTRA PARAMETER
glSetEnable(GL_DEPTH_TEST, GL_TRUE);
glDepthFunc(GL_LEQUAL);
// Blah
glSetEnable(GL_DEPTH_TEST, GL_FALSE);
Option 3: ENTRY POINT PER CAP, BOOLEAN PARAMETER
glSetDepthTestEnable(GL_TRUE);
glDepthFunc(GL_LEQUAL);
// Blah
glSetDestTestEnable(GL_FALSE);
Option 4: TWO ENTRY POINTS PER CAP - NO PARAMETERS
glEnableDepthTest();
glDepthFunc(GL_LEQUAL);
// Blah
glDisableDepthTest();
Option 5: FOLD ENABLE INTO FUNC
glDepthFunc(GL_LEQUAL);
// Blah
glDepthFunc(GL_NONE);
@fatto
Copy link

fatto commented Feb 20, 2014

Little typo on (3). I think glSetDestTestEnable(GL_FALSE); should be glSetDepthTestEnable(GL_FALSE);

@Groovounet
Copy link

Option 6: enums!

enum depth_func
{
GL_DEPTH_FUNC_LEQUAL,
...
GL_DEPTH_FUNC_NONE
};

glDepthFunc(GL_DEPTH_FUNC_LEQUAL);
glDepthFunc(GL_DEPTH_FUNC_NONE);

Verbose but build time errors!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment