texture-mapping

Failing to map a simple unsigned byte rgb texture to a quad:

大城市里の小女人 提交于 2019-12-10 15:38:47
问题 I have a very simple program that maps a dummy red texture to a quad. Here is the texture definition in C++: struct DummyRGB8Texture2d { uint8_t data[3*4]; int width; int height; }; DummyRGB8Texture2d myTexture { { 255,0,0, 255,0,0, 255,0,0, 255,0,0 }, 2u, 2u }; This is how I setup the texture: void SetupTexture() { // allocate a texture on the default texture unit (GL_TEXTURE0): GL_CHECK(glCreateTextures(GL_TEXTURE_2D, 1, &m_texture)); // allocate texture: GL_CHECK(glTextureStorage2D(m

Problems to understand DXGI DirectX 11 Desktop Duplication to get a Buffer or Array

北城以北 提交于 2019-12-10 11:56:06
问题 I want to understand DXGI Desktop Duplication. I have read a lot and this is the code I copied from parts of the DesktopDuplication sample on the Microsoft Website. My plan is to get the Buffer or Array from the DesktopImage because I want to make a new Texture for an other program. I hope somebody can explain me what I can do to get it. void DesktopDublication::GetFrame(_Out_ FRAME_DATA* Data, _Out_ bool* Timeout) { IDXGIResource* DesktopResource = nullptr; DXGI_OUTDUPL_FRAME_INFO FrameInfo;

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

≡放荡痞女 提交于 2019-12-10 09:44:39
问题 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

OpenGL - 2D Texture Mapping

心不动则不痛 提交于 2019-12-09 13:05:40
问题 I'm trying to render a simple texture(64x64) to a 64x64 quad. The quad itself is rendering, but, not the texture. (It's rendering a blank white 64x64 quad.) I'm using SOIL to load the image. static GLuint LoadPNG(char* filename) { GLuint texture = SOIL_load_OGL_texture ( filename, SOIL_LOAD_AUTO, SOIL_CREATE_NEW_ID, SOIL_FLAG_INVERT_Y | SOIL_FLAG_NTSC_SAFE_RGB | SOIL_FLAG_COMPRESS_TO_DXT ); if (texture == 0) Log("Texture Load Error: " + string(filename)); glTexParameterf(GL_TEXTURE_2D, GL

Linear/Nonlinear Texture Mapping a Distorted Quad

北战南征 提交于 2019-12-08 17:54:11
问题 In my previous question, it was established that, when texturing a quad, the face is broken down into triangles and the texture coordinates interpolated in an affine manner. Unfortunately, I do not know how to fix that. The provided link was useful, but it doesn't give the desired effect. The author concludes: "Note that the image looks as if it's a long rectangular quad extending into the distance. . . . It can become quite confusing . . . because of the "false depth perception" that this

Android OpenGLES 2.0 Texture Mapping Does Not Work

耗尽温柔 提交于 2019-12-08 14:32:25
I'm trying to texture map some quads. I can render the quads with solid colors just fine. I've been following this page: http://www.learnopengles.com/android-lesson-four-introducing-basic-texturing/ Everything compiles and runs, but the texture is simply not being applied. The only difference between my code and the page linked is that I do not do glBindAttribLocation, and I use glDrawElements instead of glDrawArrays. EDIT: Converting my vertex and tex coord data to use glDrawArrays did not fix anything. All of my shader handles seem correct. The problem must be in one of my draws. If anyone

Android OpenGLES 2.0 Texture Mapping Does Not Work

 ̄綄美尐妖づ 提交于 2019-12-08 09:19:32
问题 I'm trying to texture map some quads. I can render the quads with solid colors just fine. I've been following this page: http://www.learnopengles.com/android-lesson-four-introducing-basic-texturing/ Everything compiles and runs, but the texture is simply not being applied. The only difference between my code and the page linked is that I do not do glBindAttribLocation, and I use glDrawElements instead of glDrawArrays. EDIT: Converting my vertex and tex coord data to use glDrawArrays did not

Mapping a square texture to a triangle

*爱你&永不变心* 提交于 2019-12-08 06:40:35
问题 I started to play with a OpenGL ES 1.0 and I run into some (beginners) problem: I tried to map a square texture to the cube described by triangles. // Turn necessary features on glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_SRC_COLOR); glEnable(GL_CULL_FACE); //glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Bind the number of textures we need, in this case one. glGenTextures(1, &texture[0]); glBindTexture(GL_TEXTURE_2D, texture[0]); glTexParameteri(GL_TEXTURE_2D

sphere texture mapping error

人盡茶涼 提交于 2019-12-07 23:58:29
问题 i use D3DXCreateSphere method to create sphere mesh. and i want to apply an earth texture on it. i calculate the texture coordinate in pixel shader with following code: sampler ShadeSampler = sampler_state { Texture = (ShadeTex); AddressU = Mirror; AddressV = Mirror; MinFilter = LINEAR; MagFilter = LINEAR; MipFilter = LINEAR; }; PS_OUTPUT PSMain(VS_OUTPUT input){ PS_OUTPUT output = (PS_OUTPUT)0; vector uv; uv.x = 0.5 + atan2(input.normal.z, input.normal.x) / piMul2; uv.y = 0.5f - asin(input

How to texture a random convex quad in openGL

眉间皱痕 提交于 2019-12-07 18:33:36
问题 Alright, so I started looking up tutorials on openGL for the sake of making a minecraft mod. I still don't know too much about it because I figured that I really shouldn't have to when it comes to making the small modification that I want, but this is giving me such a headache. All I want to do is be able to properly map a texture to an irregular concave quad. Like this: I went into openGL to figure out how to do this before I tried running code in the game. I've read that I need to do a