Hi everybody, i’m a new user of webGl and while i was working i found this interesting and tried to do but it doesn’t work.
well this is my question:
I have this part of code i think that the calling is correct, the first time i load the page it uses to appear the image selected by default but when i select the other image this doesn’t appear, besides the default image never change (disappear or something so ) that makes me think that the call is not even working.
Maybe i have to create another method or something like that? another kind of call? or i am forgetting something?
in my list i have two options exactly 1 and 2.
i based on the calling for textures that works well.
function x() {
var obj = document.getElementById(“objs”).value;
if (obj == "1") {
var request = new XMLHttpRequest();
request.open("GET", "obj1.json");
request.onreadystatechange = function () {
if (request.readyState == 4) {
handleLoadedTeapot(JSON.parse(request.responseText));
}
}
request.send();
} else if (obj == "2") {
var request = new XMLHttpRequest();
request.open("GET", "obj2.json");
request.onreadystatechange = function () {
if (request.readyState == 4) {
handleLoadedTeapot(JSON.parse(request.responseText));
}
}
request.send();
}
}
If you know another method for calling different json files in the same window or give me an idea of what should i do i would thank you.
bye.