View Single Post
  #2  
Old 03-20-2015, 10:53 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
By default, textures are resized to a power of two. You can use the texture.hint command with the viz.ALLOW_NPOT_TEXTURE_HINT flag to allow non-power-of-two textures if supported by your graphics card. Also, make sure to scale the texture quad to match the aspect ration of the texture:

Code:
import viz
viz.go()

#Print maximum 2D texture dimension supported by GPU driver 
print viz.getOption('gl.max_texture_size')

quad = viz.addTexQuad(pos=[0,1.8,3])
#Picture has aspect ration of 1.333 so scale quad to match
quad.setScale([1.333,1,1])

texture = viz.addTexture('image.JPG')
texture.hint(viz.ALLOW_NPOT_TEXTURE_HINT)
quad.texture(texture)
Reply With Quote