History

More efficiency for glow effect.

Andrzej Kapolka committed 13 years ago

Commit a3cee5d1 parent 9189a204 files · +43 −35Browse files

Showing the changes to interface/src/Application.cpp (1 of 4 files). Show all

Unified · Split

interface/src/Application.cpp+17−12
@@ -22,6 +22,9 @@ · 21 unmodified lines
2222 #include <glm/gtx/quaternion.hpp>
2323 #include <glm/gtx/vector_angle.hpp>
2424
25+// include this before QGLWidget, which includes an earlier version of OpenGL
26+#include "InterfaceConfig.h"
27+
2528 #include <QActionGroup>
2629 #include <QBoxLayout>
2730 #include <QColorDialog>
@@ -59,7 +62,6 @@ · 31 unmodified lines
5962 #include <VoxelSceneStats.h>
6063
6164 #include "Application.h"
62−#include "InterfaceConfig.h"
6365 #include "LogDisplay.h"
6466 #include "LeapManager.h"
6567 #include "OculusManager.h"
@@ -92,6 +94,10 @@ const int STARTUP_JITTER_SAMPLES = PACKET_LENGTH_SAMPLES_PER_CHANNEL / 2; · 26 unmodified lines
9294
9395 // customized canvas that simply forwards requests/events to the singleton application
9496 class GLCanvas : public QGLWidget {
97+public:
98+
99+ GLCanvas();
100+
95101 protected:
96102
97103 virtual void initializeGL();
@@ -110,6 +116,9 @@ protected: · 12 unmodified lines
110116 virtual void wheelEvent(QWheelEvent* event);
111117 };
112118
119+GLCanvas::GLCanvas() : QGLWidget(QGLFormat(QGL::AlphaChannel)) {
120+}
121+
113122 void GLCanvas::initializeGL() {
114123 Application::getInstance()->initializeGL();
115124 setAttribute(Qt::WA_AcceptTouchEvents);
@@ -2199,8 +2208,8 @@ void Application::runTests() { · 2083 unmodified lines
21992208
22002209 void Application::initDisplay() {
22012210 glEnable(GL_BLEND);
2202− glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
2203− glShadeModel (GL_SMOOTH);
2211+ glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_CONSTANT_ALPHA, GL_ONE);
2212+ glShadeModel(GL_SMOOTH);
22042213 glEnable(GL_LIGHTING);
22052214 glEnable(GL_LIGHT0);
22062215 glEnable(GL_DEPTH_TEST);
@@ -3001,6 +3010,9 @@ void Application::displaySide(Camera& whichCamera) { · 794 unmodified lines
30013010 // Setup 3D lights (after the camera transform, so that they are positioned in world space)
30023011 setupWorldLight(whichCamera);
30033012
3013+ // prepare the glow effect
3014+ _glowEffect.prepare();
3015+
30043016 if (_renderStarsOn->isChecked()) {
30053017 if (!_stars.getFileLoaded()) {
30063018 _stars.readInput(STAR_FILE, STAR_CACHE_FILE, 0);
@@ -3033,9 +3045,6 @@ void Application::displaySide(Camera& whichCamera) { · 26 unmodified lines
30333045 glEnable(GL_LIGHTING);
30343046 glEnable(GL_DEPTH_TEST);
30353047
3036− // prepare the glow effect
3037− _glowEffect.prepare();
3038−
30393048 // Enable to show line from me to the voxel I am touching
30403049 //renderLineToTouchedVoxel();
30413050 //renderThrustAtVoxel(_voxelThrust);
@@ -3131,13 +3140,9 @@ void Application::displaySide(Camera& whichCamera) { · 89 unmodified lines
31313140 if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
31323141 _myAvatar.getHead().setLookAtPosition(_myCamera.getPosition());
31333142 }
3143+ _glowEffect.begin();
31343144 _myAvatar.render(_lookingInMirror->isChecked(), _renderAvatarBalls->isChecked());
3135−
3136− _glowEffect.bind();
3137− _myAvatar.render(_lookingInMirror->isChecked(), _renderAvatarBalls->isChecked());
3138− _glowEffect.release();
3139−
3140− _myAvatar.render(_lookingInMirror->isChecked(), _renderAvatarBalls->isChecked());
3145+ _glowEffect.end();
31413146
31423147 _myAvatar.setDisplayingLookatVectors(_renderLookatOn->isChecked());
31433148

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t