quote:Original post by CraZeE
taking ur point on trapping redundancies, have u considered the additional execution layers involved in wrapping the function into class functions? co assuming u''re wrapping at an extremely low level, such as Vertex(...) to substitute glVertex*, then wouldnt these be true:
1. class functions have an explicit passing of the ''this'' pointer making function initiation ever so slightly slower.
didnt consider that, although i dont think it will be that much of a burden? Any way to specify that you dont want the this pointer? (er actually, its needed in a few places, for checking states)
quote:
2. i dunno if object overloading works anywhere like virtual functions, but i suppose mapping the proper overloaded function could entail a speed hit.
not sure what you mean here...
quote:
3. though these hits are small, but at low levels, they may end up being called enuf times to accumulate their bloat
highly unlikely. The entire point of the class is to prevent unneccessary function calls. I figure thats what a lot of engines do anyways.
quote:
also, thinking about state changes verification, it is a nice thing to avoid state changes when its not already necessary. But that would perform some logic computation which would usually be quick. but are state changes really THAT taxing to make this necessary versus verifying?
just curious
it is definately necessary to keep track of the state changes on your own. If you design your entire engine so that it never binds the same texture twice, then kudos to you because you just did what everyone is trying accomplish. This is one way of doing it (kind of). Im not that great at programming, most smart people will be able to admit that (because programming is so vast). If i was carmack, i wouldnt be asking/talking about stuffs like this here, because I''d already know
. But since I dont, i come here to express my ideas. If you can find good reasons why my ideas aren''t good ideas, I appreciate you telling me. All of you
.
I''m beginning to think that writing a shadow function for every single gl function there is, tis a big rediculous, so im currently re-evaluating how I should accomplish this elegantly. But the ideas ive already expressed are definately good ones. The state watching, and the function overloading is ok. Im just not so sure if i should wrap EVERY function. I need to take a look at all the functions, as a whole, and figure out which ones would be the best ones to wrap. The ones that should not be wrapped should just be inlined (copy the original gl function), because you still want to have everything localized. (you dont want to call gl.Vertex at one place, then call glBlendFunc somewhere else).
--FirekingOwner/LeaderFiregames Development &Blackdragon Studios