glutDisplayFuncによって呼び出される関数に配列の形式でデータを渡そうとしています。これが可能かどうか/どのように行うか、または同じ目標を達成するための簡単な代替手段を教えてください。最終的には、描画関数に多くの値を渡したいと思います。ありがとうございました!
#include "stdafx.h"
#include <ostream>
#include <iostream>
#include <Windows.h>
#include <ctime>
#include <vector>
using namespace std;
#include <glut.h>
void Draw(int passedArray[]) { // This is probably wrong but just to give you the idea
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0, 1.0);
glBegin(GL_POINTS);
glVertex3f(passedArray[1], passedArray[2], 0.0); // A point is plotted based on passed data
glEnd();
glFlush();
}
void Initialize() {
glClearColor(0.0, 0.0, 0.0, 0.0); // Background color
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
}
int main(int iArgc, char** cppArgv) {
cout << "Start Main" << endl;
glutInit(&iArgc, cppArgv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(250, 250); // Control window size
glutInitWindowPosition(200, 200);
glutCreateWindow("GA");
Initialize();
int passedArray[2] = {10, 20}; // create array
glutDisplayFunc(Draw(passedArray)); // This is not how you do this, just to try to convey what I want
glutMainLoop();
return 0;
}