textures

OpenGL - texture are mapped incorrectly using glDrawElements

南楼画角 提交于 2019-12-25 19:57:30
问题 I am creating an OBJ parser which reads the file and draw it using glDrawElements. The thing here is the model is correctly drawn but when I try to give it a texture, it is incorrectly mapped. I have read here that "OpenGL can only use one index buffer, whereas OBJ use one index buffer by attribute". I have also researched about the textures being incorrectly mapped when using glDrawElements and found out that I need to rearrange the textures because only vertices are shared but not the

OpenGL 3D texture “shine through”

半世苍凉 提交于 2019-12-25 18:48:09
问题 For testing purposes I want to display the first slice of a 3D texture. However it seems that the other slices are also displayed. My vertex shader: #version 130 attribute vec4 position; varying vec2 texcoord; void main() { gl_Position = position; texcoord = position.xy * vec2(0.5) + vec2(0.5); } The fragment shader: #version 130 uniform sampler3D textures[1]; varying vec2 texcoord; void main() { gl_FragColor = texture3D(textures[0], vec3(texcoord.x, texcoord.y, 0)); } I bind the texture from

Java libgdx 1.20 version texture bug

故事扮演 提交于 2019-12-25 10:51:50
问题 For 2 days I've been trying to fix bug with fickering and distored textures in my game. I was serching on the internet and i tried a few solutions like using scene2d, but it didn't work. What should i do ? This screenshot shows the problem: as the character moves, one eye is sometimes bigger than the other: edit: I still got the problem widthdistored eye when i use sprite.setPosition((int) sprite.getX(), (int) sprite.getY()); every time before i render my character. When i use custom viewport

Java libgdx 1.20 version texture bug

半腔热情 提交于 2019-12-25 10:51:06
问题 For 2 days I've been trying to fix bug with fickering and distored textures in my game. I was serching on the internet and i tried a few solutions like using scene2d, but it didn't work. What should i do ? This screenshot shows the problem: as the character moves, one eye is sometimes bigger than the other: edit: I still got the problem widthdistored eye when i use sprite.setPosition((int) sprite.getX(), (int) sprite.getY()); every time before i render my character. When i use custom viewport

Three.js merge with different textures

折月煮酒 提交于 2019-12-25 09:09:49
问题 I have a scene with two individual meshes. It looks like this: this.loadFiles("gras", (gras) => { var particleMaterial = new THREE.MeshPhongMaterial(); particleMaterial.map = THREE.ImageUtils.loadTexture("models/planets/gras.jpg"); particleMaterial.side = THREE.DoubleSide; this.mesh = new THREE.Mesh(gras,particleMaterial); this.loadFiles("rocks", (rocks) => { var particleMaterial = new THREE.MeshPhongMaterial(); particleMaterial.map = THREE.ImageUtils.loadTexture("models/planets/rocks.jpg");

Three.js merge with different textures

落花浮王杯 提交于 2019-12-25 09:07:05
问题 I have a scene with two individual meshes. It looks like this: this.loadFiles("gras", (gras) => { var particleMaterial = new THREE.MeshPhongMaterial(); particleMaterial.map = THREE.ImageUtils.loadTexture("models/planets/gras.jpg"); particleMaterial.side = THREE.DoubleSide; this.mesh = new THREE.Mesh(gras,particleMaterial); this.loadFiles("rocks", (rocks) => { var particleMaterial = new THREE.MeshPhongMaterial(); particleMaterial.map = THREE.ImageUtils.loadTexture("models/planets/rocks.jpg");

three.js: how to apply alpha-map when using OBJMTL loader?

不问归期 提交于 2019-12-25 07:01:22
问题 Actually I am trying to upload these .obj and .mtl file by OBJMTLloader. all is working fine but the image in mtl file is loaded by map_d is not uploaded. newmtl Eyelashes Ns 10.0000 Ni 1.5000 d 0.5000 Tr 0.0000 Tf 1.0000 1.0000 1.0000 illum 2 Ka 0.5880 0.5880 0.5880 Kd 0.5880 0.5880 0.5880 Ks 0.0000 0.0000 0.0000 Ke 0.0000 0.0000 0.0000 map_Ka EyelashesDiffuseTexture.jpg map_Kd EyelashesDiffuseTexture.jpg map_d EyeLashes_Opacity_Texture.jpg My code is var loader = new THREE.OBJMTLLoader();

three.js use camera texture in different scenes/ div

混江龙づ霸主 提交于 2019-12-25 07:01:06
问题 at the moment, I am rendering a camera to a texture and put the texture on a plane mesh. This works, in the scene the texture was recorded from. When putting the same mesh into a different scene, which is running in a div, the mesh shows up, without texture. Same, when I put the texture on a mesh, which is created in the div- scene. The mesh seems to have a texture, because it is black and not red, as initialized. When leaving away the texture, it does show up in red. When I put the mesh into

loading texture issue, works with animation, blank without

你离开我真会死。 提交于 2019-12-25 06:39:21
问题 I am new to three.js, but am just coming off of a project using Java and JMonkeyEngine, so I know my way around 3d. My issue comes with loading a texture. I'm sure this question has come up quite a few times coming from the topics I've read, however the topics I have seen are older, and it didn't work with what I needed. I took an example from the site and tried editing it to my own needs. I was able to load my texture fine, and it spun around just like the example.... HOWEVER, when I removed

Java Opengl: Discarding Texture Background with Shaders

喜你入骨 提交于 2019-12-25 06:04:02
问题 I'm trying to follow this tutorial to remove the background color of texture with a shader. https://www.opengl.org/sdk/docs/tutorials/ClockworkCoders/discard.php Everything is running correctly, I copied the shader code directly from the tutorial, however the fragment shader is throwing several errors. sampler2D myTexture; varying vec2 vTexCoord; void main (void) { vec4 color = texture2D(myTexture, vTexCoord); if (color.rgb == vec3(1.0,0.0,0.0)) discard; gl_FragColor = color; } ERROR: 0:3: