texture-mapping

Three JS Map Material causes WebGL Warning

无人久伴 提交于 2019-11-27 18:41:47
问题 I'm trying to define a material to meshes I loaded in from OBJLoader through the following wrapper function: function applyTexture(src){ var texture = new THREE.Texture(); var loader = new THREE.ImageLoader(); loader.addEventListener( 'load', function ( event ) { texture.image = event.content; texture.needsUpdate = true; // find the meshes from the loaded OBJ and apply the texture to it. object.traverse( function ( child ) { if ( child instanceof THREE.Mesh ) { if(child.name.indexOf("Lens") <

texture mapping a trapezoid with a square texture in OpenGL

荒凉一梦 提交于 2019-11-27 16:23:08
问题 I've been trying to render a GL_QUAD (which is shaped as a trapezoid) with a square texture. I'd like to try and use OpenGL only to pull this off. Right now the texture is getting heavily distorted and it's really annoying. Normally, I would load the texture compute a homography but that means a lot of work and an additional linear programming library/direct linear transform function. I'm under the impression OpenGL can simplify this process for me. I've looked around the web and have seen

How can I pass multiple textures to a single shader?

安稳与你 提交于 2019-11-27 10:54:33
问题 I am using freeglut, GLEW and DevIL to render a textured teapot using a vertex and fragment shader. This is all working fine in OpenGL 2.0 and GLSL 1.2 on Ubuntu 14.04. Now, I want to apply a bump map to the teapot. My lecturer evidently doesn't brew his own tea, and so doesn't know they're supposed to be smooth. Anyway, I found a nice-looking tutorial on old-school bump mapping that includes a fragment shader that begins: uniform sampler2D DecalTex; //The texture uniform sampler2D BumpTex; /

Map an image onto a sphere and plot 3D trajectories

倖福魔咒の 提交于 2019-11-27 02:31:35
问题 What I would like to do is to define a sphere in the center of my 3D coordinate system (with radius=1), wrap a cylindrical planet map onto the sphere's surface (i.e. perform texture mapping on the sphere) and plot 3D trajectories around the object (like satellite trajectories). Is there any way I can do this using matplotlib or mayavi? 回答1: Plotting trajectories is easy using mayavi.mlab.plot3d once you have your planet, so I'm going to concentrate on texture mapping a planet to a sphere

Opengl problem with texture in model from obj

六月ゝ 毕业季﹏ 提交于 2019-11-26 22:12:45
问题 I writing small program in OpenGL, and I have problem ( textures are skew, and I dont know why, this model work in another obj viewer) What I have: http://img696.imageshack.us/i/obrazo.png/ What I want http://img88.imageshack.us/i/obraz2d.jpg/ Code of project (I use devil for images): #pragma once #include <windows.h> #define GLUT_DISABLE_ATEXIT_HACK #include <glut.h> #include <GL/glu.h> #include <GL/gl.h> #include <GL/GLEXT.h> #include <iostream> #include <cmath> #include <IL/il.h> #include

Image manipulation and texture mapping using HTML5 Canvas?

人走茶凉 提交于 2019-11-26 17:29:02
In a 3D engine I'm working on I've succesfully managed to draw a cube in 3D. The only method to fill the sides is using either a solid color or gradient as far as I'm concerned. To make things more exciting, I'd really love to implement texture mapping using a simple bitmap. The point is that I can hardly find any articles or code samples on the subject of image manipulation in JavaScript. Moreover, image support in HTML5 canvas seems to be restricted to cropping. How could I go about stretching a bitmap so that a rectangular bitmap can fill up a unregular cube face? In 2D, a projected square

Image manipulation and texture mapping using HTML5 Canvas?

冷暖自知 提交于 2019-11-26 05:27:06
问题 In a 3D engine I\'m working on I\'ve succesfully managed to draw a cube in 3D. The only method to fill the sides is using either a solid color or gradient as far as I\'m concerned. To make things more exciting, I\'d really love to implement texture mapping using a simple bitmap. The point is that I can hardly find any articles or code samples on the subject of image manipulation in JavaScript. Moreover, image support in HTML5 canvas seems to be restricted to cropping. How could I go about

THREE.js generate UV coordinate

送分小仙女□ 提交于 2019-11-26 01:45:27
问题 I am working on importing a model into a scene using the THREE.js OBJ loader. I know that I am able to import the geometry fine, because when I assign a MeshNormalMaterial to it, it shows up great. However, if I use anything that requires UV coordinates, It gives me the error: [.WebGLRenderingContext]GL ERROR :GL_INVALID_OPERATION : glDrawElements: attempt to access out of range vertices in attribute 1 I know this is because the loaded OBJ has no UV coordinates, but I was wondering if there

THREE.js generate UV coordinate

早过忘川 提交于 2019-11-26 01:33:00
I am working on importing a model into a scene using the THREE.js OBJ loader. I know that I am able to import the geometry fine, because when I assign a MeshNormalMaterial to it, it shows up great. However, if I use anything that requires UV coordinates, It gives me the error: [.WebGLRenderingContext]GL ERROR :GL_INVALID_OPERATION : glDrawElements: attempt to access out of range vertices in attribute 1 I know this is because the loaded OBJ has no UV coordinates, but I was wondering if there was any way to generate the needed texture coordinates. I have tried material.needsUpdate = true;