texture-mapping

Most Efficient way of Multi-Texturing - iOS, OpenGL ES2, optimization

喜你入骨 提交于 2019-12-06 01:53:51
问题 I'm trying to find the most efficient way of handling multi-texturing in OpenGL ES2 on iOS. By 'efficient' I mean the fastest rendering even on older iOS devices (iPhone 4 and up) - but also balancing convenience. I've considered (and tried) several different methods. But have run into a couple of problems and questions. Method 1 - My base and normal values are rgb with NO ALPHA. For these objects I don't need transparency. My emission and specular information are each only one channel. To

How do I draw a texture-mapped triangle in MATLAB?

邮差的信 提交于 2019-12-05 18:09:13
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 triangle. I have a very ugly, slow and unsatisfactory solution in which I: extract a rectangular part of the image transform it to 3D space with the transformation defined by the three points draw it with surface finally masking out everything that is not part of the triangle with AlphaData Surely there must be an easier way of doing this? I have

What is the correct behavior when both a 1D and a 2D texture are bound in OpenGL?

此生再无相见时 提交于 2019-12-05 15:21:41
问题 Say you have something like this: glBindTexture(GL_TEXTURE_2D, my2dTex); glBindTexture(GL_TEXTURE_1D, my1dTex); glBegin... What is the correct OpenGL behavior? To draw the 1d texture, the 2d or both? For each active texture are there actually multiple textures that can be bound to it at the same time (i.e. a 1d, 2d, 3d cube map, etc.)? 回答1: The GL state for the bindings is one texture name per target (i.e. 1D/2D/3D/cube). So when calling glBindTexture(GL_TEXTURE_2D, my2dTex) glBindTexture(GL

Fixed texture size in Three.js

北城以北 提交于 2019-12-05 13:25:40
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 certain texture and other properties. Below is a simplified visualisation of the process where models uses materials and materials uses textures. loadTextures(); loadMaterials(); loadModels(); //start doing stuff in the scene I want to use that material on differently sized objects. However, in Three.js you can't (AFAIK) set a certain texture scale. You

Mapping Wavefront .obj texture vertex on OpenGL

瘦欲@ 提交于 2019-12-05 10:55:48
An artist gave me all 3D models for me exporting to .obj and .mtl in order that I can render it using OpenGL. But I can't figure out why the texture vertex are greater than 1 and sometimes negative. Take a look at this example: (...) vn -0.000717425 0.00106739 -0.00991695 vn 3.49779e-09 -5.22866e-09 -0.01 vn -0.00142294 0.00211706 -0.00966919 vn -0.00831486 -0.00555545 0 vt 5.82424 -20.091 vt 6.97527 -20.1873 vt 5.81848 -20.1618 vt -7.48189 8.29159 (...) He sent me all textures on TGA format, which I am loading it correctly, but I am not being able to map these vt s to a correct OpenGL texture

Texture Mapping C++ OpenGL

主宰稳场 提交于 2019-12-05 01:26:47
问题 I have read around on this, including Nehe and here for solutions, but I cant find a specific answer. I am trying to load a a photo, called stars.jpg. I want to make this my background of the scene, by mapping it using uv coordinates, doing it by glBegin(GL_QUADS); glTexCoord2f(0,0); glVertex2f(0,0); However I am just very confused about how to load the actual textures in, all the calls for glActiveTexture(); glEnable(GL_TEXTURE_2d); glBindTexture(GL_TEXTURE); All they do is confuse me, what

Most Efficient way of Multi-Texturing - iOS, OpenGL ES2, optimization

北战南征 提交于 2019-12-04 05:16:24
I'm trying to find the most efficient way of handling multi-texturing in OpenGL ES2 on iOS. By 'efficient' I mean the fastest rendering even on older iOS devices (iPhone 4 and up) - but also balancing convenience. I've considered (and tried) several different methods. But have run into a couple of problems and questions. Method 1 - My base and normal values are rgb with NO ALPHA. For these objects I don't need transparency. My emission and specular information are each only one channel. To reduce texture2D() calls I figured I could store the emission as the alpha channel of the base, and the

How to convert a 3D point on a plane to UV coordinates?

佐手、 提交于 2019-12-04 04:08:16
I have a 3d point, defined by [x0, y0, z0] . This point belongs to a plane, defined by [a, b, c, d] . normal = [a, b, c] , and ax + by + cz + d = 0 How can convert or map the 3d point to a pair of (u,v) coordinates ? This must be something really simple, but I can't figure it out. First of all, you need to compute your u and v vectors. u and v shall be orthogonal to the normal of your plane, and orthogonal to each other. There is no unique way to define them, but a convenient and fast way may be something like this: n = [a, b, c] u = normalize([b, -a, 0]) // Assuming that a != 0 and b != 0,

OpenGL4.5 - bind multiple textures and samplers

六眼飞鱼酱① 提交于 2019-12-03 17:02:37
问题 I'm trying to understand Textures, Texture Units and Samplers in OpenGL 4.5. I'm attaching a picture of what I'm trying to figure out. I think in my example everything is correct, but I am not so sure about the 1D Sampler on the right side with the question mark. So, I know OpenGL offers a number of texture units/binding points where textures and samplers can be bound so they work together. Each of these binding points can support one of each texture targets (in my case, I'm binding targets

Texture Mapping C++ OpenGL

蹲街弑〆低调 提交于 2019-12-03 16:03:47
I have read around on this, including Nehe and here for solutions, but I cant find a specific answer. I am trying to load a a photo, called stars.jpg. I want to make this my background of the scene, by mapping it using uv coordinates, doing it by glBegin(GL_QUADS); glTexCoord2f(0,0); glVertex2f(0,0); However I am just very confused about how to load the actual textures in, all the calls for glActiveTexture(); glEnable(GL_TEXTURE_2d); glBindTexture(GL_TEXTURE); All they do is confuse me, what do all these mean/do, and in what order am I suppose to put these in, in order to get the stars.jpg to