mirror of
https://github.com/quantum5/punyverse.git
synced 2025-04-24 21:21:59 -04:00
Outright require OpenGL 3.3.
pyglet seems to detect MESA as 3.0 even though it supports 3.3, even when I create a 3.3 context.
This commit is contained in:
parent
52c1a328aa
commit
85d4bd4efc
|
@ -102,30 +102,28 @@ class Belt(Entity):
|
|||
rotation = info.get('period', 31536000)
|
||||
models = info['model']
|
||||
self.rotation_angle = 360.0 / rotation if rotation else 0
|
||||
self.render = gl_info.have_version(3, 3)
|
||||
|
||||
if self.render:
|
||||
shader = world.activate_shader('belt')
|
||||
if not isinstance(models, list):
|
||||
models = [models]
|
||||
shader = world.activate_shader('belt')
|
||||
if not isinstance(models, list):
|
||||
models = [models]
|
||||
|
||||
self.belt = BeltVBO(radius, cross, len(models), count)
|
||||
self.objects = [
|
||||
WavefrontVBO(load_model(model), shader, info.get('sx', scale),
|
||||
info.get('sy', scale), info.get('sz', scale))
|
||||
for model in models
|
||||
]
|
||||
self.belt = BeltVBO(radius, cross, len(models), count)
|
||||
self.objects = [
|
||||
WavefrontVBO(load_model(model), shader, info.get('sx', scale),
|
||||
info.get('sy', scale), info.get('sz', scale))
|
||||
for model in models
|
||||
]
|
||||
|
||||
def callback():
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo)
|
||||
shader.vertex_attribute('a_translate', self.belt.location_size, self.belt.type, GL_FALSE,
|
||||
self.belt.stride, self.belt.location_offset, divisor=1)
|
||||
shader.vertex_attribute('a_scale', self.belt.scale_size, self.belt.type, GL_FALSE,
|
||||
self.belt.stride, self.belt.scale_offset, divisor=1)
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0)
|
||||
def callback():
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo)
|
||||
shader.vertex_attribute('a_translate', self.belt.location_size, self.belt.type, GL_FALSE,
|
||||
self.belt.stride, self.belt.location_offset, divisor=1)
|
||||
shader.vertex_attribute('a_scale', self.belt.scale_size, self.belt.type, GL_FALSE,
|
||||
self.belt.stride, self.belt.scale_offset, divisor=1)
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0)
|
||||
|
||||
for model, vbo, count in zip(self.objects, self.belt.vbo, self.belt.sizes):
|
||||
model.additional_attributes(callback)
|
||||
for model, vbo, count in zip(self.objects, self.belt.vbo, self.belt.sizes):
|
||||
model.additional_attributes(callback)
|
||||
|
||||
super(Belt, self).__init__(world, name, (x, y, z), (inclination, longitude, argument))
|
||||
|
||||
|
@ -135,9 +133,6 @@ class Belt(Entity):
|
|||
self.rotation = pitch, self.world.tick * self.rotation_angle % 360, roll
|
||||
|
||||
def draw(self, options):
|
||||
if not self.render:
|
||||
return
|
||||
|
||||
shader = self.world.activate_shader('belt')
|
||||
shader.uniform_mat4('u_mvpMatrix', self.mvp_matrix)
|
||||
shader.uniform_mat4('u_mvMatrix', self.mv_matrix)
|
||||
|
|
|
@ -78,6 +78,8 @@ def get_context_info(context):
|
|||
zip_longest(info[::2], info[1::2], fillvalue='')]
|
||||
|
||||
with glContext(context):
|
||||
gl_info.remove_active_context()
|
||||
gl_info.set_active_context()
|
||||
return '\n'.join([
|
||||
'Graphics Vendor: ' + gl_info.get_vendor(),
|
||||
'Graphics Version: ' + gl_info.get_version(),
|
||||
|
|
|
@ -27,7 +27,7 @@ def main():
|
|||
template = pyglet.gl.Config(depth_size=args.depth, double_buffer=True,
|
||||
sample_buffers=args.multisample > 1,
|
||||
samples=args.multisample,
|
||||
major_version=3, minor_version=2)
|
||||
major_version=3, minor_version=3)
|
||||
|
||||
platform = pyglet.window.get_platform()
|
||||
display = platform.get_default_display()
|
||||
|
|
Loading…
Reference in a new issue