Disable glow lines (and the use of geometry shaders) on non-Windows platforms for now

This commit is contained in:
Brad Davis 2016-07-23 10:58:35 -07:00
parent 89d9affb41
commit 85b0440e32
3 changed files with 23 additions and 1 deletions

View file

@ -113,10 +113,12 @@ void HmdDisplayPlugin::customizeContext() {
updateReprojectionProgram(); updateReprojectionProgram();
updateOverlayProgram(); updateOverlayProgram();
#ifdef HMD_HAND_LASER_SUPPORT
updateLaserProgram(); updateLaserProgram();
_laserGeometry = loadLaser(_laserProgram); _laserGeometry = loadLaser(_laserProgram);
#endif
} }
//#define LIVE_SHADER_RELOAD 1 //#define LIVE_SHADER_RELOAD 1
static QString readFile(const QString& filename) { static QString readFile(const QString& filename) {
@ -162,6 +164,7 @@ void HmdDisplayPlugin::updateReprojectionProgram() {
} }
#ifdef HMD_HAND_LASER_SUPPORT
void HmdDisplayPlugin::updateLaserProgram() { void HmdDisplayPlugin::updateLaserProgram() {
static const QString vsFile = PathUtils::resourcesPath() + "/shaders/hmd_hand_lasers.vert"; static const QString vsFile = PathUtils::resourcesPath() + "/shaders/hmd_hand_lasers.vert";
static const QString gsFile = PathUtils::resourcesPath() + "/shaders/hmd_hand_lasers.geom"; static const QString gsFile = PathUtils::resourcesPath() + "/shaders/hmd_hand_lasers.geom";
@ -202,6 +205,7 @@ void HmdDisplayPlugin::updateLaserProgram() {
} }
} }
} }
#endif
void HmdDisplayPlugin::updateOverlayProgram() { void HmdDisplayPlugin::updateOverlayProgram() {
static const QString vsFile = PathUtils::resourcesPath() + "/shaders/hmd_ui_glow.vert"; static const QString vsFile = PathUtils::resourcesPath() + "/shaders/hmd_ui_glow.vert";
@ -249,8 +253,10 @@ void HmdDisplayPlugin::uncustomizeContext() {
_compositeFramebuffer.reset(); _compositeFramebuffer.reset();
_previewProgram.reset(); _previewProgram.reset();
_reprojectionProgram.reset(); _reprojectionProgram.reset();
#ifdef HMD_HAND_LASER_SUPPORT
_laserProgram.reset(); _laserProgram.reset();
_laserGeometry.reset(); _laserGeometry.reset();
#endif
Parent::uncustomizeContext(); Parent::uncustomizeContext();
} }
@ -516,6 +522,7 @@ bool HmdDisplayPlugin::setHandLaser(uint32_t hands, HandLaserMode mode, const ve
} }
void HmdDisplayPlugin::compositeExtra() { void HmdDisplayPlugin::compositeExtra() {
#ifdef HMD_HAND_LASER_SUPPORT
// If neither hand laser is activated, exit // If neither hand laser is activated, exit
if (!_presentHandLasers[0].valid() && !_presentHandLasers[1].valid()) { if (!_presentHandLasers[0].valid() && !_presentHandLasers[1].valid()) {
return; return;
@ -584,4 +591,5 @@ void HmdDisplayPlugin::compositeExtra() {
} }
}); });
glDisable(GL_BLEND); glDisable(GL_BLEND);
#endif
} }

View file

@ -14,6 +14,10 @@
#include "../OpenGLDisplayPlugin.h" #include "../OpenGLDisplayPlugin.h"
#ifdef Q_OS_WIN
#define HMD_HAND_LASER_SUPPORT
#endif
class HmdDisplayPlugin : public OpenGLDisplayPlugin { class HmdDisplayPlugin : public OpenGLDisplayPlugin {
using Parent = OpenGLDisplayPlugin; using Parent = OpenGLDisplayPlugin;
public: public:
@ -93,7 +97,9 @@ protected:
private: private:
void updateOverlayProgram(); void updateOverlayProgram();
#ifdef HMD_HAND_LASER_SUPPORT
void updateLaserProgram(); void updateLaserProgram();
#endif
void updateReprojectionProgram(); void updateReprojectionProgram();
bool _enablePreview { false }; bool _enablePreview { false };
@ -130,11 +136,13 @@ private:
ShapeWrapperPtr _sphereSection; ShapeWrapperPtr _sphereSection;
#ifdef HMD_HAND_LASER_SUPPORT
ProgramPtr _laserProgram; ProgramPtr _laserProgram;
struct LaserUniforms { struct LaserUniforms {
int32_t mvp { -1 }; int32_t mvp { -1 };
int32_t color { -1 }; int32_t color { -1 };
} _laserUniforms; } _laserUniforms;
ShapeWrapperPtr _laserGeometry; ShapeWrapperPtr _laserGeometry;
#endif
}; };

View file

@ -1552,6 +1552,12 @@ void GeometryCache::renderLine(gpu::Batch& batch, const glm::vec2& p1, const glm
void GeometryCache::renderGlowLine(gpu::Batch& batch, const glm::vec3& p1, const glm::vec3& p2, void GeometryCache::renderGlowLine(gpu::Batch& batch, const glm::vec3& p1, const glm::vec3& p2,
const glm::vec4& color, float glowIntensity, float glowWidth, int id) { const glm::vec4& color, float glowIntensity, float glowWidth, int id) {
// Disable glow lines on OSX
#ifndef Q_OS_WIN
glowIntensity = 0.0f;
#endif
if (glowIntensity <= 0) { if (glowIntensity <= 0) {
renderLine(batch, p1, p2, color, id); renderLine(batch, p1, p2, color, id);
return; return;