fixed setDepthBufferParams

This commit is contained in:
James Turk 2005-08-17 03:15:23 +00:00
parent 2c2704badf
commit d483237b66
3 changed files with 11 additions and 10 deletions

View File

@ -1,5 +1,5 @@
Changelog for Photon
$Id: CHANGELOG.txt,v 1.9 2005/08/16 06:32:39 cozman Exp $
$Id: CHANGELOG.txt,v 1.10 2005/08/17 03:15:23 cozman Exp $
! : Major Changes (potentially breaking existing code)
+ : New Features
@ -20,7 +20,7 @@ $Id: CHANGELOG.txt,v 1.9 2005/08/16 06:32:39 cozman Exp $
time is calculated. (actual/average currently supported).
+ Addition of fixed time stepping option in Application/State system.
+ Addition of code to allow control of depth testing via
Application::setDepthTestParams
Application::setDepthBufferParams
* Fixed X11 fullscreen mode
* Removed ALUT dependencies by adding custom WAV loading code
* Mouse move events now give relative position.

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: Application.hpp,v 1.20 2005/08/16 06:32:39 cozman Exp $
// $Id: Application.hpp,v 1.21 2005/08/17 03:15:24 cozman Exp $
#ifndef PHOTON_APPLICATION_HPP
#define PHOTON_APPLICATION_HPP
@ -231,13 +231,14 @@ public:
// zFar - Distance from viewer to far clipping plane.
void setPerspectiveProjection(scalar fovy, scalar zNear, scalar zFar);
// Function: setDepthTestMode
// Function: setDepthBufferParams
// Toggle depth testing and clearing of depth buffer.
//
// Parameters:
// enable - if true, testing/clearing depth buffer is enabled, if false
// testing and clearing of depth buffer will be disabled.
void setDepthTestMode(bool enable);
// depth - optional clear depth amount, clamped [0..1], default is 1
void setDepthBufferParams(bool enable, scalar depth=1);
// Group: Input
public:

View File

@ -5,7 +5,7 @@
// James Turk (jpt2433@rit.edu)
//
// Version:
// $Id: Application.cpp,v 1.25 2005/08/16 06:32:39 cozman Exp $
// $Id: Application.cpp,v 1.26 2005/08/17 03:15:23 cozman Exp $
#include "Application.hpp"
@ -186,7 +186,6 @@ void Application::createDisplay(uint width, uint height,
initOpenGL();
setOrthoView();
setDepthTestMode(false);
// register the callbacks (after a window is open)
glfwSetKeyCallback(Application::keyCallback);
@ -307,7 +306,7 @@ void Application::setOrthoProjection(scalar width, scalar height)
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
setDepthTestMode(true);
setDepthBufferParams(true);
}
void Application::setPerspectiveProjection(scalar fovy, scalar zNear,
@ -326,10 +325,11 @@ void Application::setPerspectiveProjection(scalar fovy, scalar zNear,
glLoadIdentity();
}
void Application::setDepthTestMode(bool enable)
void Application::setDepthBufferParams(bool enable, scalar depth)
{
if(enable)
{
glClearDepth(depth);
glDepthFunc(GL_LEQUAL);
glEnable(GL_DEPTH_TEST);
clearFlags_ |= GL_DEPTH_BUFFER_BIT;
@ -592,7 +592,7 @@ void Application::initOpenGL()
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
// depth testing enabled by default
setDepthTestMode(false);
setDepthBufferParams(false);
}
}