question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to maintain aspect ratio of texture

See original GitHub issue

When rendering a image as a texture to a surface, I’ve noticed that the aspect ratio is off. How do I preserve the aspect ratio?

I’ve defined my surface as follows:

<Surface ref={(img) => { this.img = img; }}
   width={Dimensions.get('window').width}
   height={310}>
  {activeFilter}
</Surface>

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
grecommented, Jun 21, 2016

another alternative syntax is:

const Mix2 = GL.createComponent( ({ children: [from, to], mix }) => ... );
<Mix2 mix={0.5}>
  <GLImage source={image1source} />
  <GLImage source={image2source} />
</Mix2>

but it’s up to you 😉

0reactions
dcworldwidecommented, Jun 25, 2016

This worked perfectly for my use case, it’s awesome work thanks again.

I used this technique:

<Mix2
  from={  <GLImage source={image1source} />  }
  to={  <GLImage source={image2source} />  }
  mix={0.5}
/>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Keeping Aspect ratio when applying a download texture to a ...
Hello, I download different textures (like profile pictures) from server and apply it to a plane. However, the textures have different sizes ...
Read more >
Maintain aspect on Three.js texture - Stack Overflow
I hope I got you correctly, here is an option of how you can center it: var scene = new THREE.Scene(); var camera...
Read more >
Creating a UV mapping that maintains the input texture aspect ...
To give a possible answer to the question on how to maintain aspect ratio of the texture asked on the Rhino Discourse ...
Read more >
Aspect Ratio Fitter - Unity - Manual
The Aspect Ratio Fitter functions as a layout controller that controls the size of its own layout element. It can adjust the height...
Read more >
Texture aspect ratios - Second Life Wiki
To get the aspect ratio of a prim, right-click it and select Edit from the pie menu, click the Object tab, then observe...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found