C ++でglutを使用して、メイン関数に入力したファイルの情報に基づいて図面を作成しようとしています。
int main (int argc, char** argv) //I think this is all relevant info in main
{
glutDisplayFunc (display);
fstream file = fstream ("Tree.txt");
Tree myTree = Tree(file);
}
static //this is the function I need to draw from but it can't take any parameters
void display(void)
{
}
static void draw_frame(Tree::Node* t) //my draw function needs access to info from my file stream
{
int x = t->xValue; //for example I need to access these variables
int y = t->yValue;
}
Tree * myTreeをグローバル変数にしようとしましたが、エラーが増え、ファイルの読み取りが完全に停止しました。誰かアイデアがあれば、とてもありがたいです!