程序在 glBindFramebuffer(GL_FRAMEBUFFER, fb); 处崩溃;在函数 gen_texture
gdb 告诉我“程序收到信号 SIGILL,非法指令。”
void gen_texture(GLuint &color, int width, int height)
{
GLuint fb;
glGenFramebuffers(1, &fb);
glGenTextures(1, &color);
glBindFramebuffer(GL_FRAMEBUFFER, fb);
...
int main(int argc, char **argv)
{
glutInit (&argc, argv);
glutInitContextVersion(4, 3);
glutInitContextProfile(GLUT_CORE_PROFILE);
std::cout << std::hex << glGetError() << "\n" << std::flush;
glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGBA);
glutInitWindowSize (500, 500);
glutCreateWindow ("");
glutDisplayFunc (display);
glutIdleFunc (display);
std::cout << std::hex << glGetError() << "\n" << std::flush;
glewExperimental=GL_TRUE;
GLenum err=glewInit();
if(err!=GLEW_OK)
{
std::cerr << "glewInit fehlgeschlagen, aborting." << std::endl;
}
gen_texture(texture, 100, 60);
...