Texture mapping is a method for adding detail, surface texture (a bitmap or raster image), or color to a computer-generated graphic or 3D model.
Questions tagged [texture-mapping]
971 questions
4
votes
2 answers
GLSL - Using a 2D texture for 3D Perlin noise instead of procedural 3D noise
I implemented a shader for the sun surface which uses simplex noise from ashima/webgl-noise. But it costs too much GPU time, especially if I'm going to use it on mobile devices. I need to do the same effect but using a noise texture. My fragment…

Nolesh
- 6,848
- 12
- 75
- 112
4
votes
4 answers
Mapping irregular shapes or other polygons (cartoons, sprites) to triangles in OpenGL ES
I don't understand the concept of showing sprites mapped into OpenGL Triangles.
If OpenGL ES only draws triangles and points, How do you display/map non-triangular shapes?
Why would a shape mapped to a triangle not be distorted?
To explain:
In my…

Moshe
- 57,511
- 78
- 272
- 425
4
votes
2 answers
How do I texture a cylinder in OpenGL created with triangle_strip?
Here's the cylinder I have created:
void drawCylinder(float r, float g, float b) {
setMaterialColors(r, g, b);
glColor4f(r, g, b, 1.0);
/* top triangle */
double i, resolution = 0.1;
double height = 1, radius = 0.5;
…

williGo
- 43
- 1
- 4
4
votes
1 answer
How do I repeat textures without stretching in Three.js?
No matter what I do, my textures seem to be getting stretched / scaled to the size of the mesh I am applying them to. I've read a lot of answers to this question, none of the solutions seem to have fixed things for me so I'm posting a new one. Just…

Rohan Deshpande
- 694
- 8
- 22
4
votes
1 answer
Texture mapping using a 1d texture with OpenGL 4.x
I want to use a 1d texture (color ramp) to texture a simple triangle.
My fragment shader looks like this:
#version 420
uniform sampler1D colorRamp;
in float height;
out vec4 FragColor;
void main()
{
FragColor = texture(colorRamp,…

Vertexwahn
- 7,709
- 6
- 64
- 90
4
votes
1 answer
How to texture a "perfect cube" drawn with triangles?
I'm trying to map a texture on a cube which is basicly a triangle strip with 8 vertices and 14 indicies:
static const GLfloat vertices[8] =
{
-1.f,-1.f,-1.f,
-1.f,-1.f, 1.f,
-1.f, 1.f,-1.f,
-1.f, 1.f, 1.f,
1.f,-1.f,-1.f,
…

q9f
- 11,293
- 8
- 57
- 96
4
votes
2 answers
OpenGL: Disable texture colors?
Is it possible to disable texture colors, and use only white as the color? It would still read the texture, so i cant use glDisable(GL_TEXTURE_2D) because i want to render the alpha channels too.
All i can think of now is to make new texture where…

Newbie
- 1,593
- 10
- 35
- 50
4
votes
1 answer
glTexSubImage2D does not work correctly
I've written a very simple OpenGL application. Its goal is to load a texture and draw it on a plane. If I use the function 'glTexSubImage2D' the plane is not textured and the function 'glGetError' returns the error '1281' (invalid value). However if…

user1364743
- 5,283
- 6
- 51
- 90
4
votes
1 answer
Ratio of multipass textures compared to the color map
I have 4 textures used in a multi-pass effect with the color map at the highest quality - which for this example is 512x512. Currently the Normal, Specular & Parallax maps are the same dimensions. The additional maps are taking a significant portion…

Chris Masterton
- 2,197
- 4
- 24
- 30
4
votes
2 answers
How do I draw a texture-mapped triangle in MATLAB?
I have a triangle in (u,v) coordinates in an image. I would like to draw this triangle at 3D coordinates (X,Y,Z) texture-mapped with the triangle in the image.
Here, u,v,X,Y,Z are all vectors with three elements representing the three corners of the…

Petter
- 37,121
- 7
- 47
- 62
4
votes
1 answer
Deriving uncertainty values from a noise texture?
I'm trying to implement Sketchy Drawings. I'm at the part of the process which calls for the use of the noise texture to derive uncertainty values that will provide an offset into the edge map.
Here is a picture of my edge map for a torus:
And…

Shane
- 2,315
- 3
- 21
- 33
4
votes
1 answer
Get proper UV at barycentric coordinates with interpolation
I'm trying to implement proper texturing of convex polygons. I have a polygon with n triangles, for each triangle i'm calculating barycentric coordinates which are uv of each one but in [0..1] of each triangle, not entire polygon. How to interpolate…

Paweł
- 2,144
- 1
- 18
- 25
4
votes
1 answer
Texture data not being used in fragment shader - OpenGL
I'm practicing textures in OpenGL, applying a simple texture defined as white colors onto a quad. The code compiles and runs fine, but the color of the quad is simply black and not white as I have specified.
I think it is because my fragment shader…

CodingBeagle
- 1,888
- 2
- 24
- 52
4
votes
1 answer
Fixed texture size in Three.js
I am building quite a complex 3D environment in Three.js (FPS-a-like). For this purpose I wanted to structure the loading of textures and materials in an object oriënted way. For example; materials.wood.brownplank is a reusable material with a…

Chris Laarman
- 1,559
- 12
- 25
4
votes
1 answer
Opengl obj object loader with textures
I am using an object loader to load an obj model that I exported from blender. I can load the model but none of the textures are loaded and I don't know why. Should they be loaded when I render the model in the main class or do I need to load the…

Greg Chapman
- 49
- 1
- 1
- 4