diff --git a/README b/README index 7393e37..ae915eb 100644 --- a/README +++ b/README @@ -9,3 +9,7 @@ RTS (my personal codebase) https://github.com/dmayerich/RTS CUDA http://www.nvidia.com/object/cuda_home_new.html If CMake is unable to find these, make sure to specify their locations. + +Known Bugs in Source Version +--------------------------------- +*) Simulation of the spectrum at the shortest wavelength is returning NaN in Linux. diff --git a/SimulateSpectrum.cpp b/SimulateSpectrum.cpp index 90d6861..52a33af 100644 --- a/SimulateSpectrum.cpp +++ b/SimulateSpectrum.cpp @@ -2,7 +2,8 @@ #include #include #include -#include "globals.h" +#include "globals.h" +#include #include //#include "cufft.h" using namespace std; @@ -137,7 +138,7 @@ void Legendre(double* P, double x, int Nl) for(int l = 2; l < Nl; l++) { P[l] = ((2*l - 1)*x*P[l-1] - (l - 1)*P[l-2])/l; - } + } } @@ -190,7 +191,7 @@ void computeCondenserAlpha(double* alpha, int Nl, double cAngleI, double cAngleO } -complex integrateUs(double r, double lambda, complex eta, +complex integrateUs(double r, double lambda, complex eta, double cAngleI, double cAngleO, double oAngleI, double oAngleO, double M = 2*pi) { /*This function integrates the incident field of magnitude M in the far zone @@ -223,7 +224,7 @@ complex integrateUs(double r, double lambda, complex eta, //store the index of refraction; complex IR(eta.real(), eta.imag()); - + //compute the scattering coefficients computeB(B, r, IR, lambda, Nl); @@ -248,8 +249,8 @@ complex integrateUs(double r, double lambda, complex eta, } c = (2*pi)/(2.0 * l + 1.0); Us += c * alpha * beta * B[l] * M; - - + + } free(PcNAo); free(PcNAi); @@ -269,7 +270,7 @@ void pointSpectrum() double dNu = 2.0f; double lambda; - + //compute the angles based on NA double cAngleI = asin(cNAi); double cAngleO = asin(cNAo); @@ -278,7 +279,7 @@ void pointSpectrum() //implement a reflection-mode system if necessary if(opticsMode == ReflectionOpticsType){ - + //set the condenser to match the objective cAngleI = oAngleI; cAngleO = oAngleO; @@ -293,7 +294,7 @@ void pointSpectrum() double I0 = Ui.real() * Ui.real() + Ui.imag() * Ui.imag(); I0 *= scaleI0; - + //double I; SpecPair temp; @@ -316,7 +317,7 @@ void pointSpectrum() Us = integrateUs(radius, lambda, eta, cAngleI, cAngleO, oAngleI, oAngleO, 2*pi); U = Us + Ui; double I = U.real() * U.real() + U.imag() * U.imag(); - + temp.nu = nu; //set the spectrum value based on the current display type @@ -327,8 +328,8 @@ void pointSpectrum() if(dispNormalize) vecLen += temp.A * temp.A; - - SimSpectrum.push_back(temp); + + SimSpectrum.push_back(temp); } vecLen = sqrt(vecLen); @@ -352,8 +353,10 @@ void updateSpectrum(double* I, double I0, int n) //set the spectrum value based on the current display type if(dispSimType == AbsorbanceSpecType) temp.A = -log10(I[i]/I0); - else - temp.A = I[i]; + else + { + temp.A = I[i]; + } SimSpectrum.push_back(temp); } @@ -369,7 +372,7 @@ void computeCassegrainAngles(double& cAngleI, double& cAngleO, double& oAngleI, //implement a reflection-mode system if necessary if(opticsMode == ReflectionOpticsType){ - + //set the condenser to match the objective cAngleI = oAngleI; cAngleO = oAngleO; @@ -410,7 +413,7 @@ void computeBArray(complex* B, int Nl, int nLambda) eta = complex(baseIR, 0.0); //allocate memory for the scattering coefficients - //complex* B = (complex*)malloc(sizeof(complex)*Nl); + //complex* B = (complex*)malloc(sizeof(complex)*Nl); complex IR(eta.real(), eta.imag()); computeB(&B[i * Nl], radius, IR, Lambda[i], Nl); @@ -419,7 +422,7 @@ void computeBArray(complex* B, int Nl, int nLambda) void computeOpticalParameters(double& cAngleI, double& cAngleO, double& oAngleI, double& oAngleO, double& I0, double* alpha, int Nl) { - computeCassegrainAngles(cAngleI, cAngleO, oAngleI, oAngleO); + computeCassegrainAngles(cAngleI, cAngleO, oAngleI, oAngleO); //evaluate the incident field intensity I0 = 0.0; @@ -437,7 +440,7 @@ void gpuDetectorSpectrum(int numSamples) //integrate across the objective aperature and calculate the resulting intensity on a detector PD.StartTimer(SIMULATE_SPECTRUM); //clear the previous spectrum - SimSpectrum.clear(); + SimSpectrum.clear(); //compute Nl (maximum order of the spectrum) int Nl = computeNl(); @@ -448,11 +451,11 @@ void gpuDetectorSpectrum(int numSamples) //allocate space for a list of wavelengths int nLambda = EtaK.size(); - + //allocate space for the 2D array (Nl x nu) of scattering coefficients complex* B = (complex*)malloc(sizeof(complex) * Nl * nLambda); computeBArray(B, Nl, nLambda); - + //allocate temporary space for the spectrum double* I = (double*)malloc(sizeof(double) * EtaK.size()); @@ -500,33 +503,37 @@ double absorbanceDistortion(){ double intensityDistortion(){ - //compute the magnitude of the spectrum + //compute the mean intensity of the spectrum double sumSim = 0.0; for(unsigned int i=0; i* B = (complex*)malloc(sizeof(complex) * Nl * nLambda); computeBArray(B, Nl, nLambda); - + QProgressDialog progress("Computing distortion map...", "Stop", 0, nSteps * nSteps); + progress.setWindowModality(Qt::WindowModal); double D; - double e = 0.001; - for(double i=0.0; i<=oNAo-step; i+=step) - { - - for(double o=oNAi+step; o<=1.0; o+=step) - { - - + double e = 0.001; + int i, o; + for(i=0; i= o || i + e >= oNAo || oNAi + e >= o || oNAi + e >= oNAo) - D = 0.0; + if(cNAi >= cNAo || cNAi >= oNAo || oNAi >= cNAo || oNAi >= oNAo) + D = -1.0; else D = absorbanceDistortion(); } else { - if(i >= o || oNAi >= oNAo) - D=0; + if(cNAi >= cNAo || oNAi >= oNAo) + D = -1.0; else D = intensityDistortion(); - } + } + distortionMap[o * nSteps + i] = D; outFile<= nLambda-1) + return; //compute the delta-theta value double dTheta = (oThetaO - oThetaI)/nSamples; //allocate space for the Legendre polynomials - double Ptheta[2]; + double Ptheta[2]; double cosTheta, theta; cuDoubleComplex Us; @@ -122,7 +124,7 @@ __global__ void devComputeSpectrum(double* I, double2* B, double* alpha, int Nl, complexFac = cMult(B[Nl * i + l], exp_numer); complexFac = cMult(complexFac, iL); - + //combine the real and complex components UsSample = cMult(complexFac, realFac); @@ -131,7 +133,7 @@ __global__ void devComputeSpectrum(double* I, double2* B, double* alpha, int Nl, //increment the imaginary exponent i^l iL = cMult(iL, imag); - + } //sum the scattered and incident fields @@ -158,8 +160,9 @@ void cudaComputeSpectrum(double* cpuI, double* cpuB, double* cpuAlpha, HANDLE_ERROR(cudaMemcpy(gpuAlpha, cpuAlpha, sizeof(double) * Nl, cudaMemcpyHostToDevice)); double* gpuI; - HANDLE_ERROR(cudaMalloc(&gpuI, sizeof(double) * nLambda)); - + HANDLE_ERROR(cudaMalloc(&gpuI, sizeof(double) * nLambda)); + HANDLE_ERROR(cudaMemset(gpuI, 0, sizeof(double) * nLambda)); + //call the kernel to compute the spectrum dim3 block(BLOCK_SIZE*BLOCK_SIZE); @@ -167,15 +170,17 @@ void cudaComputeSpectrum(double* cpuI, double* cpuB, double* cpuAlpha, //devComputeSpectrum devComputeSpectrum<<>>(gpuI, (double2*)gpuB, gpuAlpha, Nl, - nSamples, oThetaI, oThetaO, cThetaI, cThetaO); + nSamples, nLambda, oThetaI, oThetaO, cThetaI, cThetaO); HANDLE_ERROR(cudaMemcpy(cpuI, gpuI, sizeof(double) * nLambda, cudaMemcpyDeviceToHost)); + //printf("Final array value: %f\n", cpuI[nLambda-1]); + HANDLE_ERROR(cudaFree(gpuB)); HANDLE_ERROR(cudaFree(gpuAlpha)); HANDLE_ERROR(cudaFree(gpuI)); - -} \ No newline at end of file + +} diff --git a/globals.h b/globals.h index ad8934e..6a7474d 100644 --- a/globals.h +++ b/globals.h @@ -4,7 +4,7 @@ #include #include #include -#include "PerformanceData.h" +#include "PerformanceData.h" #include using namespace std; @@ -102,9 +102,13 @@ extern int maxFitIter; void EstimateMaterial(); extern double scaleI0; extern double refSlope; - + + +//distortion maps double ComputeDistortion(); -void MinimizeDistortion(); +void DistortionMap(float* distortionMap, int nSteps); + + -#endif \ No newline at end of file +#endif diff --git a/interactivemie.cpp b/interactivemie.cpp index 8504eda..a76543f 100644 --- a/interactivemie.cpp +++ b/interactivemie.cpp @@ -1,4 +1,7 @@ #include "interactivemie.h" +#include + +qtDistortionDialog* distortionDialog; InteractiveMie::InteractiveMie(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags) @@ -9,4 +12,11 @@ InteractiveMie::InteractiveMie(QWidget *parent, Qt::WFlags flags) InteractiveMie::~InteractiveMie() { updating = false; +} + +void InteractiveMie::closeEvent(QCloseEvent *event) +{ + cout<<"Exiting"< #include #include -#include "ui_interactivemie.h" -#include "globals.h" - +#include "ui_interactivemie.h" +#include "qtDistortionDialog.h" +#include "globals.h" + +extern qtDistortionDialog* distortionDialog; + class InteractiveMie : public QMainWindow { Q_OBJECT public: InteractiveMie(QWidget *parent = 0, Qt::WFlags flags = 0); - ~InteractiveMie(); + ~InteractiveMie(); + void closeEvent(QCloseEvent *event); bool updating; void refreshUI() @@ -53,7 +57,6 @@ public: ui.cmbMaterial->setCurrentIndex(currentMaterial); updating = false; - } void dragEnterEvent(QDragEnterEvent *event) @@ -64,7 +67,7 @@ public: event->mimeData()->hasFormat("text/plain")) { event->acceptProposedAction(); - + } } @@ -104,7 +107,7 @@ public slots: void on_chkDisplayRefSpec_clicked(bool b){ dispRefSpec = b; UpdateDisplay(); - } + } void on_chkDisplaySimK_clicked(bool b){ dispSimK = b; UpdateDisplay(); @@ -287,7 +290,9 @@ public slots: } void on_btnDistortion_clicked(){ //ComputeDistortion(); - MinimizeDistortion(); + //DistortionMap(); + cout<<"Distortion"<show(); } void on_btnTimings_clicked(){ PD.PrintResults(cout); @@ -308,7 +313,7 @@ public slots: //first load the imaginary part QString kFileName = QFileDialog::getOpenFileName(this, tr("Open Imaginary (k) Spectrum")); - + //exit if no file was selected if(kFileName == QString::null) return; diff --git a/interactivemie.ui b/interactivemie.ui index 4c440bf..d85c580 100644 --- a/interactivemie.ui +++ b/interactivemie.ui @@ -6,7 +6,7 @@ 0 0 - 464 + 511 525 @@ -32,7 +32,7 @@ - 70 + 80 80 62 22 @@ -48,7 +48,7 @@ - 70 + 80 50 62 22 @@ -80,7 +80,7 @@ - 70 + 80 20 62 22 @@ -127,7 +127,7 @@ 20 110 - 101 + 121 17 @@ -166,7 +166,7 @@ 5 50 - 71 + 81 20 @@ -177,7 +177,7 @@ - 80 + 90 20 62 22 @@ -195,7 +195,7 @@ 5 20 - 71 + 91 20 @@ -244,7 +244,7 @@ - 80 + 90 50 62 22 @@ -262,7 +262,7 @@ 20 80 - 82 + 111 17 @@ -278,7 +278,7 @@ 150 80 - 82 + 91 17 @@ -296,15 +296,15 @@ - Point Detector + Point Det. - 10 + 1 100 - 42 + 51 22 @@ -320,7 +320,7 @@ 60 100 - 71 + 81 16 @@ -334,7 +334,7 @@ 280 20 - 161 + 181 411 @@ -454,9 +454,9 @@ - 20 + 10 20 - 61 + 71 16 @@ -469,7 +469,7 @@ 10 230 - 131 + 151 17 @@ -485,7 +485,7 @@ 10 170 - 131 + 151 17 @@ -624,7 +624,7 @@ - 90 + 120 290 51 22 @@ -637,7 +637,7 @@ - 90 + 120 340 51 22 @@ -665,7 +665,7 @@ 50 190 - 82 + 101 17 @@ -692,7 +692,7 @@ - 90 + 120 380 62 22 @@ -868,8 +868,8 @@ 120 50 - 46 - 13 + 51 + 16 @@ -883,8 +883,8 @@ 0 0 - 464 - 21 + 511 + 25 diff --git a/main.cpp b/main.cpp index 53fe4d9..ac06f65 100644 --- a/main.cpp +++ b/main.cpp @@ -1,7 +1,10 @@ #include using namespace std; #include "interactivemie.h" -#include +#include +#include +#include +#include #include "qtSpectrumDisplay.h" #include "globals.h" #include "rtsGUIConsole.h" @@ -11,7 +14,11 @@ using namespace std; PerformanceData PD; -qtSpectrumDisplay* gpSpectrumDisplay; +qtSpectrumDisplay* gpSpectrumDisplay; + +QGraphicsScene* distortionScene = NULL; +QGraphicsView* distortionWindow = NULL; +QGraphicsPixmapItem* pixmapItem = NULL; vector > RefSpectrum; vector SimSpectrum; @@ -209,7 +216,7 @@ void FitDisplay(){ void ChangeAbsorbance(){ //compute the real part of the index of refraction - + //copy the absorbance values into a linear array int nSamples = MaterialList[currentMaterial].eta.size(); double startNu = MaterialList[currentMaterial].nu.front(); @@ -280,11 +287,11 @@ void SetMaterial() int main(int argc, char *argv[]) { - + //load the default project file (any previous optical settings) LoadState(); - + //load the default materials LoadMaterial("eta_TolueneK.txt", "eta_TolueneN.txt", "Toluene"); LoadMaterial("kPMMA.txt", "PMMA"); @@ -294,25 +301,36 @@ int main(int argc, char *argv[]) //compute the analytical solution for the Mie scattered spectrum SimulateSpectrum(); - QApplication a(argc, argv); + QApplication a(argc, argv); + + //create and position the UI window InteractiveMie w; - - w.show(); - - w.move(0, 0); - QRect frame = w.frameGeometry(); - QRect inside = w.geometry(); + QRect uiFrame = w.frameGeometry(); + QRect uiNoFrame = w.geometry(); + int frameHeight = uiFrame.height() - uiNoFrame.height(); //activate a console for output - RedirectIOToConsole(0, frame.height(), frame.width()); - + RedirectIOToConsole(0, uiFrame.height(), uiFrame.width(), 400); + printf("Frame height: %d\n", frameHeight); + + //set the size and position of the spectrum window + int visWinSize = uiFrame.height()/2 - frameHeight; + //create the far field window gpSpectrumDisplay = new qtSpectrumDisplay(); - gpSpectrumDisplay->move(frame.width(), 0); - gpSpectrumDisplay->resize(2*inside.height(), inside.height()); - - gpSpectrumDisplay->show(); + gpSpectrumDisplay->resize(visWinSize*2, visWinSize); + gpSpectrumDisplay->move(uiFrame.width(), 0); + gpSpectrumDisplay->show(); + + //distortion dialog box + distortionDialog = new qtDistortionDialog(); + distortionDialog->move(0, 0); + + //display the distortion map + distortionScene = new QGraphicsScene(); + distortionWindow = new QGraphicsView(distortionScene); + distortionWindow->move(uiFrame.width(), visWinSize); //refresh the UI w.refreshUI(); diff --git a/qtSpectrumDisplay.cpp b/qtSpectrumDisplay.cpp index 4945415..0f41a27 100644 --- a/qtSpectrumDisplay.cpp +++ b/qtSpectrumDisplay.cpp @@ -1,298 +1,224 @@ - #include - #include +#include +#include #include - #include - - #include "qtSpectrumDisplay.h" - - qtSpectrumDisplay::qtSpectrumDisplay(QWidget *parent) - : QGLWidget(parent) - { - object = 0; - xRot = 0; - yRot = 0; - zRot = 0; - - qtGreen = QColor::fromCmykF(0.40, 0.0, 1.0, 0.0); - qtPurple = QColor::fromCmykF(0.39, 0.39, 0.0, 0.0); - } - - qtSpectrumDisplay::~qtSpectrumDisplay() - { - makeCurrent(); - glDeleteLists(object, 1); - } - - QSize qtSpectrumDisplay::minimumSizeHint() const - { - return QSize(50, 50); - } - - QSize qtSpectrumDisplay::sizeHint() const - { - return QSize(400, 400); - } - - /*void qtSpectrumDisplay::setXRotation(int angle) - { - normalizeAngle(&angle); - if (angle != xRot) { - xRot = angle; - emit xRotationChanged(angle); - updateGL(); +#include + +#include "qtSpectrumDisplay.h" + +qtSpectrumDisplay::qtSpectrumDisplay(QWidget *parent) + : QGLWidget(parent) +{ + object = 0; + xRot = 0; + yRot = 0; + zRot = 0; + + qtGreen = QColor::fromCmykF(0.40, 0.0, 1.0, 0.0); + qtPurple = QColor::fromCmykF(0.39, 0.39, 0.0, 0.0); +} + +qtSpectrumDisplay::~qtSpectrumDisplay() +{ + makeCurrent(); + glDeleteLists(object, 1); +} + +QSize qtSpectrumDisplay::minimumSizeHint() const +{ + return QSize(50, 50); +} + +QSize qtSpectrumDisplay::sizeHint() const +{ + return QSize(400, 400); +} + +void qtSpectrumDisplay::initializeGL() +{ + qglClearColor(qtPurple.dark()); + //object = makeObject(); + glShadeModel(GL_FLAT); + glEnable(GL_DEPTH_TEST); + glEnable(GL_CULL_FACE); +} + +void qtSpectrumDisplay::printWavenumber(int xPos) +{ + int viewParams[4]; + glGetIntegerv(GL_VIEWPORT, viewParams); + + float a = (float)xPos/(float)viewParams[2]; + + int wn = a * (nuMax - nuMin) + nuMin; + cout< 0) + { + glColor3f(0.5, 0.5, 0.5); + glBegin(GL_LINE_STRIP); + float nu; + for(unsigned int i=0; i maxN) + maxN = thisN; + thisK = fabs(MaterialList[currentMaterial].eta[i].imag()); + if(thisK > maxK) + thisK = maxK; + } + cout< 0) - { - glColor3f(0.5, 0.5, 0.5); - glBegin(GL_LINE_STRIP); - float nu; - for(unsigned int i=0; ipos(); - - if(event->buttons() & Qt::LeftButton) - { - int wn = 0; - printWavenumber(event->x()); - } - } - - void qtSpectrumDisplay::mouseMoveEvent(QMouseEvent *event) - { - int dx = event->x() - lastPos.x(); - int dy = event->y() - lastPos.y(); - /* - if (event->buttons() & Qt::LeftButton) { - setXRotation(xRot + 8 * dy); - setYRotation(yRot + 8 * dx); - } else if (event->buttons() & Qt::RightButton) { - setXRotation(xRot + 8 * dy); - setZRotation(zRot + 8 * dx); - }*/ - lastPos = event->pos(); + glEnd(); +} + +//display refractive index (real) +if(dispMatN) +{ + glColor3f(0.0, 1.0, 0.0); + glBegin(GL_LINE_STRIP); + for(int i=0; ipos(); - glEndList(); - return list; - }*/ - - void qtSpectrumDisplay::quad(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2, - GLdouble x3, GLdouble y3, GLdouble x4, GLdouble y4) + if(event->buttons() & Qt::LeftButton) { - qglColor(qtGreen); - - glVertex3d(x1, y1, -0.05); - glVertex3d(x2, y2, -0.05); - glVertex3d(x3, y3, -0.05); - glVertex3d(x4, y4, -0.05); - - glVertex3d(x4, y4, +0.05); - glVertex3d(x3, y3, +0.05); - glVertex3d(x2, y2, +0.05); - glVertex3d(x1, y1, +0.05); + int wn = 0; + printWavenumber(event->x()); } - - /*void qtSpectrumDisplay::extrude(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2) - { - qglColor(qtGreen.dark(250 + int(100 * x1))); - - glVertex3d(x1, y1, +0.05); - glVertex3d(x2, y2, +0.05); - glVertex3d(x2, y2, -0.05); - glVertex3d(x1, y1, -0.05); - }*/ - - void qtSpectrumDisplay::normalizeAngle(int *angle) - { - while (*angle < 0) - *angle += 360 * 16; - while (*angle > 360 * 16) - *angle -= 360 * 16; - } \ No newline at end of file +} + +void qtSpectrumDisplay::mouseMoveEvent(QMouseEvent *event) +{ + int dx = event->x() - lastPos.x(); + int dy = event->y() - lastPos.y(); + + lastPos = event->pos(); +} + +void qtSpectrumDisplay::quad(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2, + GLdouble x3, GLdouble y3, GLdouble x4, GLdouble y4) +{ + qglColor(qtGreen); + + glVertex3d(x1, y1, -0.05); + glVertex3d(x2, y2, -0.05); + glVertex3d(x3, y3, -0.05); + glVertex3d(x4, y4, -0.05); + + glVertex3d(x4, y4, +0.05); + glVertex3d(x3, y3, +0.05); + glVertex3d(x2, y2, +0.05); + glVertex3d(x1, y1, +0.05); +} + +void qtSpectrumDisplay::normalizeAngle(int *angle) +{ + while (*angle < 0) + *angle += 360 * 16; + while (*angle > 360 * 16) + *angle -= 360 * 16; +} diff --git a/rtsGUIConsole.cpp b/rtsGUIConsole.cpp deleted file mode 100644 index 07559fc..0000000 --- a/rtsGUIConsole.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#ifdef WIN32 -#include -#include -#include -#include -#include -#include - -#ifndef _USE_OLD_IOSTREAMS - -using namespace std; -#endif - -// maximum mumber of lines the output console should have - -static const WORD MAX_CONSOLE_LINES = 500; -//#ifdef _DEBUG - -void RedirectIOToConsole(int Xpos, int Ypos, int Width, int Height) -{ - int hConHandle; - long lStdHandle; - CONSOLE_SCREEN_BUFFER_INFO coninfo; - FILE *fp; - // allocate a console for this app - AllocConsole(); - // set the screen buffer to be big enough to let us scroll text - GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &coninfo); - coninfo.dwSize.Y = MAX_CONSOLE_LINES; - SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), - coninfo.dwSize); - // redirect unbuffered STDOUT to the console - lStdHandle = (long)GetStdHandle(STD_OUTPUT_HANDLE); - hConHandle = _open_osfhandle(lStdHandle, _O_TEXT); - fp = _fdopen( hConHandle, "w" ); - *stdout = *fp; - setvbuf( stdout, NULL, _IONBF, 0 ); - // redirect unbuffered STDIN to the console - lStdHandle = (long)GetStdHandle(STD_INPUT_HANDLE); - hConHandle = _open_osfhandle(lStdHandle, _O_TEXT); - fp = _fdopen( hConHandle, "r" ); - *stdin = *fp; - setvbuf( stdin, NULL, _IONBF, 0 ); - - // redirect unbuffered STDERR to the console - lStdHandle = (long)GetStdHandle(STD_ERROR_HANDLE); - hConHandle = _open_osfhandle(lStdHandle, _O_TEXT); - fp = _fdopen( hConHandle, "w" ); - *stderr = *fp; - setvbuf( stderr, NULL, _IONBF, 0 ); - - // make cout, wcout, cin, wcin, wcerr, cerr, wclog and clog - // point to console as well - ios::sync_with_stdio(); - //position - MoveWindow(GetConsoleWindow(), Xpos, Ypos, Width, Height, true); -} - -#else -void RedirectIOToConsole(int Xpos, int Ypos, int Width, int Height) -{ -} -#endif - -//End of File \ No newline at end of file diff --git a/rtsGUIConsole.h b/rtsGUIConsole.h deleted file mode 100644 index d74d721..0000000 --- a/rtsGUIConsole.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef __GUICON_H__ - -#define __GUICON_H__ - -//#ifdef _DEBUG - -void RedirectIOToConsole(int Xpos = 0, int Ypos = 0, int Width = 700, int Height = 400); - -//#endif - -#endif - -/* End of File */ \ No newline at end of file -- libgit2 0.21.4