Skip to content

Commit 66de18d

Browse files
author
mlarghydracept
committed
Merge remote-tracking branch 'processing/master' into webgl-shape-texture
2 parents a191bb8 + 6ff044d commit 66de18d

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

src/image/loading_displaying.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,8 @@ p5.prototype.image =
198198
var defH = img.height;
199199

200200
if (img.elt && img.elt.videoWidth && !img.canvas) { // video no canvas
201-
var actualW = img.elt.videoWidth;
202-
var actualH = img.elt.videoHeight;
203201
defW = img.elt.videoWidth;
204-
defH = img.elt.width*actualH/actualW;
202+
defH = img.elt.videoHeight;
205203
}
206204

207205
var _dx = dx;
@@ -222,11 +220,17 @@ p5.prototype.image =
222220
// and https://github.com/processing/p5.js/issues/1673
223221
var pd = 1;
224222

225-
if (img.elt && img.elt.videoWidth && img.elt.style.width && !img.canvas) {
226-
pd = img.elt.videoWidth / parseInt(img.elt.style.width, 10);
227-
}
228-
else if (img.elt && img.elt.width && img.elt.style.width) {
229-
pd = img.elt.width / parseInt(img.elt.style.width, 10);
223+
if (img.elt && !img.canvas && img.elt.style.width) {
224+
//if img is video and img.elt.size() has been used and
225+
//no width passed to image()
226+
if(img.elt.videoWidth && !dWidth){
227+
pd = img.elt.videoWidth;
228+
}
229+
//all other cases
230+
else {
231+
pd = img.elt.width;
232+
}
233+
pd /= parseInt(img.elt.style.width, 10);
230234
}
231235

232236
_sx *= pd;

src/webgl/material.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var p5 = require('../core/core');
1313
/**
1414
* Normal material for geometry. You can view all
1515
* possible materials in this
16-
* <a href="https://http://p5js.org/examples/3d-materials.html">example</a>.
16+
* <a href="https://p5js.org/examples/3d-materials.html">example</a>.
1717
* @method normalMaterial
1818
* @return {p5} the p5 object
1919
* @example
@@ -42,7 +42,7 @@ p5.prototype.normalMaterial = function(){
4242

4343
/**
4444
* Texture for geometry. You can view other possible materials in this
45-
* <a href="https://http://p5js.org/examples/3d-materials.html">example</a>.
45+
* <a href="https://p5js.org/examples/3d-materials.html">example</a>.
4646
* @method texture
4747
* @param {p5.Image | p5.MediaElement | p5.Graphics} tex 2-dimensional graphics
4848
* to render as texture
@@ -215,7 +215,7 @@ p5.RendererGL.prototype._bind = function(tex, data){
215215
/**
216216
* Ambient material for geometry with a given color. You can view all
217217
* possible materials in this
218-
* <a href="https://http://p5js.org/examples/3d-materials.html">example</a>.
218+
* <a href="https://p5js.org/examples/3d-materials.html">example</a>.
219219
* @method ambientMaterial
220220
* @param {Number|Array|String|p5.Color} v1 gray value,
221221
* red or hue value (depending on the current color mode),
@@ -269,7 +269,7 @@ p5.prototype.ambientMaterial = function(v1, v2, v3, a) {
269269
/**
270270
* Specular material for geometry with a given color. You can view all
271271
* possible materials in this
272-
* <a href="https://http://p5js.org/examples/3d-materials.html">example</a>.
272+
* <a href="https://p5js.org/examples/3d-materials.html">example</a>.
273273
* @method specularMaterial
274274
* @param {Number|Array|String|p5.Color} v1 gray value,
275275
* red or hue value (depending on the current color mode),

0 commit comments

Comments
 (0)