|
From: Frank C <li...@si...> - 2004-06-17 17:42:12
|
On 16-Jun-04, at 1:47 PM, Dair Grant wrote: > Frank C wrote: > >> I've gained some speed by removing all NULL binds and wrapping >> glBindTexture in a GL_Util*** routine that compares the last texture >> to >> the requested one, avoiding redundant uploads. > > The texture won't be uploaded when it's bound: unless it got bumped out > of vram by something else since the last time it was bound, it'll still > be there. > >> This helps the transparent pass quite a bit since it often >> binds/unbinds the same texture over and over (for every triangle) when >> drawing a mostly self-sorted mesh. > > I guess it removes the need to call GL, but I would expect > glBindTexture > to not do anything if the same object is already bound - although I > suppose it could be implementation dependent (perhaps some drivers do > no > checking at all: seems unlikely though, checking for a no-change is > such > an obvious thing to do if you were writing glBindTexture). I would hope drivers would do this as well, but I was under the impression you shouldn't rely on this. I've done some testing with OpenGL Profiler on Mac OS X 10.3.4 with a GeForce3 64MB card. The scene consisted of one model with three textures (i.e. 3 trimeshes) with approximately 1500 triangles total. Below are the average timings for glBindTexture from the "% GL Time" column: CVS source 06/17/04 All solid textures: 1.3 % All transparent textures: 8.6 % CVS source 06/17/04, with redundant calls to glBindtexture and NULL binds removed) All solid textures: 0.5 % All transparent textures: 1.7 % This doesn't translate to a huge speed up for the entire application but it's measurable. Frank. |