textures

OpenGL texture colors are wrong

你。 提交于 2019-12-23 10:07:13
问题 I've made a simple program that cretes an Ortho perspective, and puts a texture containing a png on a quad However, I can't figure out why some of the colors are displayed all jumbled. The png looks like this (the white rectangle in the middle is transparent): The quad in my OpenGL program looks like this: Below is the code for initializing OpenGL as well as what goes on in the method called by the OpenGL thread. I'm using JOGL. public void init(GLAutoDrawable gLDrawable) { gl.glGenTextures(1

OpenGL texture colors are wrong

◇◆丶佛笑我妖孽 提交于 2019-12-23 10:05:47
问题 I've made a simple program that cretes an Ortho perspective, and puts a texture containing a png on a quad However, I can't figure out why some of the colors are displayed all jumbled. The png looks like this (the white rectangle in the middle is transparent): The quad in my OpenGL program looks like this: Below is the code for initializing OpenGL as well as what goes on in the method called by the OpenGL thread. I'm using JOGL. public void init(GLAutoDrawable gLDrawable) { gl.glGenTextures(1

sampler1D not supported in nVidia GLSL?

守給你的承諾、 提交于 2019-12-23 09:18:33
问题 In the GLSL spec, and other sources about GLSL, sampler types are available in 3 dimensions: sampler1D , sampler2D , and sampler3D . However when I try to compile GLSL programs using WebGL in Chrome (both regular, and also in Canary), sampler2D and sampler3D are accepted but sampler1D gives a syntax error. Code: uniform sampler1D tex1; Error: FS ERROR: ERROR: 0:9: 'sampler1D' : syntax error This error occurs even if I give Canary the command line argument --use-gl=desktop . I am running

OpenGL: Reusing the same texture with different parameters

早过忘川 提交于 2019-12-23 09:12:38
问题 In my program I have a texture which is used several times in different situations. In each situation I need to apply a certain set of parameters. I want to avoid having to create an additional buffer and essentially creating a copy of the texture for every time I need to use it for something else, so I'd like to know if there's a better way? 回答1: This is what sampler objects are for (available in core since version 3.3, or using ARB_sampler_objects ). Sampler objects separate the texture

Selecting the face of a Cubemap in GLSL

冷暖自知 提交于 2019-12-23 08:27:05
问题 Ok, I'm trying to understand how the face of a cubemap is selected using the coordinates supplied to textureCube() . From the spec, I gather the coord with the biggest magnitude defines the face. For example these coords (-0.2, 0.7, 0.65) would select the Y+ face of the cube map, but these (0.2, 0.3, -0.8) would select the Z- face. Am I right in my understanding? 回答1: Indeed you are. This is the simplemost way to select the face of a cube, given a direction from the center. 来源: https:/

Selecting the face of a Cubemap in GLSL

淺唱寂寞╮ 提交于 2019-12-23 08:26:01
问题 Ok, I'm trying to understand how the face of a cubemap is selected using the coordinates supplied to textureCube() . From the spec, I gather the coord with the biggest magnitude defines the face. For example these coords (-0.2, 0.7, 0.65) would select the Y+ face of the cube map, but these (0.2, 0.3, -0.8) would select the Z- face. Am I right in my understanding? 回答1: Indeed you are. This is the simplemost way to select the face of a cube, given a direction from the center. 来源: https:/

Animation of multiply blending of two images

谁说胖子不能爱 提交于 2019-12-23 05:28:07
问题 I have two images: bg Image1 And overlay Image2 (which height is bigger than bg image1) Now I need to place [Image2] over [Image1] with blend mode multiply. But after that I need to animate Image2's Y position but keep blend mode so to get an animation like this: https://www.youtube.com/watch?v=D4Gqm9_Eo68 So how can I achieve that? May be I should use OpenGL? If yes, then how exactly? 回答1: I do not code for IOS and have no clue of platform you are coding for (memory,speed,gfx capabilities).

Blank texture in webGL

99封情书 提交于 2019-12-23 04:23:02
问题 I have simple quad, and very simple shader (see below). I load image needed for texture, process it, get uniform place in shader program, and send it, the way that has been explained in "learning webgl" examples. I tested everything and used webGL inspector to see the textures I've been using and the problem is that quad is whole black. In fragment shader, the line: gl_FragColor = texture2D( uSampler, vUV); actually always sets the fragment color to (0,0,0,1). So it's like "blank" texture, or

iphone opengl es 2.0 non power of two

醉酒当歌 提交于 2019-12-23 04:22:12
问题 I thought the image file size doesn't have to be power of two in 2.0 but when I tried, it just showed black screen. But it works fine with power of two images. Can anyone give me some hint what I am missing or I should do to use NPOT images? Thank you 回答1: OpenGL ES for iOS requires Power-of-Two images, unfortunately, as it is a rather strict implementation (case in point, look at all of the stuff that is not available in OpenGL ES). If your image is non-power-of-two there are a few solutions

Android OpenGL|ES 2.0 Texturing

China☆狼群 提交于 2019-12-23 03:57:13
问题 I am using OpenGL|ES 2.0 to create a simple 2D square. I am struggling to get the textures working. Please help me in this regard. I have attached the code below: GFXUtils: public class GFXUtils { public static final String TAG = "GFXUtils"; public static final int COORDS_PER_VERTEX = 3; public static final int COORDS_PER_TEXTURE = 2; public static int vertexStride = COORDS_PER_VERTEX * 4; // bytes per vertex public static int textureStride = COORDS_PER_TEXTURE * 4; // bytes per vertex public