WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 06-10-2012, 07:35 AM
rlh001 rlh001 is offline
Member
 
Join Date: Mar 2011
Posts: 18
automatic scaling

I am applying a picture to a textQuad. When I click the window to full screen the picture distorts. I would like to find a way to have the picture retain the same aspect ratio regardless of window size. Thanks
Reply With Quote
  #2  
Old 06-11-2012, 05:10 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Can you post the code you are using to create the tex quad?
Reply With Quote
  #3  
Old 06-13-2012, 05:25 AM
rlh001 rlh001 is offline
Member
 
Join Date: Mar 2011
Posts: 18
The Vizard window opens at 800 x 600 pixels and the image looks proportioned properly. When I Maximize the window the image is distorted unless I change the scaling with the code below, but then it distorts the image when the window is not maximized. I need to have the image appear undistorted regardless of window sizing. Thanks

##Add Instrument Cluster Image to Screen
clusterTex = viz.addTexture('resources\ClusterGraphics.png')
clusterQuad = viz.addTexQuad(viz.SCREEN)
clusterQuad.texture(clusterTex)
# Increase size of image
clusterScale = 2.75
#Modify Aspect ratio to look correct when changed to full screen
clusterAspectRatio= 1.75 # full screen 1280:800
clusterQuad.setScale(clusterScale * clusterAspectRatio, clusterScale )
Reply With Quote
  #4  
Old 06-14-2012, 12:34 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Add the quad to viz.ORTHO instead of viz.SCREEN. Objects added to viz.ORTHO will maintain the same pixel size and aspect ratio, regardless of the window size. The scale and position of the object will need to be specified in pixels though.
Code:
clusterTex = viz.addTexture('resources\ClusterGraphics.png') 
clusterQuad = viz.addTexQuad(parent=viz.ORTHO)
clusterQuad.texture(clusterTex)

# Set size of quad to size of texture
clusterQuad.setScale(clusterTex.getSize())
Reply With Quote
  #5  
Old 06-17-2012, 04:39 AM
rlh001 rlh001 is offline
Member
 
Join Date: Mar 2011
Posts: 18
Thanks for the tip. I changed the image to ortho and it looks good. However, since clusterQuad.setPosition is now specified in pixels if I set it up to be in the center of the screen and then run it on a different size display it is no longer in the center. I need to be able to specify position in fraction of widow size.


clusterTex = viz.addTexture('resources\ClusterGraphics.png')
clusterQuad = viz.addTexQuad(parent=viz.ORTHO, size = .5)
clusterQuad.texture(clusterTex)
clusterQuad.setScale(clusterTex.getSize())
clusterQuad.setPosition(640,84)
Reply With Quote
  #6  
Old 06-18-2012, 09:31 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
You can use the following code to link the quad to the center of the main window:
Code:
viz.link(viz.MainWindow.CenterCenter,clusterQuad)
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Scaling Portions of a CAL3D Model shivanangel Vizard 2 07-26-2012 12:17 AM
Scaling movement through the virtual environment miles Vizard 9 03-24-2011 12:26 PM
Scaling Avatars and Setting Bone Positions awstorer Vizard 0 11-17-2010 07:51 AM
collission and scaling of objects Johannes Vizard 28 02-08-2005 10:08 AM
texture scaling Johannes Vizard 3 01-25-2005 10:28 AM


All times are GMT -7. The time now is 10:41 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC