Last active
June 15, 2021 20:00
-
-
Save openglfreak/192c7314f92189234bb09c52e5c35cc5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void test(void) | |
{ | |
GLenum glerr; | |
bool has_error = false; | |
GLuint tex[2]; | |
PFNGLXCOPYIMAGESUBDATANVPROC p_glXCopyImageSubDataNV; | |
#define check() \ | |
while ((glerr = glGetError()) != GL_NO_ERROR) { \ | |
has_error = true; \ | |
blog(LOG_ERROR, "GL error: %x", glerr); \ | |
} \ | |
if (has_error) { \ | |
return; \ | |
} | |
glGenTextures(2, tex); | |
check() | |
glBindTexture(GL_TEXTURE_2D, tex[0]); | |
check() | |
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1920, 1080, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL); | |
check() | |
glBindTexture(GL_TEXTURE_2D, tex[1]); | |
check() | |
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1920, 1080, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL); | |
check() | |
p_glXCopyImageSubDataNV = (PFNGLXCOPYIMAGESUBDATANVPROC)glXGetProcAddress((const GLubyte*)"glXCopyImageSubDataNV"); | |
p_glXCopyImageSubDataNV( | |
glXGetCurrentDisplay(), | |
NULL, tex[0], GL_TEXTURE_2D, 0, 0, 0, 0, | |
NULL, tex[1], GL_TEXTURE_2D, 0, 0, 0, 0, | |
1920, 1080, 1 | |
); | |
check() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment