Learning WebGL and three.js

I'm new and starting to learn about 3D computer graphics in web browsers. I'm interested in making 3D games in a browser. For anyone who has learned both WebGL and three.js...

I'm new and starting to learn about 3D computer graphics in web browsers. I'm interested in making 3D games in a browser. For anyone who has learned both WebGL and three.js...

  1. Is knowledge of WebGL required to use three.js?
  2. What are the advantages of using three.js vs. WebGL?


Why my window resize event listener doesn't work? Using Three.js and Vuetify.js

I am putting a three.js renderer inside of a , using vuetify.js framework. What I would like my code to do is to change the div element dimensions whenever the window is resized.

I am putting a three.js renderer inside of a , using vuetify.js framework. What I would like my code to do is to change the div element dimensions whenever the window is resized.

This is part of my project and I omitted unnecessary code blocks, so don't mind the not used variables :)

<style scoped>
.map__three {
  position: absolute;
  bottom: 60px;
  left: 0px;
}
</style>

<template>
<div class="flex fill-height wrap">
<v-btn></v-btn>
<div id="map" class="flex fill-height wrap" v-on:dblclick="addNewPoi3d"></div>
</div>
</template>

<script>

export default {
name: 'ThreeTest',
data() {
return {
scene: null,
renderer: null,
camera: null,
mouse: null,
mousePosition: new THREE.Vector2(),
canvasPosition: null,
rayCaster: new THREE.Raycaster(),
mapWidth: null,
mapHeight: null,
mapDimensions: null
};
},

methods: {
init() {
let map = document.getElementById('map');
this.mapDimensions = map.getBoundingClientRect();
this.mapWidth = this.mapDimensions.width;
this.mapHeight = this.mapDimensions.height;
this.scene = new THREE.Scene();
this.scene.background = new THREE.Color( 0xf0f0f0 );

  this.camera = new THREE.PerspectiveCamera(
    75,
    this.mapWidth/this.mapHeight,
    0.1,
    1000,
  );
  this.camera.position.z = 3;


  this.renderer = new THREE.WebGLRenderer();
  this.renderer.setSize(this.mapWidth, this.mapHeight);
  map.appendChild(this.renderer.domElement);



  // EVENT LISTENERS:
  window.addEventListener('resize', this.onWindowResize, false);
},


onWindowResize()  {
    this.camera.aspect = this.mapWidth / this.mapHeight;
    this.camera.updateProjectionMatrix();
    this.renderer.setSize(this.mapWidth, this.mapHeight);
},



animate() {
  requestAnimationFrame(this.animate);
  this.render();
},
render() {
  this.renderer.render(this.scene, this.camera);
},

},

mounted() {
this.init();
this.animate();
}
};
</script>

EXPECTED: it should resize the dimensions of the scene and camera aspect ratio I've loaded in.

WHAT IT DOES: none of that :D It pertains the same size of the scene and camera.

Top Vue.js Developers in USA

Top Vue.js Developers in USA

Vue.js is an extensively popular JavaScript framework with which you can create powerful as well as interactive interfaces. Vue.js is the best framework when it comes to building a single web and mobile apps.

We, at HireFullStackDeveloperIndia, implement the right strategic approach to offer a wide variety through customized Vue.js development services to suit your requirements at most competitive prices.

Vue.js is an open-source JavaScript framework that is incredibly progressive and adoptive and majorly used to build a breathtaking user interface. Vue.js is efficient to create advanced web page applications.

Vue.js gets its strength from the flexible JavaScript library to build an enthralling user interface. As the core of Vue.js is concentrated which provides a variety of interactive components for the web and gives real-time implementation. It gives freedom to developers by giving fluidity and eases the integration process with existing projects and other libraries that enables to structure of a highly customizable application.

Vue.js is a scalable framework with a robust in-build stack that can extend itself to operate apps of any proportion. Moreover, vue.js is the best framework to seamlessly create astonishing single-page applications.

Our Vue.js developers have gained tremendous expertise by delivering services to clients worldwide over multiple industries in the area of front-end development. Our adept developers are experts in Vue development and can provide the best value-added user interfaces and web apps.

We assure our clients to have a prime user interface that reaches end-users and target the audience with the exceptional user experience across a variety of devices and platforms. Our expert team of developers serves your business to move ahead on the path of success, where your enterprise can have an advantage over others.

Here are some key benefits that you can avail when you decide to hire vue.js developers in USA from HireFullStackDeveloperIndia:

  • A team of Vue.js developers of your choice
  • 100% guaranteed client satisfaction
  • Integrity and Transparency
  • Free no-obligation quote
  • Portal development solutions
  • Interactive Dashboards over a wide array of devices
  • Vue.js music and video streaming apps
  • Flexible engagement model
  • A free project manager with your team
  • 24*7 communication with your preferred means

If you are looking to hire React Native developers in USA, then choosing HireFullStackDeveloperIndia would be the best as we offer some of the best talents when it comes to Vue.js.

The Three.js tag has really bad questions

The distribution of&nbsp;<a href="https://stackoverflow.com/questions/tagged/three.js" target="_blank">three.js</a>&nbsp;tagged question is something like this:

The distribution of three.js tagged question is something like this:

1 x

super clear, graphics / WebGL / GLSL / JavaScript related question for the library, that makes sense, is properly formatted and helps the community.

19 x

confusing, lazy, ill-formatted questions that make no sense, and are often not even remotely three.js related (basic JavaScript or DOM)

What can be done to remedy this?

I notice a lot of the questions simply go unanswered. Some do get downvoted though.

I find myself writing more comments than answers lately. Sometimes I link to MCVE, and sometimes I explain why the question is not three.js-related and remove the tags.

Other times, users accept answers that are wrong. They ask one question, but within there's a different problem hidden. The accepted answer usually focuses on the problem, rather than the question. This is when I usually suggest to edit the question, but some times I urged for the different answers to be accepted.

It doesn't seem that there are too many people responding to three.js, and I'm also under the impression that a lot of the questions are asked by people who register specifically to ask that question.

Is it possible to somehow urge the users to read MCVE before posting a question with this tag?