glut and classes

Started by
0 comments, last by Polymorph2000 20 years, 11 months ago
I'm currently using glut to create a simple OpenGL based program that uses a particle engine that I made. The problem is that I, like many other programmers, hate global variables. I am trying to create a class that encorporates my drawing, idle, and keyboard handling functions into one class. The problem happen when I try to assign a drawing function to glut. Below is roughly what the header looks like: //gldraw.h class GLDraw { public: GLDraw(int argc = 0, char** argv = nil); void InitTextures(); ~GLDraw(); GLvoid DrawGLScene(GLvoid); private: GLData settings; void SetupGL(); }; //gldraw.cpp //section of constructor typedef void (*pfunc)(); pfunc draw = DrawGLScene; glutDisplayFunc(draw); Error returned by compiler: Error : illegal implicit conversion from 'void (*)()' to 'void (*)()' gldrawfunctions.cpp line 48 pfunc draw = DrawGLScene; I am currently using Metrowerks 8.3, and I have no idea how to fix this problem. Any ideas on how to fix this would be greatly appreciated. [edited by - Polymorph2000 on May 6, 2003 1:40:52 AM]
Advertisement
http://www.parashift.com/c++-faq-lite/pointers-to-members.html

How appropriate. You fight like a cow.

This topic is closed to new replies.

Advertisement