Ejemplo n.º 1
0
    def on_draw():
        # render passes
        gBuffer = geometry_pass.render(scene.find_meshes(), viewer.camera)
        gPosition, gNormal, gAlbedo, gEmission, gRoughness, gMetallic = gBuffer

        # render passes to screen
        glDisable(GL_DEPTH_TEST)
        glDisable(GL_CULL_FACE)
        # glEnable(GL_BLEND)
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
        glClearColor(0.5,0.5,0.5,0)
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)

        checkerboard_program = puregl.program.create(
            """#version 330 core
            layout (location=0) in vec3 position;
            layout (location=1) in vec2 uv;
            out vec2 TexCoords;
            void main(){
                TexCoords = uv;
                gl_Position = vec4(position,1.0);
            }
            """,
            """#version 330 core
            in vec2 TexCoords;
            out vec4 FragColor;
            uniform float size;
            uniform vec2 viewportSize;
            float checker(vec2 uv, vec2 repeats){
                float cx = floor(repeats.x * uv.x);
                float cy = floor(repeats.y * uv.y);
                float result = mod(cx + cy, 2.0);
                return sign(result);
            }

            void main(){
                vec4 colorA = vec4(0.6,0.6,0.6,0.5);
                vec4 colorB = vec4(0.4,0.4,0.4,0.5);
                FragColor = mix(colorA, colorB, checker(TexCoords, viewportSize/size));
            }
            """)
        with puregl.program.use(checkerboard_program):
            puregl.program.set_uniform(checkerboard_program, "viewportSize", (viewer.width, viewer.height))
            puregl.program.set_uniform(checkerboard_program, "size", 8.0)
            imdraw.quad(checkerboard_program)

        imdraw.texture(gPosition, (20, 20, viewer.width-40, viewer.height-40), shuffle=(0, 1, 2, 3))

        #
        imdraw.texture(gPosition, (0,0,190, 190), shuffle=(0,1,2,3))
        imdraw.texture(gNormal, (200,0,190, 190), shuffle=(0,1,2,-1))
        imdraw.texture(gAlbedo, (400,0,190, 190), shuffle=(0,1,2,-1))
        imdraw.texture(gEmission, (600,0,190, 190))
        imdraw.texture(gRoughness, (800,0,190, 190), shuffle=(0,0,0,-1))
        imdraw.texture(gMetallic, (1000,0,190, 190), shuffle=(0,0,0,-1))

        imdraw.texture(geometry_pass.gDepth, (  0, 200, 190, 190), shuffle=(0, 0, 0, -1))
Ejemplo n.º 2
0
    def render(self):
        super().render()
        # re-configure capture framebuffer object and render screen-space quad with BRDF shader.
        with puregl.program.use(self.program):
            with puregl.fbo.bind(self.fbo):
                glViewport(0, 0, self.width, self.height)
                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
                imdraw.quad(self.program)

        return self.brdflut
Ejemplo n.º 3
0
    def render(self, input_texture):
        super().render()
        with puregl.fbo.bind(self.fbo), puregl.program.use(self.program):
            # clear fbo
            glViewport(0, 0, self.width, self.height)
            glClearColor(0.0, 0.0, 0.0, 0.0)
            glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)

            # configure shader

            # draw
            imdraw.quad(self.program)
        return self.texture
Ejemplo n.º 4
0
    def render(self, hdrimage, exposure, gamma):
        super().render()
        with puregl.fbo.bind(self.fbo), puregl.program.use(self.program) as prog:
            glViewport(0, 0, self.width, self.height)
            glClearColor(0, 0, 0, 0)
            glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)

            glActiveTexture(GL_TEXTURE0 + 0)
            glBindTexture(GL_TEXTURE_2D, hdrimage)

            puregl.program.set_uniform(prog, 'screenTexture', 0)
            puregl.program.set_uniform(prog, 'bloomBlur', 1)
            puregl.program.set_uniform(prog, 'exposure', exposure)
            puregl.program.set_uniform(prog, 'gamma', gamma)

            imdraw.quad(prog)

        return self.texture
Ejemplo n.º 5
0
	def render(self, input_texture, minimum, maximum):
		super().render()
		glCullFace(GL_BACK)
		glDisable(GL_DEPTH_TEST)
		with puregl.fbo.bind(self.fbo), puregl.program.use(self.program) as prog:
			glViewport(0,0,self.width, self.height)
			glClearColor(0,0,0,0)
			glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)

			glActiveTexture(GL_TEXTURE0+0)
			glBindTexture(GL_TEXTURE_2D, input_texture)

			puregl.program.set_uniform(prog, 'screenTexture', 0)
			puregl.program.set_uniform(prog, 'minimum', float(minimum))
			puregl.program.set_uniform(prog, 'maximum', float(maximum))

			imdraw.quad(prog)

		return self.output_texture
Ejemplo n.º 6
0
    def render(self, inputA, inputB):
        super().render()
        glCullFace(GL_BACK)
        glDisable(GL_DEPTH_TEST)
        with puregl.fbo.bind(self.fbo), puregl.program.use(
                self.program) as prog:
            glViewport(0, 0, self.width, self.height)
            glClearColor(0, 0, 0, 0)
            glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)

            glActiveTexture(GL_TEXTURE0 + 0)
            glBindTexture(GL_TEXTURE_2D, inputA)
            glActiveTexture(GL_TEXTURE0 + 1)
            glBindTexture(GL_TEXTURE_2D, inputB)

            puregl.program.set_uniform(prog, 'inputA', 0)
            puregl.program.set_uniform(prog, 'inputB', 1)

            imdraw.quad(prog)

        return self.output_texture
Ejemplo n.º 7
0
    def render(self, input_texture, iterations=2):
        super().render()

        horizontal = True
        first_iteration = True
        with puregl.program.use(self.program):
            for i in range(iterations * 2):
                horizontal = i % 2
                glBindFramebuffer(GL_FRAMEBUFFER,
                                  self.bloom_blur_fbos[horizontal])
                glClearColor(0.0, 0.0, 0.0, 1.0)
                puregl.program.set_uniform(self.program, 'horizontal',
                                           horizontal)
                glActiveTexture(GL_TEXTURE0)
                glBindTexture(
                    GL_TEXTURE_2D, input_texture if first_iteration else
                    self.bloom_blur_texs[1 - horizontal])
                imdraw.quad(self.program)
                if first_iteration:
                    first_iteration = False

        glBindFramebuffer(GL_FRAMEBUFFER, 0)

        return self.bloom_blur_texs[1]
Ejemplo n.º 8
0
    def render(self, matcap, gPosition, gNormal, camera):
        super().render()
        with puregl.fbo.bind(self.fbo), puregl.program.use(self.program):
            # clear fbo
            glViewport(0, 0, self.width, self.height)
            glClearColor(0.0, 0.0, 0.0, 0.0)
            glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)

            # configure shader
            glActiveTexture(GL_TEXTURE1)
            glBindTexture(GL_TEXTURE_2D, gPosition)
            puregl.program.set_uniform(self.program, "gPosition", 0)
            glActiveTexture(GL_TEXTURE1)
            glBindTexture(GL_TEXTURE_2D, gNormal)
            puregl.program.set_uniform(self.program, "gNormal", 1)
            glActiveTexture(GL_TEXTURE2)
            glBindTexture(GL_TEXTURE_2D, matcap)
            puregl.program.set_uniform(self.program, "matcap", 2)
            puregl.program.set_uniform(self.program, "camPos", camera.position)

            # draw
            imdraw.quad(self.program)
            glBindTexture(GL_TEXTURE_2D, 0)
        return self.texture
Ejemplo n.º 9
0
                program.set_uniform(ssao_program, 'projection',
                                    window.projection_matrix)
                program.set_uniform(
                    ssao_program, 'viewProjectionMatrix',
                    window.projection_matrix * window.view_matrix)

                glActiveTexture(GL_TEXTURE0 + 0)
                glBindTexture(GL_TEXTURE_2D, gPosition)
                glActiveTexture(GL_TEXTURE0 + 1)
                glBindTexture(GL_TEXTURE_2D, gNormal)
                glActiveTexture(GL_TEXTURE0 + 2)
                glBindTexture(GL_TEXTURE_2D, noise_texture)

                program.set_uniform(ssao_program, 'gPosition', 0)
                program.set_uniform(ssao_program, 'gNormal', 1)
                program.set_uniform(ssao_program, 'texNoise', 2)

                imdraw.quad(ssao_program)

        # with fbo.bind(ssao_blur_fbo):
        # 	with program.use(ssao_blur_program):
        # 		glActiveTexture(GL_TEXTURE0+0)
        # 		glBindTexture(GL_TEXTURE_2D, ssao_tex)
        # 		program.set_uniform(ssao_blur_program, 'ssaoInput', 0)
        # 		imdraw.quad(ssao_blur_program)

        imdraw.texture(ssao_tex, (0, 0, window.width, window.height),
                       shuffle=(0, 0, 0, -1))

        window.swap_buffers()
        GLFWViewer.poll_events()
Ejemplo n.º 10
0
    def render(self, gBuffer, environment, iblBuffer, camera, lights):
        super().render()
        with puregl.fbo.bind(self.fbo), puregl.program.use(
                self.program) as prog:
            glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
            # camera
            puregl.program.set_uniform(prog, "projection", glm.mat4(1))
            puregl.program.set_uniform(prog, "view", glm.mat4(1))
            puregl.program.set_uniform(prog, "cameraPos", camera.position)

            # lights
            point_lights = [
                light for light in lights if isinstance(light, PointLight)
            ]
            spot_lights = [
                light for light in lights if isinstance(light, SpotLight)
            ]
            dir_lights = [
                light for light in lights
                if isinstance(light, DirectionalLight)
            ]
            puregl.program.set_uniform(prog, "num_point_lights",
                                       len(point_lights))
            puregl.program.set_uniform(prog, "num_spot_lights",
                                       len(spot_lights))
            puregl.program.set_uniform(prog, "num_dir_lights", len(dir_lights))
            active_texture = 0
            # set each light uniforms
            for i, light in enumerate(point_lights):
                # light params
                puregl.program.set_uniform(prog,
                                           "point_lights[{}].color".format(i),
                                           light.color)
                puregl.program.set_uniform(
                    prog, "point_lights[{}].intensity".format(i),
                    light.intensity)
                puregl.program.set_uniform(
                    prog, "point_lights[{}].position".format(i),
                    light.position)

                # shadowmap
                glActiveTexture(GL_TEXTURE0 + active_texture)
                glBindTexture(GL_TEXTURE_CUBE_MAP, light.shadowmap.texture)
                puregl.program.set_uniform(
                    prog, "point_lights[{}].shadowCube".format(i),
                    active_texture)
                puregl.program.set_uniform(
                    prog, "point_lights[{}].farPlane".format(i),
                    float(light.far))
                active_texture += 1

            for i, light in enumerate(spot_lights):
                # light params
                puregl.program.set_uniform(prog,
                                           "spot_lights[{}].color".format(i),
                                           light.color)
                puregl.program.set_uniform(
                    prog, "spot_lights[{}].intensity".format(i),
                    light.intensity)
                puregl.program.set_uniform(
                    prog, "spot_lights[{}].position".format(i), light.position)
                puregl.program.set_uniform(
                    prog, "spot_lights[{}].direction".format(i),
                    light.direction)
                puregl.program.set_uniform(prog,
                                           "spot_lights[{}].cutOff".format(i),
                                           light.cut_off)

                # shadowmap
                glActiveTexture(GL_TEXTURE0 + active_texture)
                glBindTexture(GL_TEXTURE_2D, light.shadowmap.texture)
                puregl.program.set_uniform(
                    prog, "spot_lights[{}].shadowMap".format(i),
                    active_texture)
                puregl.program.set_uniform(
                    prog, "spot_lights[{}].matrix".format(i),
                    light.camera.projection * light.camera.view)
                active_texture += 1

            for i, light in enumerate(dir_lights):
                # light params
                puregl.program.set_uniform(prog,
                                           "dir_lights[{}].color".format(i),
                                           light.color)
                puregl.program.set_uniform(
                    prog, "dir_lights[{}].intensity".format(i),
                    light.intensity)
                puregl.program.set_uniform(
                    prog, "dir_lights[{}].direction".format(i),
                    light.direction)

                # shadowmap
                glActiveTexture(GL_TEXTURE0 + active_texture)
                glBindTexture(GL_TEXTURE_2D, light.shadowmap.texture)
                puregl.program.set_uniform(
                    prog, "dir_lights[{}].shadowMap".format(i), active_texture)
                puregl.program.set_uniform(
                    prog, "dir_lights[{}].matrix".format(i),
                    light.camera.projection * light.camera.view)
                active_texture += 1

            # Set Geometry Buffer
            gPosition, gNormal, gDepth, gObjectId, gAlbedo, gEmission, gRoughness, gMetallic = gBuffer
            glActiveTexture(GL_TEXTURE0 + active_texture)
            glBindTexture(GL_TEXTURE_2D, gPosition)
            puregl.program.set_uniform(prog, "gPosition", active_texture)
            active_texture += 1

            glActiveTexture(GL_TEXTURE0 + active_texture)
            glBindTexture(GL_TEXTURE_2D, gNormal)
            puregl.program.set_uniform(prog, "gNormal", active_texture)
            active_texture += 1

            glActiveTexture(GL_TEXTURE0 + active_texture)
            glBindTexture(GL_TEXTURE_2D, gDepth)
            puregl.program.set_uniform(prog, "gDepth", active_texture)
            active_texture += 1

            glActiveTexture(GL_TEXTURE0 + active_texture)
            glBindTexture(GL_TEXTURE_2D, gObjectId)
            puregl.program.set_uniform(prog, "gObjectId", active_texture)
            active_texture += 1

            glActiveTexture(GL_TEXTURE0 + active_texture)
            glBindTexture(GL_TEXTURE_2D, gAlbedo)
            puregl.program.set_uniform(prog, "gAlbedo", active_texture)
            active_texture += 1

            glActiveTexture(GL_TEXTURE0 + active_texture)
            glBindTexture(GL_TEXTURE_2D, gEmission)
            puregl.program.set_uniform(prog, "gEmission", active_texture)
            active_texture += 1

            glActiveTexture(GL_TEXTURE0 + active_texture)
            glBindTexture(GL_TEXTURE_2D, gRoughness)
            puregl.program.set_uniform(prog, "gRoughness", active_texture)
            active_texture += 1

            glActiveTexture(GL_TEXTURE0 + active_texture)
            glBindTexture(GL_TEXTURE_2D, gMetallic)
            puregl.program.set_uniform(prog, "gMetallic", active_texture)
            active_texture += 1

            # set IBL buffers
            glActiveTexture(GL_TEXTURE0 + active_texture)
            glBindTexture(GL_TEXTURE_CUBE_MAP, environment)
            puregl.program.set_uniform(prog, "environmentMap", active_texture)
            active_texture += 1

            irradianceMap, prefilterMap, brdfLUT = iblBuffer
            glActiveTexture(GL_TEXTURE0 + active_texture)
            glBindTexture(GL_TEXTURE_CUBE_MAP, irradianceMap)
            puregl.program.set_uniform(prog, "irradianceMap", active_texture)
            active_texture += 1

            glActiveTexture(GL_TEXTURE0 + active_texture)
            glBindTexture(GL_TEXTURE_CUBE_MAP, prefilterMap)
            puregl.program.set_uniform(prog, "prefilterMap", active_texture)
            active_texture += 1

            glActiveTexture(GL_TEXTURE0 + active_texture)
            glBindTexture(GL_TEXTURE_2D, brdfLUT)
            puregl.program.set_uniform(prog, "brdfLUT", active_texture)
            active_texture += 1

            puregl.program.set_uniform(prog, "cameraProjection",
                                       camera.projection)
            puregl.program.set_uniform(prog, "cameraView", camera.view)

            # draw quad
            puregl.program.set_uniform(prog, "model", glm.mat4(1))
            imdraw.quad(prog)

            # # draw each geometry
            # for mesh in scene.meshes():
            #     puregl.program.set_uniform(prog, "model", mesh.transform)
            #     puregl.program.set_uniform(prog, "material.albedo", mesh.material.albedo)
            #     puregl.program.set_uniform(prog, "material.emission", mesh.material.emission)
            #     puregl.program.set_uniform(prog, "material.roughness", mesh.material.roughness)
            #     puregl.program.set_uniform(prog, "material.metallic", mesh.material.metallic)
            #     mesh.geometry._draw(prog)

        return self.texture
Ejemplo n.º 11
0
    def render(self, cameraPos, lights, gBuffer, irradiance, prefilter, brdf):
        super().render()
        gPosition, gNormal, gAlbedo, gEmissive, gRoughness, gMetallic = gBuffer
        with puregl.fbo.bind(self.fbo), puregl.program.use(self.program):
            # clear fbo
            glViewport(0, 0, self.width, self.height)
            glClearColor(0.3, 0.3, 0.3, 1.0)
            glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)

            # configure shader
            puregl.program.set_uniform(self.program, "numLights", len(lights))
            puregl.program.set_uniform(self.program, "cameraPos", cameraPos)

            glActiveTexture(GL_TEXTURE0 + 0)
            glBindTexture(GL_TEXTURE_2D, gPosition)
            puregl.program.set_uniform(self.program, "gPosition", 0)

            glActiveTexture(GL_TEXTURE0 + 1)
            glBindTexture(GL_TEXTURE_2D, gNormal)
            puregl.program.set_uniform(self.program, "gNormal", 1)

            glActiveTexture(GL_TEXTURE0 + 2)
            glBindTexture(GL_TEXTURE_2D, gAlbedo)
            puregl.program.set_uniform(self.program, "gAlbedoSpecular", 2)

            glActiveTexture(GL_TEXTURE0 + 3)
            glBindTexture(GL_TEXTURE_2D, gRoughness)
            puregl.program.set_uniform(self.program, "gRoughness", 3)

            glActiveTexture(GL_TEXTURE0 + 4)
            glBindTexture(GL_TEXTURE_2D, gMetallic)
            puregl.program.set_uniform(self.program, "gMetallic", 4)

            glActiveTexture(GL_TEXTURE0 + 5)
            glBindTexture(GL_TEXTURE_2D, gEmissive)
            puregl.program.set_uniform(self.program, "gEmissive", 5)

            glActiveTexture(GL_TEXTURE0 + 6)
            glBindTexture(GL_TEXTURE_CUBE_MAP, irradiance)
            puregl.program.set_uniform(self.program, "irradianceMap", 6)

            glActiveTexture(GL_TEXTURE0 + 7)
            glBindTexture(GL_TEXTURE_CUBE_MAP, prefilter)
            puregl.program.set_uniform(self.program, "prefilterMap", 7)

            glActiveTexture(GL_TEXTURE0 + 8)
            glBindTexture(GL_TEXTURE_2D, brdf)
            puregl.program.set_uniform(self.program, "brdfLUT", 8)

            shadowMapIdx, shadowCubeIdx = 0, 0
            for i, light in enumerate(lights):
                slot = 9 + i
                if isinstance(light, DirectionalLight):
                    puregl.program.set_uniform(self.program,
                                               "lights[{}].type".format(i), 0)
                    puregl.program.set_uniform(
                        self.program, "lights[{}].color".format(i),
                        to_linear(light.color) * light.intensity)

                    puregl.program.set_uniform(
                        self.program, "lights[{}].direction".format(i),
                        light.direction)
                    puregl.program.set_uniform(
                        self.program, "lights[{}].shadowIdx".format(i),
                        shadowMapIdx)

                    glActiveTexture(GL_TEXTURE0 + slot)
                    glBindTexture(GL_TEXTURE_2D, light.shadowmap.texture)
                    puregl.program.set_uniform(
                        self.program, "lights[{}].matrix".format(i),
                        light.camera.projection * light.camera.view)
                    puregl.program.set_uniform(
                        self.program, "shadowMaps[{}]".format(shadowMapIdx),
                        slot)
                    shadowMapIdx += 1

                elif isinstance(light, SpotLight):
                    puregl.program.set_uniform(self.program,
                                               "lights[{}].type".format(i), 1)
                    puregl.program.set_uniform(
                        self.program, "lights[{}].color".format(i),
                        to_linear(light.color) * light.intensity)

                    puregl.program.set_uniform(self.program,
                                               "lights[{}].position".format(i),
                                               light.position)
                    puregl.program.set_uniform(
                        self.program, "lights[{}].direction".format(i),
                        light.direction)
                    puregl.program.set_uniform(self.program,
                                               "lights[{}].cutOff".format(i),
                                               light.cut_off)

                    glActiveTexture(GL_TEXTURE0 + slot)
                    glBindTexture(GL_TEXTURE_2D, light.shadowmap.texture)
                    puregl.program.set_uniform(
                        self.program, "lights[{}].matrix".format(i),
                        light.camera.projection * light.camera.view)
                    puregl.program.set_uniform(
                        self.program, "lights[{}].shadowIdx".format(i),
                        shadowMapIdx)
                    puregl.program.set_uniform(
                        self.program, "shadowMaps[{}]".format(shadowMapIdx),
                        slot)
                    shadowMapIdx += 1

                elif isinstance(light, PointLight):
                    puregl.program.set_uniform(self.program,
                                               "lights[{}].type".format(i), 2)
                    puregl.program.set_uniform(
                        self.program, "lights[{}].color".format(i),
                        to_linear(light.color) * light.intensity)
                    puregl.program.set_uniform(self.program,
                                               "lights[{}].position".format(i),
                                               light.position)

                    glActiveTexture(GL_TEXTURE0 + slot)
                    glBindTexture(GL_TEXTURE_CUBE_MAP, light.shadowmap.texture)
                    puregl.program.set_uniform(self.program,
                                               "lights[{}].farPlane".format(i),
                                               float(light.far))
                    puregl.program.set_uniform(
                        self.program, "lights[{}].shadowIdx".format(i),
                        shadowCubeIdx)
                    puregl.program.set_uniform(
                        self.program, "shadowCubes[{}]".format(shadowCubeIdx),
                        slot)
                    shadowCubeIdx += 1

            # draw
            imdraw.quad(self.program)
        return self.texture
Ejemplo n.º 12
0
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)

    # re-configure capture framebuffer object and render screen-space quad with BRDF shader.
    with fbo.bind(capture_fbo):
        glBindRenderbuffer(GL_RENDERBUFFER, capture_rbo)
        glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, 512, 512)
        glBindRenderbuffer(GL_RENDERBUFFER, 0)
        glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
                               GL_TEXTURE_2D, brdfLUTTexture, 0)

    with program.use(brdfShader):
        with fbo.bind(capture_fbo):
            glViewport(0, 0, 512, 512)
            glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
            imdraw.quad(brdfShader)

    # SETUP Post Processing
    # ===============
    gaussianblur_program = program.create(*glsl.read('gaussian'))

    pingpong_fbo = glGenFramebuffers(2)
    pingpong_buffer = glGenTextures(2)
    SCR_WIDTH, SCR_HEIGHT = width, height
    for i in range(2):
        glBindFramebuffer(GL_FRAMEBUFFER, pingpong_fbo[i])
        glBindTexture(GL_TEXTURE_2D, pingpong_buffer[i])
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, SCR_WIDTH, SCR_HEIGHT, 0,
                     GL_RGBA, GL_FLOAT, None)
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)