How to use the moderngl.next.TRIANGLE_STRIP function in moderngl

To help you get started, we’ve selected a few moderngl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github moderngl / moderngl / examples / next / mandelbrot_set.py View on Github external
def render(self):
        self.ctx.screen.viewport = self.wnd.viewport
        self.ctx.clear(1.0, 1.0, 1.0)

        self.prog['Center'] = (0.5, 0.0)
        self.prog['Iter'] = 100
        self.prog['Scale'] = 1.5
        self.prog['Ratio'] = self.wnd.ratio

        self.vao.render(mgl.TRIANGLE_STRIP)
github moderngl / moderngl / examples / next / conways_game_of_life.py View on Github external
def render(self, time, frame_time):
        self.ctx.clear(1.0, 1.0, 1.0)

        self.tao.transform(self.pbo)
        self.texture.write(self.pbo)

        self.vao.render(mgl.TRIANGLE_STRIP)
github moderngl / moderngl / examples / next / multi_texture_terrain.py View on Github external
def render(self):
        angle = self.wnd.time * 0.2
        self.ctx.screen.viewport = self.wnd.viewport
        self.ctx.clear(1.0, 1.0, 1.0)

        with self.ctx.scope(mgl.DEPTH_TEST):
            proj = Matrix44.perspective_projection(45.0, self.wnd.ratio, 0.1, 1000.0)
            lookat = Matrix44.look_at(
                (np.cos(angle), np.sin(angle), 0.8),
                (0.0, 0.0, 0.1),
                (0.0, 0.0, 1.0),
            )

            self.prog['Mvp'] = (proj * lookat).astype('f4').tobytes()
            self.vao.render(mgl.TRIANGLE_STRIP)
github moderngl / moderngl / examples / next / julia_set.py View on Github external
def render(self):
        self.ctx.screen.viewport = self.wnd.viewport
        self.ctx.clear(1.0, 1.0, 1.0)

        self.prog['Seed'] = (-0.8, 0.156)
        self.prog['Iter'] = 100

        self.vao.render(mgl.TRIANGLE_STRIP)
github moderngl / moderngl / examples / next / mug_mockup.py View on Github external
def render(self):
        self.ctx.screen.viewport = self.wnd.viewport
        self.ctx.clear(1.0, 1.0, 1.0)
        self.bg_sampler.use()
        with self.ctx.scope(mgl.BLEND):
            self.canvas_vao.render(mgl.TRIANGLE_STRIP)
        with self.ctx.scope(mgl.DEPTH_TEST):

            proj = Matrix44.perspective_projection(30.0, self.wnd.ratio, 1.0, 1000.0)
            lookat = Matrix44.look_at(
                (46.748, -280.619, 154.391),
                (-23.844, 2.698, 44.493),
                (0.0, 0.0, 1.0),
            )

            self.prog['Mvp'] = (proj * lookat).astype('f4').tobytes()
            self.prog['Light'] = (-143.438, -159.072, 213.268)
            self.mug_sampler.use()
            self.mug_vao.render()
        with self.ctx.scope(mgl.DEPTH_TEST | mgl.BLEND):
            self.sticker_sampler.use()
            self.sticker_vao.render(mgl.TRIANGLE_STRIP)
github moderngl / moderngl / examples / next / julia_fractal.py View on Github external
def render(self):
        self.ctx.screen.viewport = self.wnd.viewport
        self.ctx.clear(1.0, 1.0, 1.0)

        self.prog['Center'] = (0.49, 0.32)
        self.prog['Iter'] = 100

        self.vao.render(mgl.TRIANGLE_STRIP)
github moderngl / moderngl / examples / next / mug_mockup.py View on Github external
with self.ctx.scope(mgl.DEPTH_TEST):

            proj = Matrix44.perspective_projection(30.0, self.wnd.ratio, 1.0, 1000.0)
            lookat = Matrix44.look_at(
                (46.748, -280.619, 154.391),
                (-23.844, 2.698, 44.493),
                (0.0, 0.0, 1.0),
            )

            self.prog['Mvp'] = (proj * lookat).astype('f4').tobytes()
            self.prog['Light'] = (-143.438, -159.072, 213.268)
            self.mug_sampler.use()
            self.mug_vao.render()
        with self.ctx.scope(mgl.DEPTH_TEST | mgl.BLEND):
            self.sticker_sampler.use()
            self.sticker_vao.render(mgl.TRIANGLE_STRIP)