Wag*_*ota 3 opengl fbo glew framebuffer glfw
我收到此错误:
"访问冲突执行位置0x00000000."
当我在Windows上使用GLFW + GLEW时.
我正在使用Windows 7.我也有自己的实现(从头开始)创建一个窗口,初始化OpenGL上下文,初始化GLEW等等......一切正常.所以当然我的视频卡具有帧缓冲功能,驱动程序的一切都很好......问题只发生在我尝试使用GLFW时.
有什么建议吗?
代码:
void start()
{
if( !glfwInit() )
{
glfwTerminate();
throw exception( "Failed to initialize GLFW" );
}
glfwOpenWindowHint( GLFW_FSAA_SAMPLES, 4 );
glfwOpenWindowHint( GLFW_OPENGL_VERSION_MAJOR, 3 );
glfwOpenWindowHint( GLFW_OPENGL_VERSION_MINOR, 3 );
glfwOpenWindowHint( GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE );
if( !glfwOpenWindow( m_width, m_height, 0, 0, 0, 0, 32, 0, GLFW_WINDOW ) )
{
throw exception( "Failed to open GLFW window." );
glfwTerminate();
}
if ( glewInit() != GLEW_OK )
{
throw exception( "Failed to initialize GLEW" );
}
// texture
glGenTextures( 1, &m_texture );
glBindTexture( GL_TEXTURE_2D, m_texture );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, m_width, m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
// frame buffer
glGenFramebuffers( 1, &m_frameBuffer ); // IT CRASHES HERE! :-(
glBindFramebuffer( GL_FRAMEBUFFER, m_frameBuffer );
glBindTexture( GL_TEXTURE_2D, m_texture );
...
}
Run Code Online (Sandbox Code Playgroud)