关于texture filter mode.

以下为引用http://answers.unity3d.com/questions/468376/what-is-the-difference-between-bilinear-and-trilin.html中的相关讨论总结

"

for textures viewed at an oblique angle, high levels of anisotropic filtering are recommended. With bilinear filtering only, for example, if you slowly approached a vertical wall that's initially off in the distance, you would see the different mipmap levels suddenly change as you got closer. This is especially noticeable with normal maps. With trilinear filtering, the mipmap levels are blended, so it's a smooth transition instead."

另外GUI 的TEXTURE没有MIPMAP。

转载于:https://www.cnblogs.com/nihil/p/3956636.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
import pygame from OpenGL.GL import * from OpenGL.GLU import * def load_obj(filename): vertices = [] faces = [] texcoords = [] with open(filename, 'r') as f: for line in f: if line.startswith('#'): continue values = line.split() if not values: continue if values[0] == 'v': if len(values) == 4: vertices.append(list(map(float, values[1:4]))) elif len(values) == 3: texcoords.append(list(map(float, values[1:3]))) elif values[0] == 'f': face = [] texcoord_face = [] for face_str in values[1:]: vertex_index, texcoord_index, _ = face_str.split('/') face.append(int(vertex_index)) texcoord_face.append(int(texcoord_index)) faces.append(face) texcoords.append(texcoord_face) return vertices, faces, texcoords def draw_obj(filename, tex_id): vertices, faces, texcoords = load_obj(filename) glBindTexture(GL_TEXTURE_2D, tex_id) glBegin(GL_TRIANGLES) for face, texcoord_face in zip(faces, texcoords): for vertex_index, texcoord_index in zip(face, texcoord_face): glVertex3fv(vertices[vertex_index - 1]) glTexCoord2fv(texcoords[texcoord_index - 1]) glEnd() pygame.init() display = (800, 600) pygame.display.set_mode(display, pygame.DOUBLEBUF | pygame.OPENGL) gluPerspective(45, (display[0]/display[1]), 0.1, 50.0) glTranslatef(0.0, 0.0, -5) tex_surface = pygame.image.load('texture.jpg') tex_data = pygame.image.tostring(tex_surface, 'RGB', 1) tex_id = glGenTextures(1) glBindTexture(GL_TEXTURE_2D, tex_id) glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, tex_surface.get_width(), tex_surface.get_height(), 0, GL_RGB, GL_UNSIGNED_BYTE, tex_data) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) while True: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() quit() glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT) draw_obj('model.obj', tex_id) pygame.display.flip() pygame.time.wait(10)
06-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值