@Override protected void draw(DrawContext dc) { // Capture the capabilities actually in use. if (this.capabilities == null) { this.capabilities = dc.getGLContext().getGLDrawable().getChosenGLCapabilities(); this.hardwareStereo = this.capabilities.getStereo(); this.inStereo = this.isHardwareStereo() ? true : this.isInStereo(); } // If stereo isn't to be applied, just draw and return. if (!isInStereo()) { super.draw(dc); return; } // Check if pitch is in correct range (50 - 90 degrees) for current stereo implementation to // work correctly (temporary hack) View dcView = dc.getView(); Boolean pitchInRange = (dcView.getPitch().compareTo(Angle.fromDegrees(50)) > 0 && dcView.getPitch().compareTo(Angle.POS90) < 0); if (AVKey.STEREO_MODE_DEVICE.equals(this.stereoMode) && this.isHardwareStereo() && pitchInRange) this.doDrawToStereoDevice(dc); else if (AVKey.STEREO_MODE_RED_BLUE.equals(this.stereoMode) && pitchInRange) this.doDrawStereoRedBlue(dc); else // AVKey.STEREO_MODE_NONE this.doDrawStereoNone(dc); }