Skip to content

Instantly share code, notes, and snippets.

@ThePhD
Created September 9, 2015 02:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThePhD/54653aa479d10f54a951 to your computer and use it in GitHub Desktop.
Save ThePhD/54653aa479d10f54a951 to your computer and use it in GitHub Desktop.
Fails the 2nd time around
GLuint buffer = Gl::native_handle( *this, streamindex );
GLenum access = Gl::ToPlatform<GLenum>( gpubufferdesc.accessflags );
GLsizeiptr bytesize = vertices.size();
#ifdef FURROVINE_OPENGL44
// Broken on NVidia drivers for Windows 10, 9/8/2015
//auto map_named = gl::MapNamedBuffer;
//auto unmap_named = gl::UnmapNamedBuffer;
auto map_named = gl::MapNamedBufferEXT;
auto unmap_named = gl::UnmapNamedBufferEXT;
#elif defined FURROVINE_OPENGL33
auto map_named = gl::MapNamedBufferEXT;
auto unmap_named = gl::UnmapNamedBufferEXT;
#endif // OpenGL 4.4 | 3.3
void* mappedres = map_named( buffer, access );
std::memcpy( mappedres, vertices.data(), bytesize );
GLboolean r = unmap_named( buffer );
if ( r == gl::FALSE_ ) {
// panic
throw graphics_runtime_exception( "UnmapNamedBufferEXT failed", gl::GetError() );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment