Frame rates are now anywhere from the 30's to the 150's for various maps from OpenArena.
My problem, now that I have the lightmaps working, is that everything is too dark. I realize gamma is outside of OpenGL, but is there a way to adjust the gamma for the screen as a whole in pyglet? -price On Aug 21, 8:41 pm, stampson <[EMAIL PROTECTED]> wrote: > I wasted some time trying to make something complicated, and then > decided to first try the following: > > I have a MultiTextureEnable group which sets up the texture parameters > and enables the textures. > > Then to build the batch, I sort the faces by surfacetexture. Then for > each face, when the surfacetexture changes, I make a new > SurfaceTextureBindGroup with the MultiTextureEnable group as the > parent. For each lightmap texture within that surfacetexture group, I > use LightMapSurfaceTextureBindGroup in the batch.add. > > Doing the above reduces the state changes considerably - my viewer > runs at 34 fps on the same level it was getting 2 (if it was lucky!). > > I am going to try packing the lightmap textures. However, I think I > can't pack the surfacetextures, as they are repeating textures. > > Thanks for the feedback/advice. > > Here are my classes for the opengl state setting: > > class MultiTextureEnableGroup(pyglet.graphics.Group): > def set_state(self): > glActiveTexture(GL_TEXTURE0) > glEnable(GL_TEXTURE_2D) > glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ) > glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, > GL_LINEAR) > glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, > GL_LINEAR) > glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT) > glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT) > glActiveTexture(GL_TEXTURE1) > glEnable(GL_TEXTURE_2D) > glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ) > glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, > GL_LINEAR) > glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, > GL_LINEAR) > glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT) > glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT) > > def unset_state(self): > glActiveTexture(GL_TEXTURE1) > glDisable(GL_TEXTURE_2D) > glActiveTexture(GL_TEXTURE0) > glDisable(GL_TEXTURE_2D) > > class SurfaceTextureBindGroup(pyglet.graphics.Group): > > def __init__(self, texture): > super(SurfaceTextureBindGroup, > self).__init__(parent=texture_enable_group) > assert texture.target == GL_TEXTURE_2D > self.texture = texture > > def set_state(self): > glActiveTexture(GL_TEXTURE0) > glBindTexture(GL_TEXTURE_2D, self.texture.id) > > # No unset_state method required. > > def __eq__(self, other): > return (self.__class__ is other.__class__ and > self.texture.target == other.texture.target and > self.texture.id == other.texture.id and > self.parent == other.parent) > > def __hash__(self): > return hash((self.texture.target, self.texture.id)) > > class LightmapTextureBindGroup(pyglet.graphics.Group): > > def __init__(self, texture, tparent): > super(LightmapTextureBindGroup, self).__init__(parent=tparent) > assert texture.target == GL_TEXTURE_2D > self.texture = texture > > def set_state(self): > glActiveTexture(GL_TEXTURE1) > glBindTexture(GL_TEXTURE_2D, self.texture.id) > > # No unset_state method required. > > def __eq__(self, other): > return (self.__class__ is other.__class__ and > self.texture.target == other.texture.target and > self.texture.id == other.texture.id and > self.parent == other.parent) > > def __hash__(self): > return hash((self.texture.target, self.texture.id)) > > On Aug 21, 7:48 pm, "Alex Holkner" <[EMAIL PROTECTED]> wrote: > > > On 8/22/08, Alex Holkner <[EMAIL PROTECTED]> wrote: > > > > On 8/22/08, Price Hall <[EMAIL PROTECTED]> wrote: > > > > Here's a screenshot of my quake3 map viewer with > > > > multitexturing....obviously not optimized =) > > > > > It works, however a significant challenge will be to make it > > > > reasonably fast. With surface textures alone, or lightmap textures > > > > alone, it reaches 250 fps. My code right now is worst-case as far as > > > > numbers of state changes. > > > > > Quake maps have surface textures and lightmap textures. The surface > > > > textures are various sizes, and some use texture coords outside 0.0 - > > > > 1.0.. The lightmap textures are all 128 x 128, with texture coords > > > > between 0.0 and 1.0. Textures will have to be bound much more > > > > frequently than with surface textures alone. There is very little > > > > grouping that can be done strictly by the combination of > > > > surface/lightmap textures. I'm trying to figure out a way I could > > > > form groups based on whichever is changing the least, say sort them > > > > out, set one texture and then have sub-groups for the various other > > > > textures combined with that one. > > > > If you're loading all the textures at startup anyway, it might also be > > > worth packing the textures into larger atlases. e.g., within one > > > 1024x1024 texture you could fit 64 lightmap textures (every device > > > I've seen will support a texture of those dimensions; larger and you > > > may have issues). > > > Oh, and, very impressive work BTW, looks great! > > > Alex. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pyglet-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en -~----------~----~----~----~------~----~------~--~---
