texture-mapping

How to use samplerCube as array

亡梦爱人 提交于 2020-06-29 04:45:23
问题 I am using samplerCube for a point light shadow map. For multiple lights, I implemented samplerCube as an array in the following. uniform samplerCube pointShadowMapTexture[MAX_LIGHT]; But somehow I can't index this samplerCube . Shader compiles and there is no problem. This is working for sampler2D arrays. I tried indexing it with [0], [1] .. in the shader but always the same image. I am sending different cube textures for each light but somehow shader doesn't index it or doesn't accept it. I

Vtk inserts incorrect color between nodes when mapping texture to mesh

牧云@^-^@ 提交于 2020-06-17 07:20:54
问题 Hi I am trying to map a texture to 3d mesh using Mayavi and Python bindings of vtk. I am visualising an .obj wavefront. This obj is 3D photograph of a face. The texture image is a composite of three 2D photographs. Each node in the mesh has an (uv) co-ordinate in the image, which defines its color. Different regions of the mesh draw their colours from different sections of the image. To illustrate this I have replaced the actual texture image with this one: And mapped this to the mesh instead

Vtk inserts incorrect color between nodes when mapping texture to mesh

怎甘沉沦 提交于 2020-06-17 07:20:25
问题 Hi I am trying to map a texture to 3d mesh using Mayavi and Python bindings of vtk. I am visualising an .obj wavefront. This obj is 3D photograph of a face. The texture image is a composite of three 2D photographs. Each node in the mesh has an (uv) co-ordinate in the image, which defines its color. Different regions of the mesh draw their colours from different sections of the image. To illustrate this I have replaced the actual texture image with this one: And mapped this to the mesh instead

how to warp texture in openGL? (Perspective correction?)

懵懂的女人 提交于 2020-03-05 06:05:26
问题 I wanna make the OpenGL program can present images and warp the images presented. Although I achieved image rendering using OpenGL, I don't know how to warp an image. An warpable example I want is (Reference): But a picture I got is: As I know, this problem is related to perspective correction mapping. But I don't know about that well. Here is my source code. void imageRender(Shader initShader, Shader imgShader, char *path){ glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); float positions

Box2D / OpenGL : one texture mapped on many vertices

╄→гoц情女王★ 提交于 2020-01-24 02:03:05
问题 I'm trying to do this kind of object with Box2D : Wobbly Picture using Box2D Building the grid with bodies and joints is not a problem, but I would like to use this matrix of points to warp my image. the problem is that I don't know how to "cut" my texture and map it on an OpenGL vertex array. I heard about u and v coordinates, but what about the texture cropping ? 回答1: Since you are asking how to connect textures, take a look into this modification of this hane lesson : // // This code was

SDL OpenGL in C++, Texture Shader missing the texture

坚强是说给别人听的谎言 提交于 2020-01-16 00:42:38
问题 I am trying to create my first OpenGL Shader but are experiencing difficulties when trying to add a texture to a Cube object. Is anyone sharp eyed enough to spot the error? The code might have lots of errors, and I am grateful if anyone points them out, but I am most interested in why my rotating cube is gray and not colorful. (I have skipped all error handling to keep source code size low, sorry about that) * *EDIT Found out I missed some UV settings, still gray cube though ... #include

(Three.js) Custom Mesh UV Display Texture Properly

末鹿安然 提交于 2020-01-14 01:34:05
问题 I have created a custom Geometry function for Three.js, based on the Plane Geometry. Everything works fine, except that I don't know how to make the UV display correctly. I use 4 triangles per Square, while the THREE.PlaneGeometry is only using 2 triangles per square. The code for PlaneGeometry UV's looks like this: var uva = new THREE.Vector2( ix / gridX, 1 - iz / gridZ ); var uvb = new THREE.Vector2( ix / gridX, 1 - ( iz + 1 ) / gridZ ); var uvc = new THREE.Vector2( ( ix + 1 ) / gridX, 1 -

Texture map for a 2D grid

冷暖自知 提交于 2020-01-12 03:49:07
问题 I have a set of points [x,y]=meshgrid(1:N,1:M) defined on a regular 2D, N x M grid. I have another set of points [u,v] that are some deformation of the original grid, i.e [u,v]=f(x,y)' (however I do not have the actual f that caused the deformation). How can I map a texture to the "deformed" grid defined by u,v ? i.e., given an image with aspect-ratio N/M how can I map it to the deformed grid? 回答1: I think you are asking to get samples of the original texture at [u,v] . You can use interp2.

Three.js MeshBasicMaterial doesn't work as expected

回眸只為那壹抹淺笑 提交于 2020-01-05 10:07:11
问题 I am trying to create a texture with Three.js. My source of texture_f1 is a .png file witch means you can see the background through it. The problem is that if i try to set background color: 0xffffff it doesn't work in combination with map:. If i set only the color:0xffffff , it return a white, but when use with map: like this var material_f1 = new THREE.MeshBasicMaterial({ map: texture_f1, color: 0xffffff}); i can see the background through the .png black . 回答1: If you have a transparent

How to load a texture onto a circle with OpenGL ES

五迷三道 提交于 2020-01-04 02:45:11
问题 I am facing problems on loading a texture onto a circle. My circle is made with a triangle fan. It gives a bad output. Original Image: The Result : My code: public class MyOpenGLCircle { private int points=360; private float vertices[]={0.0f,0.0f,0.0f}; private FloatBuffer vertBuff, textureBuffer; float texData[] = null; float theta = 0; int[] textures = new int[1]; int R=1; float textCoordArray[] = { -R, (float) (R * (Math.sqrt(2) + 1)), -R, -R, (float) (R * (Math.sqrt(2) + 1)), -R }; public