Index: trunk/src/gl/gl_context.cc
===================================================================
--- trunk/src/gl/gl_context.cc	(revision 403)
+++ trunk/src/gl/gl_context.cc	(revision 406)
@@ -91,5 +91,5 @@
 	// TODO: support GL_READ_FRAMEBUFFER?
 	const gl_framebuffer_info* info  = m_framebuffers.get( f );
-	const gl_texture_info*     tinfo = (gl_texture_info*)m_device->get_texture_info( t );
+	const gl_texture_info*     tinfo = static_cast< const gl_texture_info* >( m_device->get_texture_info( t ) );
 	if ( info )
 	{
@@ -101,9 +101,9 @@
 			//		if ( tinfo->size.y == 0 )
 				//			glFramebufferTexture1D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+(unsigned)slot, GL_TEXTURE_1D, tinfo->glid, 0 );
-			glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+(unsigned)slot, gl_type, tinfo->glid, 0 );
+			glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+unsigned( slot ), gl_type, tinfo->glid, 0 );
 		}
 		else
 		{
-			glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+(unsigned)slot, gl_type, 0, 0 );
+			glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0+unsigned( slot ), gl_type, 0, 0 );
 		}
 
@@ -116,5 +116,5 @@
 	// TODO: support GL_READ_FRAMEBUFFER?
 	const gl_framebuffer_info* info  = m_framebuffers.get( f );
-	const gl_texture_info*     tinfo = (gl_texture_info*)m_device->get_texture_info( depth );
+	const gl_texture_info*     tinfo = static_cast< const gl_texture_info* >( m_device->get_texture_info( depth ) );
 	if ( info )
 	{
@@ -213,9 +213,10 @@
 void nv::gl_context::bind( program p )
 {
-	gl_program_info* info = ((gl_device*)m_device)->m_programs.get( p );
+	gl_device* gdevice    = static_cast<gl_device*>( m_device );
+	gl_program_info* info = gdevice->m_programs.get( p );
 	if ( info )
 	{
 		glUseProgram( info->glid );
-		((gl_device*)m_device)->update_uniforms( info );
+		gdevice->update_uniforms( info );
 	}
 }
@@ -248,11 +249,11 @@
 			}
 
-			glVertexAttribPointer( 
-				location, 
-				static_cast<GLint>( vba.components ), 
+			glVertexAttribPointer(
+				location,
+				static_cast<GLint>( vba.components ),
 				nv::datatype_to_gl_enum( vba.dtype ),
 				GL_FALSE,
 				static_cast<GLsizei>( vba.stride ),
-				(void*)vba.offset
+				reinterpret_cast<void*>( vba.offset )
 				);
 		}
@@ -317,5 +318,5 @@
 }
 
-void nv::gl_context::update( texture t, void* data )
+void nv::gl_context::update( texture t, const void* data )
 {
 	const gl_texture_info* info = static_cast< const gl_texture_info* >( m_device->get_texture_info( t ) );
@@ -327,5 +328,5 @@
 
 		glBindTexture( gl_type, info->glid );
-		glTexImage2D( gl_type, 0, (GLint)nv::image_format_to_internal_enum(format.format), size.x, size.y, 0, nv::image_format_to_enum(format.format), nv::datatype_to_gl_enum(format.type), data );
+		glTexImage2D( gl_type, 0, static_cast<GLint>( nv::image_format_to_internal_enum(format.format) ), size.x, size.y, 0, nv::image_format_to_enum(format.format), nv::datatype_to_gl_enum(format.type), data );
 	}
 }
@@ -338,5 +339,5 @@
 		GLenum glenum = buffer_type_to_enum( info->type );
 		glBindBuffer( glenum, info->glid );
-		glBufferSubData( glenum, (GLintptr)offset, (GLsizeiptr)size, data );
+		glBufferSubData( glenum, GLintptr( offset ), GLsizeiptr( size ), data );
 	}
 }
@@ -700,5 +701,5 @@
 void nv::gl_context::apply_engine_uniforms( program p, const scene_state& s )
 {
-	gl_program_info* info = ((gl_device*)m_device)->m_programs.get( p );
+	gl_program_info* info = static_cast<gl_device*>( m_device )->m_programs.get( p );
 	if ( info )
 	{
@@ -725,5 +726,5 @@
 		if ( slots[i] > OUTPUT_7 ) buffers[i] = 0;
 	}
-	glDrawBuffers( (GLsizei)count, buffers );
+	glDrawBuffers( GLsizei( count ), buffers );
 }
 
Index: trunk/src/gl/gl_device.cc
===================================================================
--- trunk/src/gl/gl_device.cc	(revision 403)
+++ trunk/src/gl/gl_device.cc	(revision 406)
@@ -53,5 +53,5 @@
 	assert( image->format->BytesPerPixel > 2 );
 	image_format format(image->format->BytesPerPixel == 3 ? RGB : RGBA, UBYTE );
-	image_data* data = new image_data( format, ivec2( image->w, image->h ), (nv::uint8*)image->pixels );
+	image_data* data = new image_data( format, ivec2( image->w, image->h ), static_cast<nv::uint8*>( image->pixels ) );
 	return data;
 }
@@ -62,5 +62,5 @@
 {
 	load_sdl_image_library();
-	SDL_Surface* image = IMG_LoadTyped_RW( SDL_RWFromMem( (void*)data, (int)size ), 1, "png" );
+	SDL_Surface* image = IMG_LoadTyped_RW( SDL_RWFromMem( const_cast<uint8*>( data ), int( size ) ), 1, "png" );
 	if ( !image )
 	{
@@ -71,5 +71,5 @@
 	assert( image->format->BytesPerPixel > 2 );
 	image_format format( image->format->BytesPerPixel == 3 ? RGB : RGBA, UBYTE );
-	image_data* idata = new image_data( format, ivec2( image->w, image->h ), ( nv::uint8* )image->pixels );
+	image_data* idata = new image_data( format, ivec2( image->w, image->h ), static_cast<nv::uint8*>( image->pixels ) );
 	return idata;
 }
@@ -86,5 +86,5 @@
 }
 
-nv::texture nv::gl_device::create_texture( texture_type type, ivec2 size, image_format aformat, sampler asampler, void* data /*= nullptr */ )
+nv::texture nv::gl_device::create_texture( texture_type type, ivec2 size, image_format aformat, sampler asampler, const void* data /*= nullptr */ )
 {
 	unsigned glid = 0;
@@ -106,10 +106,10 @@
 	}
 
-	glTexParameteri( gl_type, GL_TEXTURE_MIN_FILTER, (int)nv::sampler_filter_to_enum( asampler.filter_min ) );
-	glTexParameteri( gl_type, GL_TEXTURE_MAG_FILTER, (int)nv::sampler_filter_to_enum( asampler.filter_max ) );
-	glTexParameteri( gl_type, GL_TEXTURE_WRAP_S, (int)nv::sampler_wrap_to_enum( asampler.wrap_s) );
-	glTexParameteri( gl_type, GL_TEXTURE_WRAP_T, (int)nv::sampler_wrap_to_enum( asampler.wrap_t) );
-
-	glTexImage2D( gl_type, 0, (GLint)nv::image_format_to_internal_enum(aformat.format), size.x, size.y, 0, nv::image_format_to_enum(aformat.format), nv::datatype_to_gl_enum(aformat.type), data );
+	glTexParameteri( gl_type, GL_TEXTURE_MIN_FILTER, GLint( nv::sampler_filter_to_enum( asampler.filter_min ) ) );
+	glTexParameteri( gl_type, GL_TEXTURE_MAG_FILTER, GLint( nv::sampler_filter_to_enum( asampler.filter_max ) ) );
+	glTexParameteri( gl_type, GL_TEXTURE_WRAP_S, GLint( nv::sampler_wrap_to_enum( asampler.wrap_s) ) );
+	glTexParameteri( gl_type, GL_TEXTURE_WRAP_T, GLint( nv::sampler_wrap_to_enum( asampler.wrap_t) ) );
+
+	glTexImage2D( gl_type, 0, GLint( nv::image_format_to_internal_enum(aformat.format) ), size.x, size.y, 0, nv::image_format_to_enum(aformat.format), nv::datatype_to_gl_enum(aformat.type), data );
 
 	glBindTexture( gl_type, 0 );
@@ -163,5 +163,5 @@
 
 	glBindBuffer( glenum, glid );
-	glBufferData( glenum, (GLsizeiptr)size, source, buffer_hint_to_enum( hint ) );
+	glBufferData( glenum, GLsizeiptr( size ), source, buffer_hint_to_enum( hint ) );
 	glBindBuffer( glenum, 0 );
 
@@ -325,15 +325,15 @@
 			switch( ubase->get_type() )
 			{
-			case FLOAT          : glUniform1fv( uloc, ubase->get_length(), ((uniform< enum_to_type< FLOAT >::type >*)( ubase ))->get_value() ); break;
-			case INT            : glUniform1iv( uloc, ubase->get_length(), ((uniform< enum_to_type< INT >::type >*)( ubase ))->get_value() ); break;
-			case FLOAT_VECTOR_2 : glUniform2fv( uloc, ubase->get_length(), (GLfloat*)((uniform< enum_to_type< FLOAT_VECTOR_2 >::type >*)( ubase ))->get_value()); break;
-			case FLOAT_VECTOR_3 : glUniform3fv( uloc, ubase->get_length(), (GLfloat*)((uniform< enum_to_type< FLOAT_VECTOR_3 >::type >*)( ubase ))->get_value()); break;
-			case FLOAT_VECTOR_4 : glUniform4fv( uloc, ubase->get_length(), (GLfloat*)((uniform< enum_to_type< FLOAT_VECTOR_4 >::type >*)( ubase ))->get_value()); break;
-			case INT_VECTOR_2   : glUniform2iv( uloc, ubase->get_length(), (GLint*)((uniform< enum_to_type< INT_VECTOR_2 >::type >*)( ubase ))->get_value()); break;
-			case INT_VECTOR_3   : glUniform3iv( uloc, ubase->get_length(), (GLint*)((uniform< enum_to_type< INT_VECTOR_3 >::type >*)( ubase ))->get_value()); break;
-			case INT_VECTOR_4   : glUniform4iv( uloc, ubase->get_length(), (GLint*)((uniform< enum_to_type< INT_VECTOR_4 >::type >*)( ubase ))->get_value()); break;
-			case FLOAT_MATRIX_2 : glUniformMatrix2fv( uloc, ubase->get_length(), GL_FALSE, (GLfloat*)((uniform< enum_to_type< FLOAT_MATRIX_2 >::type >*)( ubase ))->get_value()); break;
-			case FLOAT_MATRIX_3 : glUniformMatrix3fv( uloc, ubase->get_length(), GL_FALSE, (GLfloat*)((uniform< enum_to_type< FLOAT_MATRIX_3 >::type >*)( ubase ))->get_value()); break;
-			case FLOAT_MATRIX_4 : glUniformMatrix4fv( uloc, ubase->get_length(), GL_FALSE, (GLfloat*)((uniform< enum_to_type< FLOAT_MATRIX_4 >::type >*)( ubase ))->get_value()); break;
+			case FLOAT          : glUniform1fv( uloc, ubase->get_length(), static_cast< uniform< enum_to_type< FLOAT >::type >*>( ubase )->get_value() ); break;
+			case INT            : glUniform1iv( uloc, ubase->get_length(), static_cast< uniform< enum_to_type< INT >::type >*>( ubase )->get_value() ); break;
+			case FLOAT_VECTOR_2 : glUniform2fv( uloc, ubase->get_length(), reinterpret_cast<const GLfloat*>( static_cast< uniform< enum_to_type< FLOAT_VECTOR_2 >::type >*>( ubase )->get_value())); break;
+			case FLOAT_VECTOR_3 : glUniform3fv( uloc, ubase->get_length(), reinterpret_cast<const GLfloat*>( static_cast< uniform< enum_to_type< FLOAT_VECTOR_3 >::type >*>( ubase )->get_value())); break;
+			case FLOAT_VECTOR_4 : glUniform4fv( uloc, ubase->get_length(), reinterpret_cast<const GLfloat*>( static_cast< uniform< enum_to_type< FLOAT_VECTOR_4 >::type >*>( ubase )->get_value())); break;
+			case INT_VECTOR_2   : glUniform2iv( uloc, ubase->get_length(), reinterpret_cast<const GLint*>( static_cast< uniform< enum_to_type< INT_VECTOR_2 >::type >*>( ubase )->get_value())); break;
+			case INT_VECTOR_3   : glUniform3iv( uloc, ubase->get_length(), reinterpret_cast<const GLint*>( static_cast< uniform< enum_to_type< INT_VECTOR_3 >::type >*>( ubase )->get_value())); break;
+			case INT_VECTOR_4   : glUniform4iv( uloc, ubase->get_length(), reinterpret_cast<const GLint*>( static_cast< uniform< enum_to_type< INT_VECTOR_4 >::type >*>( ubase )->get_value())); break;
+			case FLOAT_MATRIX_2 : glUniformMatrix2fv( uloc, ubase->get_length(), GL_FALSE, reinterpret_cast<const GLfloat*>( static_cast< uniform< enum_to_type< FLOAT_MATRIX_2 >::type >*>( ubase )->get_value())); break;
+			case FLOAT_MATRIX_3 : glUniformMatrix3fv( uloc, ubase->get_length(), GL_FALSE, reinterpret_cast<const GLfloat*>( static_cast< uniform< enum_to_type< FLOAT_MATRIX_3 >::type >*>( ubase )->get_value())); break;
+			case FLOAT_MATRIX_4 : glUniformMatrix4fv( uloc, ubase->get_length(), GL_FALSE, reinterpret_cast<const GLfloat*>( static_cast< uniform< enum_to_type< FLOAT_MATRIX_4 >::type >*>( ubase )->get_value())); break;
 			default : break; // error?
 			}
@@ -348,5 +348,5 @@
 	glGetProgramiv( p->glid, GL_ACTIVE_ATTRIBUTES, &params );
 
-	for ( unsigned i = 0; i < (unsigned)params; ++i )
+	for ( unsigned i = 0; i < unsigned( params ); ++i )
 	{
 		int attr_nlen;
@@ -377,5 +377,5 @@
 	glGetProgramiv( p->glid, GL_ACTIVE_UNIFORMS, &params );
 
-	for ( unsigned i = 0; i < size_t(params); ++i )
+	for ( unsigned i = 0; i < unsigned( params ); ++i )
 	{
 		int uni_nlen;
@@ -412,5 +412,5 @@
 
 	const char* pc = shader_code.data();
-	int l = (int)shader_code.length();
+	int l = int( shader_code.length() );
 
 	glShaderSource( glid, 1, &pc, &l );
@@ -428,9 +428,9 @@
 		if ( compile_ok == 0 )
 		{
-			NV_LOG_ERROR( "Shader #", glid, " error: ", buffer );
+			NV_LOG_ERROR( "Shader #", glid, " error: ", string_view( buffer, size_t( length ) ) );
 		}
 		else
 		{
-			NV_LOG_INFO( "Shader #", glid, " compiled successfully: ", buffer );
+			NV_LOG_INFO( "Shader #", glid, " compiled successfully: ", string_view( buffer, size_t( length ) ) );
 		}
 	}
Index: trunk/src/gl/gl_window.cc
===================================================================
--- trunk/src/gl/gl_window.cc	(revision 403)
+++ trunk/src/gl/gl_window.cc	(revision 406)
@@ -15,5 +15,5 @@
 {
 #if NV_PLATFORM == NV_WINDOWS
-		::SwapBuffers( (HDC)m_hwnd );
+		::SwapBuffers( reinterpret_cast<HDC>( m_hwnd ) );
 #else
 	NV_ASSERT( false, "Native GL context currently only working on Windows!" );
@@ -26,5 +26,5 @@
 	{
 #if NV_PLATFORM == NV_WINDOWS
-			dynwglDeleteContext( (HGLRC)m_context->get_native_handle() );
+			dynwglDeleteContext( reinterpret_cast<HGLRC>( m_context->get_native_handle() ) );
 #endif
 	}
@@ -40,8 +40,8 @@
 	m_input = a_input;
 
-	m_handle = (void*)handle;
+	m_handle = handle;
 
 	// TODO: error checking
-	HDC hdc = (HDC)dc;
+	HDC hdc = reinterpret_cast<HDC>( dc );
 
 	const int wgl_attrib_list[] =
@@ -103,5 +103,5 @@
 //  	m_height  = (uint16)rect.bottom;
 	m_handle  = wm->adopt_window( handle );
-	m_hwnd    = ::GetDC( (HWND)handle );
+	m_hwnd    = ::GetDC( reinterpret_cast<HWND>( handle ) );
 	m_context->set_viewport( nv::ivec4( 0, 0, m_width, m_height ) );
 #else
