简体   繁体   中英

Segfault on glBlendFunc

I have the following code to begin a frame:

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

Without the last line, the program runs (but obviously does not blend), but with it it segfaults. GDB is not a lot of help, as it looks like the stack is corrupted, and after the segfault, running:

set $pc = *(void**)$rsp
set $rsp = $rsp+8

Points to the ending brace of the function as the last frame.

I have a small suspicion that this is a bug in the driver, but couldn't find a bug report on their tracker. The driver is flgrx-updates running on Ubuntu. GLXInfo gives:

OpenGL vendor string: Advanced Micro Devices, Inc.
OpenGL renderer string: AMD Radeon R9 200 Series
OpenGL core profile version string: 4.3.13399 Core Profile Context 15.201.1151
OpenGL core profile shading language version string: 4.40
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

Okay, I still don't really know why this fixes it - but the seg fault was caused by me changing the order the object files were specified in the linking command. But specifying the object file that loads the function pointers to OpenGL before the file that uses those functions makes everything work nicely.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM