texture-mapping

Sampling from a texture in OpenGL is black

眉间皱痕 提交于 2021-02-18 18:12:15
问题 I'm trying out my hand at graphics, following a tutorial at http://en.wikibooks.org/wiki/OpenGL_Programming/Modern_OpenGL_Tutorial_06 Problem: When I try to texture my cube, my sample is black. Screenshot: http://puu.sh/2JP1H.jpg (note: I set blue = uv.x to test my UVs) I looked at the threads OpenGL textures appear just black, and Texture is all black, but it seemed they had different problems. First I load my texture using SOIL image loading library: int w, h; unsigned char* img = SOIL_load

Sampling from a texture in OpenGL is black

大兔子大兔子 提交于 2021-02-18 18:11:37
问题 I'm trying out my hand at graphics, following a tutorial at http://en.wikibooks.org/wiki/OpenGL_Programming/Modern_OpenGL_Tutorial_06 Problem: When I try to texture my cube, my sample is black. Screenshot: http://puu.sh/2JP1H.jpg (note: I set blue = uv.x to test my UVs) I looked at the threads OpenGL textures appear just black, and Texture is all black, but it seemed they had different problems. First I load my texture using SOIL image loading library: int w, h; unsigned char* img = SOIL_load

Sampling from a texture in OpenGL is black

与世无争的帅哥 提交于 2021-02-18 18:07:23
问题 I'm trying out my hand at graphics, following a tutorial at http://en.wikibooks.org/wiki/OpenGL_Programming/Modern_OpenGL_Tutorial_06 Problem: When I try to texture my cube, my sample is black. Screenshot: http://puu.sh/2JP1H.jpg (note: I set blue = uv.x to test my UVs) I looked at the threads OpenGL textures appear just black, and Texture is all black, but it seemed they had different problems. First I load my texture using SOIL image loading library: int w, h; unsigned char* img = SOIL_load

How do I wrap a sprite around a cube without GL_REPEAT? [closed]

微笑、不失礼 提交于 2021-02-04 08:26:11
问题 Closed. This question needs debugging details. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . Improve this question I'm using OpenGL 3.2+. I created a cube VBO of 8 verticies (each vertex consists of 8 floats: x,y,z,r,g,b,s,t), an EBO to create the faces for that cube, and a VAO to tie it all together. I have a sprite atlas consisting of hundreds of 16x16 sprites. I'm trying to get 1 sprite

Assigning a 2D image for every face of a 3D cube: MATLAB

泄露秘密 提交于 2021-01-28 20:41:36
问题 I want to build a cube in MATLAB and assign different 2D images for its faces. I think this is called texture mapping. I've searched for such a code, but what I found is a code that is able to assign a single image to all of the cube faces, the code is available here (http://www.mathworks.com/matlabcentral/answers/32070-rgb-images-on-a-3d-cube). Here is the code, cdata = flipdim( imread('peppers.png'), 1 ); cdatar = flipdim( cdata, 2 ); % bottom surface([-1 1; -1 1], [-1 -1; 1 1], [-1 -1; -1

Assigning a 2D image for every face of a 3D cube: MATLAB

為{幸葍}努か 提交于 2021-01-28 19:25:19
问题 I want to build a cube in MATLAB and assign different 2D images for its faces. I think this is called texture mapping. I've searched for such a code, but what I found is a code that is able to assign a single image to all of the cube faces, the code is available here (http://www.mathworks.com/matlabcentral/answers/32070-rgb-images-on-a-3d-cube). Here is the code, cdata = flipdim( imread('peppers.png'), 1 ); cdatar = flipdim( cdata, 2 ); % bottom surface([-1 1; -1 1], [-1 -1; 1 1], [-1 -1; -1

Rendering transparent objects

房东的猫 提交于 2020-07-24 05:38:21
问题 I am trying to make a glass plane by adjusting the translucency of the object with alpha values. Currently, it is a black plane as my alpha values have no effect on my objects. Please have a look at the image: glEnable(GL_BLEND); does nothing and glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO); makes all my objects disappear fragment shader: #version 330 core // interpolated values from the vertex shaders in vec3 vNormal; in vec3 vPosition; in vec2 vTexCoord; //

Rendering transparent objects

北慕城南 提交于 2020-07-24 05:36:11
问题 I am trying to make a glass plane by adjusting the translucency of the object with alpha values. Currently, it is a black plane as my alpha values have no effect on my objects. Please have a look at the image: glEnable(GL_BLEND); does nothing and glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO); makes all my objects disappear fragment shader: #version 330 core // interpolated values from the vertex shaders in vec3 vNormal; in vec3 vPosition; in vec2 vTexCoord; //