Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entity canvas materials don't behave as expected #2821

Closed
mramato opened this issue Jun 18, 2015 · 1 comment · Fixed by #2850
Closed

Entity canvas materials don't behave as expected #2821

mramato opened this issue Jun 18, 2015 · 1 comment · Fixed by #2850

Comments

@mramato
Copy link
Contributor

mramato commented Jun 18, 2015

In the below code, both polygons end up yellow, rather than one yell and one red.

var viewer = new Cesium.Viewer('cesiumContainer');

var canvas1 = document.createElement('canvas');
canvas1.height = 100;
canvas1.width = 100;
var context = canvas1.getContext('2d');
context.rect(0,0,100,100);
context.fillStyle = 'red';
context.fill();

var canvas2 = document.createElement('canvas');
canvas2.height = 100;
canvas2.width = 100;
var context2 = canvas2.getContext('2d');
context2.rect(0,0,100,100);
context2.fillStyle = 'yellow';
context2.fill();

viewer.entities.add({
    polygon : {
        hierarchy : Cesium.Cartesian3.fromDegreesArray([-115.0, 37.0,
                                                        -115.0, 32.0,
                                                        -107.0, 33.0,
                                                        -102.0, 31.0,
                                                        -102.0, 35.0]),
        material : canvas1
    }
});

viewer.entities.add({
    polygon : {
        hierarchy : Cesium.Cartesian3.fromDegreesArray([-30.0, 37.0,
                                                        -20.0, 32.0,
                                                        -10.0, 33.0]),
        material : canvas2
    }
});

viewer.zoomTo(viewer.entities);
@mramato
Copy link
Contributor Author

mramato commented Jun 18, 2015

Forgot to link to the forum post where this was reported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant