Changeset 171 for trunk/src/gl/gl_context.cc
- Timestamp:
- 07/18/13 00:50:12 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gl/gl_context.cc
r157 r171 7 7 #include "nv/gl/gl_enum.hh" 8 8 #include "nv/lib/gl.hh" 9 #include "nv/lib/sdl.hh" 9 10 10 11 using namespace nv; … … 349 350 350 351 351 gl_context::gl_context( device* a_device ) 352 : context( a_device ) 353 { 352 gl_context::gl_context( device* a_device, void* a_win_handle ) 353 : context( a_device ), m_handle( nullptr ) 354 { 355 #if NV_SDL_VERSION == NV_SDL_20 356 m_handle = SDL_GL_CreateContext( static_cast<SDL_Window*>( a_win_handle ) ); 357 358 if ( m_handle == 0 ) 359 { 360 NV_LOG( LOG_CRITICAL, "GL Context creation failed: " << SDL_GetError( ) ); 361 return; // TODO: Error report 362 } 363 #else 364 NV_UNUSED( a_win_handle ); 365 #endif 366 367 nv::load_gl_library(); 368 NV_LOG( LOG_INFO, "OpenGL Vendor : " << glGetString(GL_VENDOR) ); 369 NV_LOG( LOG_INFO, "OpenGL Renderer : " << glGetString(GL_RENDERER) ); 370 NV_LOG( LOG_INFO, "OpenGL Version : " << glGetString(GL_VERSION) ); 371 NV_LOG( LOG_INFO, "OpenGL GLSL Version : " << glGetString(GL_SHADING_LANGUAGE_VERSION) ); 372 #if NV_SDL_VERSION == NV_SDL_20 373 // SDL_GL_SetSwapInterval(1); 374 #endif 375 354 376 // TODO: do we really need this? 355 377 glPixelStorei( GL_UNPACK_ALIGNMENT, 1 ); 378 356 379 force_apply_render_state( m_render_state ); 357 380 } 381 382 383 nv::gl_context::~gl_context() 384 { 385 #if NV_SDL_VERSION == NV_SDL_20 386 SDL_GL_DeleteContext(static_cast<SDL_GLContext>( m_handle ) ); 387 #endif 388 } 389 358 390 359 391 void gl_context::draw( primitive prim, const render_state& rs, program* p, vertex_array* va, size_t count )
Note: See TracChangeset
for help on using the changeset viewer.