Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

python - "too many values to unpack error" when trying to create a batch in pyglet -


i have been trying batches work in pyglet, confused error message "too many values unpack" coming pyglet/graphics/__init__.py file. guess that doing wrong syntaxwise when adding geometry batch.

i cut down code essential parts create error:

from pyglet.gl import * pyglet.graphics import * import pyglet  batch = pyglet.graphics.batch() img = pyglet.image.load('pic.png') texture = img.get_texture()  class textureenablegroup(pyglet.graphics.group):     def set_state(self):         glenable(gl_texture_2d)     def unset_state(self):         gldisable(gl_texture_2d)  texture_enable_group = textureenablegroup()  class texturebindgroup(pyglet.graphics.group):     def __init__(self, texture):         super(texturebindgroup, self).__init__(parent=texture_enable_group)         self.texture = texture     def set_state(self):         glbindtexture(gl_texture_2d, self.texture.id)         gltexparameteri(gl_texture_2d, gl_texture_mag_filter, gl_linear)         gltexparameteri(gl_texture_2d, gl_texture_min_filter, gl_linear)     def __eq__(self, other):         return (self.__class__ other.__class__ , self.texture == other.__class__)  batch.add(12, gl_triangles, texturebindgroup(texture), (('t2f', (0, 0)), ('v3f', (64, 64, 0)), ('t2f', (1, 1)), ('v3f', (-64, -64, 205)), ('t2f', (0, 1)), ('v3f', (-64, 64, 205)), ('t2f', (1, 1)), ('v3f', (64, -64, 205)), ('t2f', (1, 0)), ('v3f', (64, 64, 0)), ('t2f', (0, 1)), ('v3f', (-64, -64, 205)))) 

your problem in line:

batch.add(12, gl_triangles, texturebindgroup(texture), (('t2f', (0, 0)), ('v3f', (64, 64, 0)), ('t2f', (1, 1)), ('v3f', (-64, -64, 205)), ('t2f', (0, 1)), ('v3f', (-64, 64, 205)), ('t2f', (1, 1)), ('v3f', (64, -64, 205)), ('t2f', (1, 0)), ('v3f', (64, 64, 0)), ('t2f', (0, 1)), ('v3f', (-64, -64, 205)))) 

i believe should be:

batch.add(12, gl_triangles, texturebindgroup(texture), ('t2f', (0, 0)), ('v3f', (64, 64, 0)), ('t2f', (1, 1)), ('v3f', (-64, -64, 205)), ('t2f', (0, 1)), ('v3f', (-64, 64, 205)), ('t2f', (1, 1)), ('v3f', (64, -64, 205)), ('t2f', (1, 0)), ('v3f', (64, 64, 0)), ('t2f', (0, 1)), ('v3f', (-64, -64, 205))) 

notice how changed last argument format ((tuple), (tuple)) (tuple), (tuple)). i'm not familiar pyglet, discovered correct way of calling batch.add() documentation. note *data represents variable list of parameters @ end of function call, not tuple or list attempted.

try , let know how works out you.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -