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
22#include <glm/gtx/quaternion.hpp>22#include <glm/gtx/quaternion.hpp>
23#include <glm/gtx/vector_angle.hpp>23#include <glm/gtx/vector_angle.hpp>
24 24
25// include this before QGLWidget, which includes an earlier version of OpenGL
26#include "InterfaceConfig.h"
27
25#include <QActionGroup>28#include <QActionGroup>
26#include <QBoxLayout>29#include <QBoxLayout>
27#include <QColorDialog>30#include <QColorDialog>
@@ -59,7 +62,6 @@ · 31 unmodified lines
59#include <VoxelSceneStats.h>62#include <VoxelSceneStats.h>
60 63
61#include "Application.h"64#include "Application.h"
62#include "InterfaceConfig.h"
63#include "LogDisplay.h"65#include "LogDisplay.h"
64#include "LeapManager.h"66#include "LeapManager.h"
65#include "OculusManager.h"67#include "OculusManager.h"
@@ -92,6 +94,10 @@ const int STARTUP_JITTER_SAMPLES = PACKET_LENGTH_SAMPLES_PER_CHANNEL / 2; · 26 unmodified lines
92 94
93// customized canvas that simply forwards requests/events to the singleton application95// customized canvas that simply forwards requests/events to the singleton application
94class GLCanvas : public QGLWidget {96class GLCanvas : public QGLWidget {
97public:
98
99 GLCanvas();
100
95protected:101protected:
96 102
97 virtual void initializeGL();103 virtual void initializeGL();
@@ -110,6 +116,9 @@ protected: · 12 unmodified lines
110 virtual void wheelEvent(QWheelEvent* event);116 virtual void wheelEvent(QWheelEvent* event);
111};117};
112 118
119GLCanvas::GLCanvas() : QGLWidget(QGLFormat(QGL::AlphaChannel)) {
120}
121
113void GLCanvas::initializeGL() {122void GLCanvas::initializeGL() {
114 Application::getInstance()->initializeGL();123 Application::getInstance()->initializeGL();
115 setAttribute(Qt::WA_AcceptTouchEvents);124 setAttribute(Qt::WA_AcceptTouchEvents);
@@ -2199,8 +2208,8 @@ void Application::runTests() { · 2083 unmodified lines
2199 2208
2200void Application::initDisplay() {2209void Application::initDisplay() {
2201 glEnable(GL_BLEND);2210 glEnable(GL_BLEND);
2202 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);2211 glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_CONSTANT_ALPHA, GL_ONE);
2203 glShadeModel (GL_SMOOTH);2212 glShadeModel(GL_SMOOTH);
2204 glEnable(GL_LIGHTING);2213 glEnable(GL_LIGHTING);
2205 glEnable(GL_LIGHT0);2214 glEnable(GL_LIGHT0);
2206 glEnable(GL_DEPTH_TEST);2215 glEnable(GL_DEPTH_TEST);
@@ -3001,6 +3010,9 @@ void Application::displaySide(Camera& whichCamera) { · 794 unmodified lines
3001 // Setup 3D lights (after the camera transform, so that they are positioned in world space)3010 // Setup 3D lights (after the camera transform, so that they are positioned in world space)
3002 setupWorldLight(whichCamera);3011 setupWorldLight(whichCamera);
3003 3012
3013 // prepare the glow effect
3014 _glowEffect.prepare();
3015
3004 if (_renderStarsOn->isChecked()) {3016 if (_renderStarsOn->isChecked()) {
3005 if (!_stars.getFileLoaded()) {3017 if (!_stars.getFileLoaded()) {
3006 _stars.readInput(STAR_FILE, STAR_CACHE_FILE, 0);3018 _stars.readInput(STAR_FILE, STAR_CACHE_FILE, 0);
@@ -3033,9 +3045,6 @@ void Application::displaySide(Camera& whichCamera) { · 26 unmodified lines
3033 glEnable(GL_LIGHTING);3045 glEnable(GL_LIGHTING);
3034 glEnable(GL_DEPTH_TEST);3046 glEnable(GL_DEPTH_TEST);
3035 3047
3036 // prepare the glow effect
3037 _glowEffect.prepare();
3038
3039 // Enable to show line from me to the voxel I am touching3048 // Enable to show line from me to the voxel I am touching
3040 //renderLineToTouchedVoxel();3049 //renderLineToTouchedVoxel();
3041 //renderThrustAtVoxel(_voxelThrust);3050 //renderThrustAtVoxel(_voxelThrust);
@@ -3131,13 +3140,9 @@ void Application::displaySide(Camera& whichCamera) { · 89 unmodified lines
3131 if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {3140 if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
3132 _myAvatar.getHead().setLookAtPosition(_myCamera.getPosition());3141 _myAvatar.getHead().setLookAtPosition(_myCamera.getPosition());
3133 }3142 }
3143 _glowEffect.begin();
3134 _myAvatar.render(_lookingInMirror->isChecked(), _renderAvatarBalls->isChecked());3144 _myAvatar.render(_lookingInMirror->isChecked(), _renderAvatarBalls->isChecked());
3135 3145 _glowEffect.end();
3136 _glowEffect.bind();
3137 _myAvatar.render(_lookingInMirror->isChecked(), _renderAvatarBalls->isChecked());
3138 _glowEffect.release();
3139
3140 _myAvatar.render(_lookingInMirror->isChecked(), _renderAvatarBalls->isChecked());
3141 3146
3142 _myAvatar.setDisplayingLookatVectors(_renderLookatOn->isChecked());3147 _myAvatar.setDisplayingLookatVectors(_renderLookatOn->isChecked());
3143 3148

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