textures

Three.js tile which has multiple textures using plane geometry

核能气质少年 提交于 2019-12-06 04:38:51
问题 So I am trying to build a 3D based world consisting of tiles. I have successfully managed to do this using the plane geometry and height values etc. But now I have come to a point where I possibly have to change everything. The problem is that I want a tile to have multiple textures (using a shader because I want to blend them). I was able to do this globally (so each tile would have same textures + using some uv mapping). However I fail to understand how I would be able to specify which tile

Pitch alignment for 2D textures

本小妞迷上赌 提交于 2019-12-06 03:10:42
问题 2D textures are a useful feature of CUDA in image processing applications. To bind pitch linear memory to 2D textures, the memory has to be aligned. cudaMallocPitch is a good option for aligned memory allocation. On my device, the pitch returned by cudaMallocPitch is a multiple of 512, i.e the memory is 512 byte aligned. The actual alignment requirement for the device is determined by cudaDeviceProp::texturePitchAlignment which is 32 bytes on my device. My question is: If the actual alignment

Render a BMP, JPEG, or PNG Image with DirectX?

▼魔方 西西 提交于 2019-12-06 03:02:31
问题 How do you render a BMP, JPEG, or PNG image file in 3D with DirectX in Windows? (E.g. let's say I want to render four images so that they look like a cubicle or something.) I've seen this done easily with a Java OpenGL library (JME I think?), but it seems like DirectX needs textures, and doesn't take in regular images. :( Is this correct? If so, how do I convert it to a texture programmatically? 回答1: DirectX 9: D3DXCreateTextureFromFile DirectX 10: D3DX10CreateTextureFromFile and

Workaround for Texture2D.GetData method

若如初见. 提交于 2019-12-06 02:33:42
问题 I’m converting a game from XNA to iOS with Monogame. In the code snippet below, smallDeform is a Texture2D on which I call the GetData method. smallDeform = Game.Content.Load<Texture2D>("Terrain/..."); smallDeform.GetData(smallDeformData, 0, smallDeform.Width * smallDeform.Height); I’m having some problem with Monogame because the feature in iOS has not been implemented yet because it returns this exception. #if IOS throw new NotImplementedException(); #elif ANDROID I tried to serialize the

Android OpenGL - ES Texture bleeding

泄露秘密 提交于 2019-12-06 02:29:53
问题 I am writing a small app that at the moment generates a random map of textures. I am drawing this map as a 10 x 15 group of "quads" which are infact all triangle strips. I use the "map" to grab an int which I then take as the location of the texture for this square in the textureAtlas. so for example 0 is the bottom left "tile". The atlas is 128 x 128 and split into 32 pixel tiles. However I seem to be getting some odd artifacts where the texture from the one tile is creeping in to the next

2D Texture gets distorted when making a sub-pixel translation

我与影子孤独终老i 提交于 2019-12-06 02:28:57
I would like to know a theoretical reasoning why is this even possible: how translation of the geometry is related to the texture mapping. I can only notice this effect when making a sub-pixel translation, texture looks fine if translated by entire pixel(s). I am using orthographic projection, GL_CLAMP_TO_EDGE , GL_NEAREST , fragment shader is highp . Texture coordinates is a subregion of the atlas, but I can see the distortion even if the entire atlas is mapped. Using OpenGL ES (Android and iOS), but please before retagging could anyone explain that this is not an issue in OpenGL. Things I've

Unity 3D: Asset Bundles vs. Resources folder vs www.Texture

一个人想着一个人 提交于 2019-12-06 01:51:08
问题 So, I've done a bit of reading around the forums about AssetBundles and the Resources folder in Unity 3D, and I can't figure out the optimal solution for the problem I'm facing. Here's the problem: I've got a program designed for standalone, that loads "books" full of .png and .jpg images. The pages are, at the moment, the same every time the program starts. At the start of the scene for any "book", it's loading all those images at once using www.texture and a path. I'm realizing now, however

Flipping OpenGL texture

放肆的年华 提交于 2019-12-06 00:01:59
问题 When I load textures from images normally, they are upside down because of OpenGL's coordinate system. What would be the best way to flip them? glScalef(1.0f, -1.0f, 1.0f); mapping the y coordinates of the textures in reverse vertically flipping the image files manually (in Photoshop) flipping them programatically after loading them (I don't know how) This is the method I'm using to load png textures, in my Utilities.m file (Objective-C): + (TextureImageRef)loadPngTexture:(NSString *)name {

Three.js, custom shader and png texture with transparency

瘦欲@ 提交于 2019-12-05 23:51:48
问题 I have an extremely simple PNG texture: a grey circle with a transparent background. I use it as a uniform map for a THREE.ShaderMaterial : var uniforms = THREE.UniformsUtils.merge( [basicShader.uniforms] ); uniforms['map'].value = THREE.ImageUtils.loadTexture( "img/particle.png" ); uniforms['size'].value = 100; uniforms['opacity'].value = 0.5; uniforms['psColor'].value = new THREE.Color( 0xffffff ); Here is my fragment shader (just part of it): gl_FragColor = vec4( psColor, vOpacity ); gl

Trouble with imageStore() (OpenGL 4.3)

◇◆丶佛笑我妖孽 提交于 2019-12-05 23:12:29
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_FLOAT, 0); glBindImageTexture(0, tex, 0, GL_FALSE, 0, GL_WRITE_ONLY, GL_RGBA32F); glUseProgram(program-