textures

Is three.js ObjectLoader capable of loading textures?

此生再无相见时 提交于 2019-12-02 18:48:27
问题 three.js version 0.0.70, blender version 2.73a I have a scene exported from blender to three.js json format using new io_three (not io_three_mesh ) exporter. I'm able to import the scene into three.js using ObjectLoader : var objectLoader = new THREE.ObjectLoader(); objectLoader.load('assets/models/exportedScene.json', function(imported) { scene.add(imported); }); Unfortunatelly, no texture is applied to an object, only the material. As I see from exportedScene.json file, there is an info

A 3 dimensional array represented by a 2 dimensional array-

北城以北 提交于 2019-12-02 18:22:23
问题 So in WebGL, I can store a texture in up to 2 dimensions- and read it in the shader using texture2D(whatever); If i wanted to store a 3 dimensional texture so that I can read 3-dimensions worth of data on the shader, how would I do it? Here are my ideas- and I am wondering if I am approaching it correctly: In Javascript: var info = []; for (var x = 0; x < 1; x+=.1) { for (var y = 0; y < 1; y+=.1) { for (var z = 0; z < 1; z+=.1) { info.push (x*y*z); info.push(0); info.push(0); info.push(0); }

Custom Texture Shader in Three.js

社会主义新天地 提交于 2019-12-02 17:40:52
I'm just looking to create a very simple Fragment Shader that draws a specified texture to the mesh. I've looked at a handful of custom fragment shaders that accomplished the same and built my own shaders and supporting JS code around it. However, it's just not working. Here's a working abstraction of the code I'm trying to run: Vertex Shader <script id="vertexShader" type="x-shader/x-vertex"> varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position,1.0); } </script> Fragment Shader <script id="fragmentShader" type="x-shader/x-fragment">

Use a texture and a color on a cube three.js

本小妞迷上赌 提交于 2019-12-02 15:13:16
问题 I would like to create a cube that has a texture and a color on it in three.js at the same time. I want to change the color when the cube is selected. That's why it needs a color. Will a black and white texture with a color on top allow me to change the color of the texture? 回答1: The color of a material has always an effect on the appearance of the object even there is an texture on it. The default color value is white and the texture looks just normal. But if you set the color to red, the

Create a health bar

时间秒杀一切 提交于 2019-12-02 13:17:40
I am trying to create a working health bar, and I have tried methods like Creating GUI.Box() that contains the health bar texture that I have created, but this makes the health bar resize to scale like this: Resizing the texture itself without the GUI.Box(), using the Texture2D.Resize() Method, but when I used the Texture2D.Resize() method, my texture turned black . It looks like this: My code looks like this. It was edited so that the irrelevant parts were deleted for ease of reading. Why does my health bar turn black when I resize it? Are there any ways I can prevent this from happening?

Unhandled exception in for loop

烂漫一生 提交于 2019-12-02 13:10:35
I'm trying to create two textures for my OpenGL project. Initially i created the textures seperately and this worked perfectly fine. Not to repeat myself, I decided to attempt to make them as an array and use a for loop to perform the steps twice. unsigned int textures[2]; int width, height, nrChannels; unsigned char *data = stbi_load("C:\\Users\\A\\Desktop\\wall.jpg", &width, &height, &nrChannels, 0); glGenTextures(2, textures); for (int i = 0; i < 2; i++) { glBindTexture(GL_TEXTURE_2D, (i == 0) ? textures[0] : textures[1]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);

Render an outlined red rectangle on top a 2D texture in OpenGL

给你一囗甜甜゛ 提交于 2019-12-02 13:01:05
问题 I have searched alot this site but couldn't exactly find what is exactly my problem. Most of the similar problems had used console and the glut library. But since I'm new to OpenGL and MFC and started it with the combination of MFC, they couldn't help me alot. I'm customizing the class COpenGLcontrol here in codeguru for my own purposes. Here's the full customized class but if you're not interested in downloading it, no problem I will explain the parts that are related. This may take a while,

Android OpenGL ES 1.1 white box textures

跟風遠走 提交于 2019-12-02 12:57:55
问题 I am having an issue where textures from the resources become just white. The issue only seems to occur on phones (Droid-X for sure), but it works just fine on the emulator. I have researched this issue for days and tried so many things. Textures are POT ranging from 8x8 to 128x128 Textures have been in res/drawable, res/drawable-nodpi and res/raw Tried with and without this in the manifest file: <supports-screens android:anyDensity="true" /> I am at a complete loss on this. Here is the code

Three.js Efficiently Mapping Uvs to Plane

六眼飞鱼酱① 提交于 2019-12-02 12:22:39
问题 I'm working on a game where there are many walls of the same texture but at different lengths/heights. Currently I am cloning a base texture and setting the repeat values for each wall. This creates to many textures in memory. What I want to do is to alter the planes uvs to fit the textures properly. I took a stab at this a came up with some meh results. var X = 2000; var Y = 1000; var seg = Math.ceil(X/Y); var wallgeo = new THREE.PlaneGeometry(X,Y,seg,1); var uvs = []; for(var i=0,len

A 3 dimensional array represented by a 2 dimensional array-

大城市里の小女人 提交于 2019-12-02 10:21:29
So in WebGL, I can store a texture in up to 2 dimensions- and read it in the shader using texture2D(whatever); If i wanted to store a 3 dimensional texture so that I can read 3-dimensions worth of data on the shader, how would I do it? Here are my ideas- and I am wondering if I am approaching it correctly: In Javascript: var info = []; for (var x = 0; x < 1; x+=.1) { for (var y = 0; y < 1; y+=.1) { for (var z = 0; z < 1; z+=.1) { info.push (x*y*z); info.push(0); info.push(0); info.push(0); } } } //bind texture here- whatever gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 10, 100, 0, gl.RGBA, gl