PDA

View Full Version : using OO techniques?



beatnik
02-21-2001, 11:02 AM
I'm just getting started with OpenGL, but I've had a good amount of experience with (and really prefer) heavily Object Oriented design.

So I have to ask: is a game program which sets up, for instance, a window- instance class (for purposes of keeping all the code encapsulated) that calls all of the gl setups, destroy functions, &tc going to slow down the program?

I would think that since the compiler is treating it as an object that the instructions and variables dealing with a "window" class would all be in the same area in memory and speed it up... am I wrong here?

Having all brand new hardware, I'm not planning on it being an issue until I get into advanced stuff, but I don't want to start with bad habits.

<BEATNIK>

jade6
02-21-2001, 01:09 PM
Considering that most commercial game programming is done with C++, I don't think there's a problem. Admittedly, most games use full-screen mode, but let me put it this way: if you want a window, object-oriented languages can probably do it as fast as procedural languages. I haven't done any performance measurements, but I can't see why there would be a noticeable difference. At least one so big that it would justify throwing all OOP tools to the garbage bin.

JoeMac
02-22-2001, 04:45 AM
C++ doesn't hurt timing at all if you do it well. I have an open source project set up similar to what you described. Its designed to get millisecond timing (for reaction time experiments) and probably more draconian than what you would need for a game. http://www.cs.dal.ca/~macinnwj/wingl.html
Joe