Commit 4fbd88b2 authored by Jan Möbius's avatar Jan Möbius

Removed depth renderer from core

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@12290 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 43f31675
......@@ -157,9 +157,6 @@ void Core::applyOptions(){
// Picking Debugger
PluginFunctions::viewerProperties(i).renderPicking( OpenFlipperSettings().value("Core/Debug/Picking/RenderPicking",false).toBool() , target );
// Depth Debugger
PluginFunctions::viewerProperties(i).renderDepthImage( OpenFlipperSettings().value("Core/Debug/Picking/RenderDepthImage",false).toBool() );
}
//hideToolbox
......
......@@ -66,7 +66,6 @@ namespace Viewer {
CCWFront_(true),
backgroundColor_(0.0f,0.0f,0.0f,1.0f),
renderPicking_(false),
renderDepthImage_(false),
pickRendererMode_(ACG::SceneGraph::PICK_ANYTHING),
locked_(0),
backFaceCulling_(false),
......
......@@ -297,23 +297,11 @@ namespace Viewer {
pickRendererMode_ = _mode ; renderPicking_ = _renderPicking; emit updated();
}
/** Render depth image or color image
*/
bool renderDepthImage(){ return renderDepthImage_; };
/** Render depth image or color image
*/
void renderDepthImage(bool _depth){ renderDepthImage_ = _depth; emit updated(); };
private:
/** This variable controls if the scene is rendered in normal or in picking mode
*/
bool renderPicking_;
/** This variable controls if the depth image is rendered instead of the color image
*/
bool renderDepthImage_;
/** If rendering is in picking mode, this variable controls which picking targets
* will be rendered. ( see renderPicking_ , renderPicking(bool _renderPicking, PickRendererMode _mode) ,
* and ACG::SceneGraph::PickTarget
......
......@@ -759,82 +759,6 @@ void glViewer::drawScene_mono()
glEnable(GL_BLEND);
}
// Render depth?
// If so, we take our depth buffer and draw it as our scene image
if ( properties_.renderDepthImage() ) {
// ======================================================================================================
// Adjust buffer to correct size
// ======================================================================================================
updateDepthStencilTextureBuffer();
// ======================================================================================================
// Get current viewport size
// ======================================================================================================
int vp_l, vp_b, vp_w, vp_h;
glstate_->get_viewport (vp_l, vp_b, vp_w, vp_h);
// ======================================================================================================
// Bind depth Stencil texture
// ======================================================================================================
pDepthStencilTexture_.enable();
pDepthStencilTexture_.bind();
// ======================================================================================================
// Copy depth component of rendered image to texture
// ======================================================================================================
glCopyTexImage2D( GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8_EXT, 0, 0, vp_w , vp_h, 0);
// ======================================================================================================
// Render plain textured
// ======================================================================================================
glDisable(GL_LIGHTING);
glDisable(GL_COLOR_MATERIAL);
glDisable(GL_DEPTH_TEST);
// ======================================================================================================
// Setup orthogonal projection
// ======================================================================================================
glstate_->push_projection_matrix();
glstate_->push_modelview_matrix();
glstate_->reset_projection();
glstate_->reset_modelview();
glstate_->ortho(0, vp_w, 0, vp_h, 0, 1);
// ======================================================================================================
// Clear rendering buffer
// ======================================================================================================
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// ======================================================================================================
// Render a simple quad (rest is done by the texture)
// ======================================================================================================
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f);
glVertex2i(0, 0);
glTexCoord2f(1.0f, 0.0f);
glVertex2i(vp_w, 0);
glTexCoord2f(1.0f, 1.0f);
glVertex2i(vp_w, vp_h);
glTexCoord2f(0.0f, 1.0f);
glVertex2i(0, vp_h);
glEnd();
// Disable depth stencil buffer
pDepthStencilTexture_.disable();
// ======================================================================================================
// Reset projection and modelview
// ======================================================================================================
glstate_->pop_projection_matrix();
glstate_->pop_modelview_matrix();
}
}
if (cursorPainter_ && cursorPainter_->enabled () && cursorPositionValid_)
......
......@@ -679,13 +679,13 @@ private:
/// Updates the Color Texture Buffer to the current size and initializes it if necessary
void updateColorTextureBuffer();
/// Updates the DepthStencil Texture Buffer to the current size and initializes it if necessary
void updateDepthStencilTextureBuffer();
/// color texture buffer
ACG::Texture2D pColorTexture_;
/// depthStencil texture buffer
ACG::Texture2D pDepthStencilTexture_;
......@@ -694,10 +694,10 @@ private:
/// Current height of the color texture buffer
int colorTextureBufferHeight_;
/// Current width of the depthStencil texture buffer
int depthStencilTextureBufferWidth_;
/// Current height of the depthStencil texture buffer
int depthStencilTextureBufferHeight_;
......
......@@ -448,23 +448,23 @@ glViewer::updateColorTextureBuffer() {
//-----------------------------------------------------------------------------
void
void
glViewer::updateDepthStencilTextureBuffer() {
if ( !ACG::checkExtensionSupported("GL_ARB_texture_rectangle") ) {
std::cerr << "GL_ARB_texture_rectangle not supported! " << std::endl;
return;
}
int vp_l, vp_b, vp_w, vp_h;
glstate_->get_viewport (vp_l, vp_b, vp_w, vp_h);
// Does depth stencil texture exist?
if (!pDepthStencilTexture_.is_valid()) {
// ======================================================================================================
// creating an 24-bit depth + 8-bit stencil texture
// ======================================================================================================
pDepthStencilTexture_.enable();
pDepthStencilTexture_.bind();
GLenum texTarget = GL_TEXTURE_2D;
......@@ -473,33 +473,33 @@ glViewer::updateDepthStencilTextureBuffer() {
GLenum texType = GL_UNSIGNED_INT_24_8_EXT;
GLenum texFilterMode = GL_NEAREST;
glTexImage2D(texTarget, 0, texInternalFormat, vp_w, vp_h, 0, texFormat, texType, NULL);
glTexParameterf(texTarget, GL_TEXTURE_MIN_FILTER, texFilterMode);
glTexParameterf(texTarget, GL_TEXTURE_MAG_FILTER, texFilterMode);
glTexParameterf(texTarget, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(texTarget, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(texTarget, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL);
if(!pDepthStencilTexture_.is_valid()) {
philipsStereoInitialized_ = false;
}
}
// Resize target texture
if (glstate_->viewport_width() != depthStencilTextureBufferWidth_ || glstate_->viewport_height() != depthStencilTextureBufferHeight_) {
// Depth stencil texture
pDepthStencilTexture_.bind();
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGB, glstate_->viewport_width(), glstate_->viewport_height(), 0,
GL_RGB, GL_UNSIGNED_BYTE, 0);
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
depthStencilTextureBufferWidth_ = glstate_->viewport_width();
depthStencilTextureBufferHeight_ = glstate_->viewport_height();
}
}
//-----------------------------------------------------------------------------
......@@ -538,7 +538,7 @@ glViewer::updateScenePhilipsStereo()
}
updateColorTextureBuffer();
updateDepthStencilTextureBuffer();
philipsStereoInitialized_ = true;
......
......@@ -373,7 +373,6 @@ void OptionsWidget::showEvent ( QShowEvent * /*event*/ ) {
slotDebugging->setChecked(OpenFlipper::Options::doSlotDebugging());
renderPicking->setChecked( OpenFlipperSettings().value("Core/Debug/Picking/RenderPicking",false).toBool() );
renderDepth->setChecked( OpenFlipperSettings().value("Core/Debug/Picking/RenderDepthImage",false).toBool() );
int itemIndex = pickingRenderMode->findText( OpenFlipperSettings().value("Core/Debug/Picking/RenderPickingMode",QString("PICK_ANYTHING")).toString() );
if ( itemIndex != -1 )
pickingRenderMode->setCurrentIndex(itemIndex);
......@@ -707,8 +706,6 @@ void OptionsWidget::slotApply() {
OpenFlipperSettings().setValue("Core/Debug/Picking/RenderPicking",renderPicking->isChecked() );
OpenFlipperSettings().setValue("Core/Debug/Picking/RenderPickingMode",pickingRenderMode->currentText() );
OpenFlipperSettings().setValue("Core/Debug/Picking/RenderDepthImage",renderDepth->isChecked() );
//viewer defaults
for (int i=0; i < PluginFunctions::viewers(); i++){
......
......@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>646</width>
<width>656</width>
<height>576</height>
</rect>
</property>
......@@ -36,8 +36,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>617</width>
<height>836</height>
<width>666</width>
<height>866</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
......@@ -50,7 +50,7 @@
<string/>
</property>
<property name="currentIndex">
<number>2</number>
<number>6</number>
</property>
<property name="usesScrollButtons">
<bool>true</bool>
......@@ -1871,22 +1871,6 @@ p, li { white-space: pre-wrap; }
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="renderDepth">
<property name="toolTip">
<string>Renders the depth buffer as a grayscale image</string>
</property>
<property name="statusTip">
<string>Renders the depth buffer as a grayscale image</string>
</property>
<property name="whatsThis">
<string>Renders the depth buffer as a grayscale image</string>
</property>
<property name="text">
<string>Render Depth Image</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment