I am new to OpenGL. I am coding in Visual C++ 2005 environment, and I have some problem of calling the display.
glutDisplayFunc(display);
The “display” is a callback function, so i declared it as a static function in the header.
static void __cdecl display();
In the display function, i wanted it to read an array from a non static function, and display the lines from there.
glClearColor(0,0,0,0);//set the background color to black
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
x=((COpenGL*) pDummy)->myArray[i].x;
y=((COpenGL*) pDummy)->myArray[i].y;
for(i=0;i<10;i++)
{
x=mySelf->laser[i].x;
y=mySelf->laser[i].y;
z=0.0;
glVertex3f(x,y,z);
}
glBegin(GL_LINE_STRIP);
Each array represents a frame that i want to display in the OpenGL window. These frames will be continously streaming in, and in the openGL window will form an animation of different frames.
Unfortunately, it cannot be done as Visual C++ reported a wrong type of casting in
((COpenGL*) pDummy)
What is wrong here?
Are there any other alternatives?