Mercurial > hg > orthanc-stone
comparison Framework/Scene2D/Internals/OpenGLLinesProgram.cpp @ 694:7c6197d9acc9
Fixed a bunch of truncation warnings in various parts of the library
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Fri, 17 May 2019 09:21:30 +0200 |
parents | 9a474e90e832 |
children | c0a5eb9a4290 |
comparison
equal
deleted
inserted
replaced
693:9a474e90e832 | 694:7c6197d9acc9 |
---|---|
418 double t1 = std::max(thickness, aliasingBorder); | 418 double t1 = std::max(thickness, aliasingBorder); |
419 double t0 = std::max(0.0, thickness - aliasingBorder); | 419 double t0 = std::max(0.0, thickness - aliasingBorder); |
420 | 420 |
421 glUniform1f(program_->GetUniformLocation("u_thickness"), | 421 glUniform1f(program_->GetUniformLocation("u_thickness"), |
422 static_cast<GLfloat>(t1 / zoom)); | 422 static_cast<GLfloat>(t1 / zoom)); |
423 glUniform1f(program_->GetUniformLocation("u_antialiasing_start"), | 423 glUniform1f(program_->GetUniformLocation("u_antialiasing_start"), |
424 static_cast<GLfloat>(t0 / t1)); | 424 static_cast<GLfloat>(t0 / t1)); |
425 } | 425 } |
426 else | 426 else |
427 { | 427 { |
428 glUniform1f(program_->GetUniformLocation("u_thickness"), | 428 glUniform1f(program_->GetUniformLocation("u_thickness"), |
429 static_cast<GLfloat>(thickness / zoom)); | 429 static_cast<GLfloat>(thickness / zoom)); |
430 } | 430 } |
431 } | 431 } |
432 else | 432 else |
433 { | 433 { |
434 if (antialiasing) | 434 if (antialiasing) |
435 { | 435 { |
436 double t1 = std::max(thickness, aliasingBorder / zoom); | 436 double t1 = std::max(thickness, aliasingBorder / zoom); |
437 double t0 = std::max(0.0, thickness - aliasingBorder / zoom); | 437 double t0 = std::max(0.0, thickness - aliasingBorder / zoom); |
438 | 438 |
439 glUniform1f(program_->GetUniformLocation("u_thickness"), | 439 glUniform1f(program_->GetUniformLocation("u_thickness"), |
440 static_cast<GLfloat>(t1)); | 440 static_cast<GLfloat>(t1)); |
441 glUniform1f(program_->GetUniformLocation("u_antialiasing_start"), | 441 glUniform1f(program_->GetUniformLocation("u_antialiasing_start"), |
442 static_cast<GLfloat>(t0 / t1)); | 442 static_cast<GLfloat>(t0 / t1)); |
443 } | 443 } |
444 else | 444 else |
445 { | 445 { |
446 glUniform1f(program_->GetUniformLocation("u_thickness"), | 446 glUniform1f(program_->GetUniformLocation("u_thickness"), |
447 static_cast<GLfloat>(thickness)); | 447 static_cast<GLfloat>(thickness)); |
448 } | 448 } |
449 } | 449 } |
450 | 450 |
451 if (antialiasing) | 451 if (antialiasing) |
452 { | 452 { |
453 glEnable(GL_BLEND); | 453 glEnable(GL_BLEND); |
454 glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); | 454 glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
455 glDrawArrays(GL_TRIANGLES, 0, data.GetVerticesCount()); | 455 glDrawArrays(GL_TRIANGLES, 0, |
456 static_cast<GLsizei>(data.GetVerticesCount())); | |
456 glDisable(GL_BLEND); | 457 glDisable(GL_BLEND); |
457 } | 458 } |
458 else | 459 else |
459 { | 460 { |
460 glDrawArrays(GL_TRIANGLES, 0, data.GetVerticesCount()); | 461 glDrawArrays(GL_TRIANGLES, 0, |
462 static_cast<GLsizei>(data.GetVerticesCount())); | |
461 } | 463 } |
462 | 464 |
463 glDisableVertexAttribArray(locationPosition); | 465 glDisableVertexAttribArray(locationPosition); |
464 glDisableVertexAttribArray(locationMiterDirection); | 466 glDisableVertexAttribArray(locationMiterDirection); |
465 } | 467 } |