textures

Trouble with imageStore() (OpenGL 4.3)

Deadly 提交于 2019-12-07 12:02:49
问题 I'm trying to output some data from compute shader to a texture, but imageStore() seems to do nothing. Here's the shader: #version 430 layout(RGBA32F) uniform image2D image; layout (local_size_x = 1, local_size_y = 1) in; void main() { imageStore(image, ivec2(gl_GlobalInvocationID.xy), vec4(0.0f, 1.0f, 1.0f, 1.0f)); } and the application code is here: GLuint tex; glGenTextures(1, &tex); glBindTexture(GL_TEXTURE_2D, tex); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, WIDTH, HEIGHT, 0, GL_RGBA, GL

Libgdx 3D Texture Transparency

最后都变了- 提交于 2019-12-07 10:20:41
问题 I'm having a problem with a texture on a cylinder. Basically it is a coin with a texture on it, I have done this before as demo but lost the code. Now the problem I'm facing is that I cant get the edge of the coin to be transparent anymore. The transparent parts of the png appear white on the cylinder, or even the box I tried. I enabled G20.GL_Blend, have the blending function with alpha_src and one_minus_alpha_src, enabled something like texture_2d. (Srry for the wrong variable names, only

How to render Framebuffer Objects on multi-sampled textures?

﹥>﹥吖頭↗ 提交于 2019-12-07 06:32:23
问题 I currently have a rendering engine using multiple passes in which various parts of the image are rendered on textures, and then combined using shaders. It works, and now I would like to activate multi-sampling. I read here ( http://www.opengl.org/wiki/Framebuffer_Object_Examples#MSAA ) that, with OpenGL, you can't attach a GL_TEXTURE2D_MULTISAMPLE to a framebuffer object. It seems one way to use multi-sampling and still have access to the result as texture is to use a multi-sampled render

two meshes, same texture, different offset?

£可爱£侵袭症+ 提交于 2019-12-07 05:28:13
问题 Using three.js, I'm working on a web page to display a flip cube (a.k.a. magic cube; see e.g. the video on this page). On a flip cube, there are typically images that are spread out across multiple pieces of the cube. For example, the boat image shown above is spread across the faces of four cubelets. In three.js terms, there are multiple meshes that need to use the same image for their material texture, but each at a different offset. As far as I understand it, in three.js, offset is a

Threejs DataTexture Not Updating

99封情书 提交于 2019-12-07 03:15:28
UPDATE: Issue was that texData object was recreated each time and thus reference for DataTexture was lost. Solution by WestLangley was to overwrite the data in texData instead of recreating texData object. I have a simple threejs scene with a DataTexture in a ShaderMaterial . The data array passed to it once during initialization is updated on mouse events. However the DataTexture does not seem to update. Did i assign uniforms or texture data wrongly? Or using the needsUpdate flags wrongly? It does work when deleting and recreating the texture, material, mesh and scene objects each time, but

How to draw a texture into a quad with OpenGL ES 2?

杀马特。学长 韩版系。学妹 提交于 2019-12-07 03:10:01
问题 Quads are not included in OpenGL ES 2.0 as they were in 1.1. With the programmable pipeline offered by OpenGL ES 2.0, how can I simply draw a texture (originally a png file) into 4 defined points? Do I need a VBO? Do I need to compute a perspective matrix? All these things are messy for me... The platform used is the iPhone. 回答1: I found the answer. It is mandatory to use a perspective matrix and a shader, even for such a simple task. This answer helped me to do it. Here is the code I used,

Directx 11, send multiple textures to shader

吃可爱长大的小学妹 提交于 2019-12-07 02:01:15
问题 using this code I can send one texture to the shader: devcon->PSSetShaderResources(0, 1, &pTexture); Of course i made the pTexture by: D3DX11CreateShaderResourceViewFromFile Shader: Texture2D Texture; return color * Texture.Sample(ss, texcoord); I'm currently only sending one texture to the shader, but I would like to send multiple textures, how is this possible? Thank You. 回答1: By using Texture Arrays. When you fill out your D3D11_TEXTURE2D_DESC look at the ArraySize member. This desc struct

How to load Image from user's computer

佐手、 提交于 2019-12-07 02:00:52
问题 Is it possible to load image to XNA game from user computer? For example, I want to load "C:\Images\Box.png" to sprite texture. Is it possible? If yes, how? 回答1: In XNA 4.0 use Texture2D.FromStream Texture2D fileTexture; using(FileStream fileStream = new FileStream(@"C:\Images\Box.png", FileMode.Open)) { fileTexture = Texture2D.FromStream(GraphicsDevice, fileStream); } If you're using XNA before 4.0 then you can use Texture2D.FromFile. 回答2: System.IO.FileStream stream = new System.IO

Losing OpenGL Textures in Android after a resume

戏子无情 提交于 2019-12-07 01:29:24
问题 My game is working correctly except in the case where I press the HOME button then resume. What needs to be done to use the textures again? I have tried calling onPause and onResume on the GLSurfaceView (when the activity's onPause and onResume are called). Any ideas what I could be doing wrong? 回答1: If all else fails, reload the textures: Pseudocode for tex in textures: if glIsTexture(tex.opengl_name) == false: glGenTextures(1, &tex.opengl_name) glBindTexture(tex.texture_target); glTexImage(

Is 1024x1024 a widely supported OpenGL maximum texture size on the desktop?

旧城冷巷雨未停 提交于 2019-12-07 01:21:26
问题 I am creating a sprite engine that uses the concept of "graphics banks" to speed up rendering using batches. I was wondering if anyone knows if 1024x1024 textures are widely supported enough these days to "count on", and/or if there is a way to find out how far back there has been support for 1024x0124 in terms of graphics chipsets / cards, like a chart or something, and from that decide based on estimated compatibility % if I should go with 1024x1024 or limit banks to 512x512 (which I have a