hopefully not a trivial question...

krazygluon
Unregistered
 
Post: #1
is it a crime to ask for a main() function that's not full of glut code? (even though I am using glut until I decide I need sdl to go any further)

Instead of following the typical glut tutorial (which crams most of the initial glut code into main() and the associated functions, I'm trying to do the following:

Class interface {
Public:
void initialise(int argc, char** argv);
void display();
void reshape();
void idle();
};

void interface::initialize(int argc, char** argv) {
glutinit(&argc, argv);
... (profundity of glut code goes here)
glutmainloop();
}
void interface::display() {
... (typical display func code goes here)
}
and so on for the reshape and idle functions...

now somehow when, in initialise(), i call "glutDisplayFunc(display)" xCode says "error: argument of type interface:: does not match void(*)()"

essentially what I'm doing is bundling all of the glut functions into one class I can tuck away into a header file...is this even possible?
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #2
Blink just have the glut functions in your code, ok?

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
krazygluon
Unregistered
 
Post: #3
eh well, I manage to wrap those into functions to put into a header file, which is close enough...I guess that idea was overuse/abuse of classes.
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #4
Perfectly valid, a good idea if you plan to replace GLUT later. Otherwise, a bit overkill. Smile
Quote this message in a reply
Member
Posts: 304
Joined: 2002.04
Post: #5
FYI - In the future krazygluon please create a more descriptive thread title. This helps everyone on the forum out. "Is it a crime to ask for a main() function that's not full of glut code?" would be a better title while you could put "hopefully not a trivial question..." as the first line of the body. It seems small, but it makes a big difference. Thanks.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Probably trivial C++ error, but not for me. WhatMeWorry 3 3,248 Jun 13, 2005 02:01 PM
Last Post: TomorrowPlusX