merging in all Will's changes

This commit is contained in:
Will 2013-11-29 02:12:34 +01:00
parent be3d4d300c
commit c6530c2783
9 changed files with 64 additions and 242 deletions

View File

@ -430,8 +430,6 @@ Game::~Game() {
world.end(); //must die before selection because of referencers world.end(); //must die before selection because of referencers
BaseColorPickEntity::resetUniqueColors();
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] aiInterfaces.size() = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,aiInterfaces.size()); if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] aiInterfaces.size() = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,aiInterfaces.size());
delete videoPlayer; delete videoPlayer;
@ -1003,8 +1001,6 @@ void Game::load(int loadTypes) {
SoundRenderer &soundRenderer= SoundRenderer::getInstance(); SoundRenderer &soundRenderer= SoundRenderer::getInstance();
soundRenderer.stopAllSounds(fadeMusicMilliseconds); soundRenderer.stopAllSounds(fadeMusicMilliseconds);
BaseColorPickEntity::resetUniqueColors();
Config &config = Config::getInstance(); Config &config = Config::getInstance();
Logger &logger= Logger::getInstance(); Logger &logger= Logger::getInstance();
@ -2612,7 +2608,6 @@ void Game::update() {
aiInterfaces.clear(); aiInterfaces.clear();
gui.end(); //selection must be cleared before deleting units gui.end(); //selection must be cleared before deleting units
world.end(); //must die before selection because of referencers world.end(); //must die before selection because of referencers
BaseColorPickEntity::resetUniqueColors();
// MUST DO THIS LAST!!!! Because objects above have pointers to things like // MUST DO THIS LAST!!!! Because objects above have pointers to things like
// unit particles and fade them out etc and this end method deletes the original // unit particles and fade them out etc and this end method deletes the original
// object pointers. // object pointers.
@ -2637,7 +2632,6 @@ void Game::update() {
soundRenderer.stopAllSounds(fadeMusicMilliseconds); soundRenderer.stopAllSounds(fadeMusicMilliseconds);
world.endScenario(); world.endScenario();
BaseColorPickEntity::resetUniqueColors();
Renderer &renderer= Renderer::getInstance(); Renderer &renderer= Renderer::getInstance();
renderer.endScenario(); renderer.endScenario();

View File

@ -54,6 +54,7 @@
#include "string_utils.h" #include "string_utils.h"
#include "auto_test.h" #include "auto_test.h"
#include "lua_script.h" #include "lua_script.h"
#include "interpolation.h"
// To handle signal catching // To handle signal catching
#if defined(__GNUC__) && !defined(__MINGW32__) && !defined(__FreeBSD__) && !defined(BSD) #if defined(__GNUC__) && !defined(__MINGW32__) && !defined(__FreeBSD__) && !defined(BSD)
@ -4636,8 +4637,14 @@ int glestMain(int argc, char** argv) {
// Explicitly disable VBO's // Explicitly disable VBO's
if(config.getBool("DisableVBO","false") == true || hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_DISABLE_VBO]) == true) { if(config.getBool("DisableVBO","false") == true || hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_DISABLE_VBO]) == true) {
setVBOSupported(false); setVBOSupported(false);
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("**WARNING** Disabling VBO's\n"); if(SystemFlags::VERBOSE_MODE_ENABLED) printf("**INFO** Disabling VBOs\n");
} }
if(config.getBool("DisableVertexInterpolation","false") || hasCommandArgument(argc, argv, GAME_ARGS[GAME_ARG_DISABLE_VERTEX_INTERPOLATION])) {
InterpolationData::setEnableInterpolation(false);
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("**INFO** Disabling Interpolation\n");
}
if(config.getBool("EnableVSynch","false") == true) { if(config.getBool("EnableVSynch","false") == true) {
::Shared::Platform::Window::setTryVSynch(true); ::Shared::Platform::Window::setTryVSynch(true);

View File

@ -79,7 +79,6 @@ Object::~Object() {
delete resource; delete resource;
resource = NULL; resource = NULL;
recycleUniqueColor();
} }
void Object::end() { void Object::end() {

View File

@ -584,8 +584,6 @@ Unit::~Unit() {
delete mutexCommands; delete mutexCommands;
mutexCommands=NULL; mutexCommands=NULL;
recycleUniqueColor();
#ifdef LEAK_CHECK_UNITS #ifdef LEAK_CHECK_UNITS
Unit::mapMemoryList.erase(this); Unit::mapMemoryList.erase(this);
#endif #endif

View File

@ -30,21 +30,20 @@ private:
Vec3f *vertices; Vec3f *vertices;
Vec3f *normals; Vec3f *normals;
//std::map<std::string, Vec3f *> cacheVertices; int raw_frame_ofs;
//std::map<std::string, Vec3f *> cacheNormals;
std::map<float, std::map<bool, Vec3f *> > cacheVertices; static bool enableInterpolation;
std::map<float, std::map<bool, Vec3f *> > cacheNormals;
static bool enableCache; void update(const Vec3f* src, Vec3f* &dest, float t, bool cycle);
public: public:
InterpolationData(const Mesh *mesh); InterpolationData(const Mesh *mesh);
~InterpolationData(); ~InterpolationData();
static void setEnableCache(bool enabled) { enableCache = enabled; } static void setEnableInterpolation(bool enabled) { enableInterpolation = enabled; }
const Vec3f *getVertices() const {return vertices==NULL? mesh->getVertices(): vertices;} const Vec3f *getVertices() const {return !vertices || !enableInterpolation? mesh->getVertices()+raw_frame_ofs: vertices;}
const Vec3f *getNormals() const {return normals==NULL? mesh->getNormals(): normals;} const Vec3f *getNormals() const {return !normals || !enableInterpolation? mesh->getNormals()+raw_frame_ofs: normals;}
void update(float t, bool cycle); void update(float t, bool cycle);
void updateVertices(float t, bool cycle); void updateVertices(float t, bool cycle);

View File

@ -275,18 +275,11 @@ public:
string getColorDescription() const; string getColorDescription() const;
virtual string getUniquePickName() const = 0; virtual string getUniquePickName() const = 0;
static void resetUniqueColors();
protected:
void recycleUniqueColor();
private: private:
unsigned char uniqueColorID[COLOR_COMPONENTS]; unsigned char uniqueColorID[COLOR_COMPONENTS];
static unsigned char nextColorID[COLOR_COMPONENTS]; static int nextColorID;
static vector<vector<unsigned char> > nextColorIDReuseList; static const int k, p;
static map<string,bool> usedColorIDList;
static Mutex mutexNextColorID; static Mutex mutexNextColorID;
static auto_ptr<PixelBufferWrapper> pbo; static auto_ptr<PixelBufferWrapper> pbo;

View File

@ -73,6 +73,7 @@ const char *GAME_ARGS[] = {
"--disable-backtrace", "--disable-backtrace",
"--disable-sigsegv-handler", "--disable-sigsegv-handler",
"--disable-vbo", "--disable-vbo",
"--disable-vertex-interpolation",
"--disable-sound", "--disable-sound",
"--enable-legacyfonts", "--enable-legacyfonts",
"--force-ftglfonts", "--force-ftglfonts",
@ -152,6 +153,7 @@ enum GAME_ARG_TYPE {
GAME_ARG_DISABLE_BACKTRACE, GAME_ARG_DISABLE_BACKTRACE,
GAME_ARG_DISABLE_SIGSEGV_HANDLER, GAME_ARG_DISABLE_SIGSEGV_HANDLER,
GAME_ARG_DISABLE_VBO, GAME_ARG_DISABLE_VBO,
GAME_ARG_DISABLE_VERTEX_INTERPOLATION,
GAME_ARG_DISABLE_SOUND, GAME_ARG_DISABLE_SOUND,
GAME_ARG_ENABLE_LEGACYFONTS, GAME_ARG_ENABLE_LEGACYFONTS,
GAME_ARG_FORCE_FTGLFONTS, GAME_ARG_FORCE_FTGLFONTS,
@ -426,6 +428,7 @@ void printParameterHelp(const char *argv0, bool foundInvalidArgs) {
printf("\n%s\t\t\tdisables trying to use Vertex Buffer Objects.",GAME_ARGS[GAME_ARG_DISABLE_VBO]); printf("\n%s\t\t\tdisables trying to use Vertex Buffer Objects.",GAME_ARGS[GAME_ARG_DISABLE_VBO]);
printf("\n%s\t\t\tdisables interpolating animations to make them smoother.",GAME_ARGS[GAME_ARG_DISABLE_VERTEX_INTERPOLATION]);
printf("\n%s\t\t\tdisables the sound system.",GAME_ARGS[GAME_ARG_DISABLE_SOUND]); printf("\n%s\t\t\tdisables the sound system.",GAME_ARGS[GAME_ARG_DISABLE_SOUND]);
printf("\n%s\t\tenables using the legacy font system.",GAME_ARGS[GAME_ARG_ENABLE_LEGACYFONTS]); printf("\n%s\t\tenables using the legacy font system.",GAME_ARGS[GAME_ARG_ENABLE_LEGACYFONTS]);

View File

@ -30,7 +30,7 @@ namespace Shared{ namespace Graphics{
// class InterpolationData // class InterpolationData
// ===================================================== // =====================================================
bool InterpolationData::enableCache = false; bool InterpolationData::enableInterpolation = true;
InterpolationData::InterpolationData(const Mesh *mesh) { InterpolationData::InterpolationData(const Mesh *mesh) {
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
@ -40,15 +40,9 @@ InterpolationData::InterpolationData(const Mesh *mesh) {
vertices= NULL; vertices= NULL;
normals= NULL; normals= NULL;
raw_frame_ofs = 0;
this->mesh= mesh; this->mesh= mesh;
if(mesh->getFrameCount()>1) {
vertices= new Vec3f[mesh->getVertexCount()];
normals= new Vec3f[mesh->getVertexCount()];
}
cacheVertices.clear();
cacheNormals.clear();
} }
InterpolationData::~InterpolationData(){ InterpolationData::~InterpolationData(){
@ -56,24 +50,6 @@ InterpolationData::~InterpolationData(){
vertices=NULL; vertices=NULL;
delete [] normals; delete [] normals;
normals=NULL; normals=NULL;
for(std::map<float, std::map<bool, Vec3f *> >::iterator iterVert = cacheVertices.begin();
iterVert != cacheVertices.end(); ++iterVert) {
for(std::map<bool, Vec3f *>::iterator iterVert2 = iterVert->second.begin();
iterVert2 != iterVert->second.end(); ++iterVert2) {
delete [] iterVert2->second;
}
}
cacheVertices.clear();
for(std::map<float, std::map<bool, Vec3f *> >::iterator iterVert = cacheNormals.begin();
iterVert != cacheNormals.end(); ++iterVert) {
for(std::map<bool, Vec3f *>::iterator iterVert2 = iterVert->second.begin();
iterVert2 != iterVert->second.end(); ++iterVert2) {
delete [] iterVert2->second;
}
}
cacheNormals.clear();
} }
void InterpolationData::update(float t, bool cycle){ void InterpolationData::update(float t, bool cycle){
@ -82,6 +58,15 @@ void InterpolationData::update(float t, bool cycle){
} }
void InterpolationData::updateVertices(float t, bool cycle) { void InterpolationData::updateVertices(float t, bool cycle) {
update(mesh->getVertices(), vertices, t, cycle);
}
void InterpolationData::updateNormals(float t, bool cycle) {
update(mesh->getNormals(), normals, t, cycle);
}
void InterpolationData::update(const Vec3f* src, Vec3f* &dest, float t, bool cycle) {
if(t <0.0f || t>1.0f) { if(t <0.0f || t>1.0f) {
printf("ERROR t = [%f] for cycle [%d] f [%d] v [%d]\n",t,cycle,mesh->getFrameCount(),mesh->getVertexCount()); printf("ERROR t = [%f] for cycle [%d] f [%d] v [%d]\n",t,cycle,mesh->getFrameCount(),mesh->getVertexCount());
} }
@ -96,20 +81,6 @@ void InterpolationData::updateVertices(float t, bool cycle) {
uint32 vertexCount= mesh->getVertexCount(); uint32 vertexCount= mesh->getVertexCount();
if(frameCount > 1) { if(frameCount > 1) {
if(enableCache == true) {
std::map<float, std::map<bool, Vec3f *> >::iterator iterFind = cacheVertices.find(t);
if(iterFind != cacheVertices.end()) {
std::map<bool, Vec3f *>::iterator iterFind2 = iterFind->second.find(cycle);
if(iterFind2 != iterFind->second.end()) {
memcpy(vertices,iterFind2->second,sizeof(Vec3f) * vertexCount);
return;
}
}
cacheVertices[t][cycle] = new Vec3f[vertexCount];
}
const Vec3f *meshVertices= mesh->getVertices();
//misc vars //misc vars
uint32 prevFrame; uint32 prevFrame;
uint32 nextFrame; uint32 nextFrame;
@ -133,74 +104,16 @@ void InterpolationData::updateVertices(float t, bool cycle) {
//assertions //assertions
assert(prevFrame<frameCount); assert(prevFrame<frameCount);
assert(nextFrame<frameCount); assert(nextFrame<frameCount);
//interpolate vertices if(enableInterpolation) {
for(uint32 j=0; j<vertexCount; ++j){ if(!dest) { // not previously allocated
vertices[j]= meshVertices[prevFrameBase+j].lerp(localT, meshVertices[nextFrameBase+j]); dest = new Vec3f[vertexCount];
if(enableCache == true) {
cacheVertices[t][cycle][j] = vertices[j];
} }
} for(uint32 j=0; j<vertexCount; ++j){
} dest[j]= src[prevFrameBase+j].lerp(localT, src[nextFrameBase+j]);
}
void InterpolationData::updateNormals(float t, bool cycle){
if(t < 0.0f || t > 1.0f) {
throw megaglest_runtime_error("t < 0.0f || t > 1.0f t = [" + floatToStr(t,16) + "]");
assert(t>=0.0f && t<=1.0f);
}
uint32 frameCount= mesh->getFrameCount();
uint32 vertexCount= mesh->getVertexCount();
if(frameCount > 1) {
if(enableCache == true) {
std::map<float, std::map<bool, Vec3f *> >::iterator iterFind = cacheNormals.find(t);
if(iterFind != cacheNormals.end()) {
std::map<bool, Vec3f *>::iterator iterFind2 = iterFind->second.find(cycle);
if(iterFind2 != iterFind->second.end()) {
memcpy(normals,iterFind2->second,sizeof(Vec3f) * vertexCount);
return;
}
}
cacheNormals[t][cycle] = new Vec3f[vertexCount];
}
const Vec3f *meshNormals= mesh->getNormals();
//misc vars
uint32 prevFrame;
uint32 nextFrame;
float localT;
if(cycle == true) {
prevFrame= min<uint32>(static_cast<uint32>(t*frameCount), frameCount-1);
nextFrame= (prevFrame+1) % frameCount;
localT= t*frameCount - prevFrame;
}
else {
prevFrame= min<uint32> (static_cast<uint32> (t * (frameCount-1)), frameCount - 2);
nextFrame= min(prevFrame + 1, frameCount - 1);
localT= t * (frameCount-1) - prevFrame;
//printf(" prevFrame=%d nextFrame=%d localT=%f\n",prevFrame,nextFrame,localT);
}
uint32 prevFrameBase= prevFrame*vertexCount;
uint32 nextFrameBase= nextFrame*vertexCount;
//assertions
assert(prevFrame<frameCount);
assert(nextFrame<frameCount);
//interpolate vertices
for(uint32 j=0; j<vertexCount; ++j){
normals[j]= meshNormals[prevFrameBase+j].lerp(localT, meshNormals[nextFrameBase+j]);
if(enableCache == true) {
cacheNormals[t][cycle][j] = normals[j];
} }
} else {
raw_frame_ofs = prevFrameBase;
} }
} }
} }

View File

@ -338,7 +338,7 @@ void Mesh::BuildVBOs() {
glGenBuffersARB( 1,(GLuint*) &m_nVBOVertices ); // Get A Valid Name glGenBuffersARB( 1,(GLuint*) &m_nVBOVertices ); // Get A Valid Name
glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nVBOVertices ); // Bind The Buffer glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nVBOVertices ); // Bind The Buffer
// Load The Data // Load The Data
glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec3f)*frameCount*vertexCount, getInterpolationData()->getVertices(), GL_STATIC_DRAW_ARB ); glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec3f)*frameCount*vertexCount, vertices, GL_STATIC_DRAW_ARB );
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
// Generate And Bind The Texture Coordinate Buffer // Generate And Bind The Texture Coordinate Buffer
@ -352,7 +352,7 @@ void Mesh::BuildVBOs() {
glGenBuffersARB( 1, (GLuint*)&m_nVBONormals ); // Get A Valid Name glGenBuffersARB( 1, (GLuint*)&m_nVBONormals ); // Get A Valid Name
glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nVBONormals ); // Bind The Buffer glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nVBONormals ); // Bind The Buffer
// Load The Data // Load The Data
glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec3f)*frameCount*vertexCount, getInterpolationData()->getNormals(), GL_STATIC_DRAW_ARB ); glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec3f)*frameCount*vertexCount, normals, GL_STATIC_DRAW_ARB );
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
// Generate And Bind The Index Buffer // Generate And Bind The Index Buffer
@ -1592,7 +1592,6 @@ void Model::autoJoinMeshFrames() {
haveJoinedMeshes = true; haveJoinedMeshes = true;
} }
} }
if(haveJoinedMeshes == true) { if(haveJoinedMeshes == true) {
//printf("*** Detected Joined meshes for model [%s]\n",fileName.c_str()); //printf("*** Detected Joined meshes for model [%s]\n",fileName.c_str());
@ -1827,117 +1826,33 @@ PixelBufferWrapper::~PixelBufferWrapper() {
cleanup(); cleanup();
} }
//unsigned char BaseColorPickEntity::nextColorID[COLOR_COMPONENTS] = {1, 1, 1, 1}; const int BaseColorPickEntity::p = 64007;
unsigned char BaseColorPickEntity::nextColorID[COLOR_COMPONENTS] = { 1, 1, 1 }; const int BaseColorPickEntity::k = 43067;
vector<vector<unsigned char> > BaseColorPickEntity::nextColorIDReuseList; int BaseColorPickEntity::nextColorID = BaseColorPickEntity::k;
map<string,bool> BaseColorPickEntity::usedColorIDList;
Mutex BaseColorPickEntity::mutexNextColorID; Mutex BaseColorPickEntity::mutexNextColorID;
auto_ptr<PixelBufferWrapper> BaseColorPickEntity::pbo; auto_ptr<PixelBufferWrapper> BaseColorPickEntity::pbo;
void BaseColorPickEntity::recycleUniqueColor() {
MutexSafeWrapper safeMutex(&mutexNextColorID);
vector<unsigned char> reUseColor;
reUseColor.push_back(uniqueColorID[0]);
reUseColor.push_back(uniqueColorID[1]);
reUseColor.push_back(uniqueColorID[2]);
nextColorIDReuseList.push_back(reUseColor);
if(usedColorIDList.size() > 0) {
string color_key = getColorDescription();
if(usedColorIDList.find(color_key) != usedColorIDList.end()) {
usedColorIDList.erase(color_key);
}
else {
printf("Line ref: %d *WARNING* color [%s] used count: %d NOT FOUND in history list!\n",__LINE__,color_key.c_str(),(int)usedColorIDList.size());
}
}
}
void BaseColorPickEntity::resetUniqueColors() {
MutexSafeWrapper safeMutex(&mutexNextColorID);
BaseColorPickEntity::nextColorID[0] = 1;
BaseColorPickEntity::nextColorID[1] = 1;
BaseColorPickEntity::nextColorID[2] = 1;
nextColorIDReuseList.clear();
usedColorIDList.clear();
}
BaseColorPickEntity::BaseColorPickEntity() { BaseColorPickEntity::BaseColorPickEntity() {
MutexSafeWrapper safeMutex(&mutexNextColorID);
assign_color(); assign_color();
} }
void BaseColorPickEntity::assign_color() { void BaseColorPickEntity::assign_color() {
if(nextColorIDReuseList.empty() == false) {
uniqueColorID[0] = nextColorIDReuseList.back()[0]; MutexSafeWrapper safeMutex(&mutexNextColorID);
uniqueColorID[1] = nextColorIDReuseList.back()[1];
uniqueColorID[2] = nextColorIDReuseList.back()[2]; nextColorID = (nextColorID * k) % p;
nextColorIDReuseList.pop_back(); // nextColorID is a 16-bit (hi)colour (for players with 16-bit display depths)
// we expand it to true-color for use with OpenGL
string color_key = getColorDescription();
if(usedColorIDList.find(color_key) == usedColorIDList.end()) { const int
usedColorIDList[color_key] = true; r = (nextColorID >> 11) & ((1<<6)-1),
} b = (nextColorID >> 5) & ((1<<7)-1),
else { g = nextColorID & ((1<<6)-1);
printf("Line ref: %d *WARNING* color [%s] ALREADY FOUND in history list!\n",__LINE__,color_key.c_str());
assign_color(); uniqueColorID[0] = r << 3;
} uniqueColorID[1] = g << 2;
} uniqueColorID[2] = b << 3;
else {
uniqueColorID[0] = nextColorID[0];
uniqueColorID[1] = nextColorID[1];
uniqueColorID[2] = nextColorID[2];
//uniqueColorID[3] = nextColorID[3];
const int colorSpacing = 8;
if((int)(nextColorID[0] + colorSpacing) <= 255) {
nextColorID[0] += colorSpacing;
}
else {
nextColorID[0] = 1;
if((int)(nextColorID[1] + colorSpacing) <= 255) {
nextColorID[1] += colorSpacing;
}
else {
nextColorID[1] = 1;
if((int)(nextColorID[2] + colorSpacing) <= 255) {
nextColorID[2] += colorSpacing;
}
else {
//printf("Color rolled over on 3rd level!\n");
nextColorID[0] = 1;
nextColorID[1] = 1;
nextColorID[2] = 1;
// nextColorID[2] = 1;
// nextColorID[3]+=colorSpacing;
//
// if(nextColorID[3] > 255) {
// nextColorID[0] = 1;
// nextColorID[1] = 1;
// nextColorID[2] = 1;
// nextColorID[3] = 1;
// }
}
}
}
string color_key = getColorDescription();
if(usedColorIDList.find(color_key) == usedColorIDList.end()) {
usedColorIDList[color_key] = true;
}
else {
printf("Line ref: %d *WARNING* color [%s] ALREADY FOUND in history list!\n",__LINE__,color_key.c_str());
assign_color();
}
}
} }
void BaseColorPickEntity::init(int bufferSize) { void BaseColorPickEntity::init(int bufferSize) {
@ -1959,9 +1874,10 @@ void BaseColorPickEntity::beginPicking() {
//glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//reset current background. This is neeeded to get a proper black background! //reset current background. This is neeeded to get a proper black background!
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushAttrib(GL_ENABLE_BIT); glPushAttrib(GL_ENABLE_BIT);
glEnable(GL_DEPTH_TEST);
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
glDisable(GL_FOG); glDisable(GL_FOG);
glDisable(GL_LIGHTING); glDisable(GL_LIGHTING);
@ -1998,7 +1914,7 @@ vector<int> BaseColorPickEntity::getPickedList(int x,int y,int w,int h,
if(rendererModels.empty() == false) { if(rendererModels.empty() == false) {
if(PixelBufferWrapper::getIsPBOEnable() == true) { if(PixelBufferWrapper::getIsPBOEnable() == true) {
Pixmap2D *pixmapScreenShot = BaseColorPickEntity::pbo->getPixelBufferFor(x,y,w,h, COLOR_COMPONENTS); Pixmap2D *pixmapScreenShot = BaseColorPickEntity::pbo->getPixelBufferFor(x,y,w,h, COLOR_COMPONENTS);
//pixmapScreenShot->saveTga("/tmp/toll.tga"); //pixmapScreenShot->saveTga("/tmp/toll.tga"); //### for debugging
cachedPixels.reset(pixmapScreenShot); cachedPixels.reset(pixmapScreenShot);
} }
else { else {