🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Object Oriented OpenGL?

Started by
12 comments, last by zeotron 23 years, 11 months ago
I was wondering if anyone has done a more object oriented approach to NeHe''s tutorials. I have made a class for my OpenGL projects. If anyone else has any intrest in this topic contact me. zacksmith@ignmail.com ICQ: 5790317 Zack
A moment enjoyed is not wasted. -Gamers.com
Advertisement
Classes suck. It doesn''t organize anything any better and i think its more confusing thats why i like OpenGL better than Directx causes its basically written in C and not C++.
if your making a game than don''t use classes. There probably alright for some stuff.

That is the biggest bunch of BS! Classes do belong in games. They help to organize things, and have a more object-oriented approach. The thinking that classes make things slow is wrong. There is NO difference between a class''s functions, and straight C. Anybody who tells you otherwise is either misinformed, or lying, so don''t believe them. Have you ever heard of modular programming (it can be done without classes, but it''s easier IMO with them)?

It''s a lot easier to state ridiculous comments under anonymous poster isn''t it? There''s no confrontation, then. I agree that OpenGL is better than Direct3D, but that''s a personal taste, it''s not a law (no flames please). Anonymous Poster is not correct, otherwise he''d have the guts to use a real name. Don''t listen to him.

Anyways, does you OOOGL work fine? I''m thinking that it would make things somewhat easier, maybe. Just call an Init function in your renderer class that sets up the window and everything, right?

-----------------------------1. "Diplomacy is the art of saying 'Nice doggie!'... till you can find a rock." 2. "Always remember you're unique, just like everyone else." 3. "If we don't succeed, we run the risk of failure."-Dan Quayle4. If life gives you sour grapes, squash them and make wine!
They help to organize things, and have a more object-oriented approach.
Well, being classes, they are the primary OO constuct

The thinking that classes make things slow is wrong. There is NO difference between a class''s functions, and straight C.
Well that really is debatable. Virtual functions do take longer to execute than un-pointered functions. Of course caching scomes into play here with these modern, fangled processors...

Have you ever heard of modular programming (it can be done without classes, but it''s easier IMO with them)?
Again, thats purely subjective - you shouldn''t really make such sweeping statements - thats how flamewars start.

Just call an Init function in your renderer class that sets up the window and everything, right?
What, and throw all manour of flexibilty out the window?

For OO OpenGL look at the ''Peformer'' scenegraph API from SGI. That benefits from being OO (think about it, its a scenegraph afterall)

Just my 2p worth.

Paul



Paul Groves
pauls opengl page
paul's opengl message board
Paul Grovespauls opengl page
I would have been anonymous too if I would have written that remark...

I''ve been working on a space flight simulator for a while and the first trial (which was mostly experimental) was done in C and ending up being a failure, the second was totally organized with Classes and has been exceeding my expectations...

I''ll always stick with C++ since now I have all my Vector Geometry classes worked up and can reuse them very easily.

I recommend going with C++ unless it''s a really small program...

The only thing you have to remember when working with Classes and OpenGL is that while Classes use a hierarchy, OpenGL is eually accessible from anywhere, think of it as being global.
C programming is becoming a thing of the past. Just last year my college dropped C and now only teaches C++. Nobody is even writing books for C anymore. Object oriented code is easier to maintain. C++ allows code reuse through inheritance. Its easier to protect your data in C++. There is operator overloading in c++(some ppl don''t like operator overloading but i do). Templates can save you lots of time--no more functions that do the same thing but take diferant arguments. You can have cool data structures with c++. I suppose i could go on, but i dont really care how this thread turns out. We all have differant tastes and opinions.

ECKILLER
ECKILLER
Delete this post before I take out my can of gasoline.

I also like to note that most major Operating Systems are relatively large, and most of them are made in C. Im getting tired of these arguments.

-----------------------------

A wise man once said "A person with half a clue is more dangerous than a person with or without one."

Edited by - immaGNUman on August 6, 2000 11:11:39 PM
-----------------------------A wise man once said "A person with half a clue is more dangerous than a person with or without one."The Micro$haft BSOD T-Shirt
There is a balance. If you call a virtual function 100 times per frame it''s not going to slow you down. If you''re dumb enough to call it a million times per frame, you''re screwed. Everything has it''s purpose. Excuse me, but I am sick of these wars, if you don''t know what u''re talking about, and u''re ignorant enough to scream "C is better" or "C++ is better" you can go fu(k yourself. Excuse me, but I am very pissed.
fuck you bitch mother fucking little shit ass dumb humping dog sucking big cock mother fucking pooh pooh head!

That''s mature, Anonymous Poster
-----------------------------1. "Diplomacy is the art of saying 'Nice doggie!'... till you can find a rock." 2. "Always remember you're unique, just like everyone else." 3. "If we don't succeed, we run the risk of failure."-Dan Quayle4. If life gives you sour grapes, squash them and make wine!

This topic is closed to new replies.

Advertisement