Hello, world!
This is my first post on this site so don't blame me in anything.
I am writing a program that is supposed to operate with matrices and to use OpenGL framework for drawing them. Honestly, it's just for practice. Anyway, I tried to compile it and, of course, it didn't run well. Inserting as many logging as I could, I found out that my std::cerr can't print float value. I really got no idea how that may stop working. I have made some deep researches on my little code like changing variables to their values, coding external programs using same functions and so on; and found even more unbelievable thing that there's no reason for this. ABSOLUTELY. Perhaps, since robots can't harm human being, they troll it evilly. Thank you, Azimov.
Useful details:
OS X 10.9. No bugs regarding to precompilation may occur other than ones caused by #pragma once.
Compiler:
Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn).
g++ -std=c++11 -framework OpenGL -framework GLUT
WINDOW.hpp
class Window {
std::vector <Matrix> matrices_;
float WIDTH_, HEIGHT_,
SIZE_X_, SIZE_Y_;
const char *NAME_;
public:
Window (const float WIDTH, const float HEIGHT);
private:
void Type (const float x, const float y, const char *string) const;
public:
void AddMatrix (const Matrix &A);
void Write (const std::string &message);
void Display ();
void Reshape (int NEW_WIDTH, int NEW_HEIGHT);
void Keyboard (unsigned char key, int x, int y);
void Special (int key, int x, int y);
};
WINDOW.cpp
// --- THIS IS CONSTRUCTOR --- --- --- --- ---
Window::Window (const float WIDTH, const float HEIGHT) :
WIDTH_(WIDTH), HEIGHT_(HEIGHT),
SIZE_X_(800), SIZE_Y_(800),
NAME_("MATRIX") {
...
}
--- THIS IS DISPLAY FUNCTION CALLED FROM MAIN::Display() ---
void Window::Display () {
glLoadIdentity(); Write("glLoadIdentity();");
glClear(GL_COLOR_BUFFER_BIT); Write("glClear(GL_COLOR_BUFFER_BIT);");
glMatrixMode(GL_PROJECTION); Write("glMatrixMode(GL_PROJECTION);");
Write("\tNOW i WILL TRY TO OUTPUT HEIGHT_ :");
std::cerr << HEIGHT_ << std::endl;
glOrtho(0, WIDTH_, 0, HEIGHT_, 1, -1); //Write("glOrtho(0, WIDTH_, 0, HEIGHT_, 1, -1);");
...
}
Aucun commentaire:
Enregistrer un commentaire