aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-07-19 06:06:06 +0200
committerdec05eba <dec05eba@protonmail.com>2021-07-19 06:06:06 +0200
commit7b39bd81c0933e94e0b9f662a035bb76b3439373 (patch)
treebd305dffce819912f138c8d1bc0543a0ee6c9fee /src
parent5ad433c2677bc4a49ee825b4b76fd330ac9de99a (diff)
Fix first frame being black
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/main.cpp b/src/main.cpp
index f9f0ea4..782e329 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -177,8 +177,6 @@ static bool recreate_window_pixmap(Display *dpy, Window window_id,
// GLX_Y_INVERTED_EXT, (int)GLX_DONT_CARE,
None};
- // Note that mipmap is generated even though its not used.
- // glCopyImageSubData fails if the texture doesn't have mipmap.
const int pixmap_attribs[] = {GLX_TEXTURE_TARGET_EXT,
GLX_TEXTURE_2D_EXT,
GLX_TEXTURE_FORMAT_EXT,
@@ -265,11 +263,6 @@ static bool recreate_window_pixmap(Display *dpy, Window window_id,
pixmap.texture_height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
int err2 = glGetError();
fprintf(stderr, "error: %d\n", err2);
- glCopyImageSubData(pixmap.texture_id, GL_TEXTURE_2D, 0, 0, 0, 0,
- pixmap.target_texture_id, GL_TEXTURE_2D, 0, 0, 0, 0,
- pixmap.texture_width, pixmap.texture_height, 1);
- int err = glGetError();
- fprintf(stderr, "error: %d\n", err);
// glXBindTexImageEXT(dpy, pixmap.glx_pixmap, GLX_FRONT_EXT, NULL);
// glGenerateTextureMipmapEXT(glxpixmap, GL_TEXTURE_2D);
@@ -1007,7 +1000,7 @@ int main(int argc, char **argv) {
double frame_start = glfwGetTime();
glfwPollEvents();
- /*glClear(GL_COLOR_BUFFER_BIT);*/
+ glClear(GL_COLOR_BUFFER_BIT);
if (XCheckTypedWindowEvent(dpy, src_window_id, ConfigureNotify, &e) && e.xconfigure.window == src_window_id) {
// Window resize
if(e.xconfigure.width != window_width || e.xconfigure.height != window_height) {
@@ -1093,6 +1086,7 @@ int main(int argc, char **argv) {
window_pixmap.texture_id, GL_TEXTURE_2D, 0, 0, 0, 0,
window_pixmap.target_texture_id, GL_TEXTURE_2D, 0, 0, 0, 0,
window_pixmap.texture_width, window_pixmap.texture_height, 1);
+ glfwSwapBuffers(window);
// int err = glGetError();
// fprintf(stderr, "error: %d\n", err);
@@ -1112,7 +1106,6 @@ int main(int argc, char **argv) {
memcpy_struct.Height = frame->height;
cuMemcpy2D(&memcpy_struct);
// res = cuCtxPopCurrent(&old_ctx);
- glfwSwapBuffers(window);
}
frame->pts = frame_count;