textures

Packing rectangular image data into a square texture

空扰寡人 提交于 2019-11-28 18:21:22
I have N items of 2D image data that will be rectangular and I want to pack them into a single power of 2 texture as efficiently as possible. A simple non-efficient and naive implementation of an algorithm to pack these rects would be easy to whip up, but I'm sure people have come up with algorithms to do this as space efficiently as possible. I've found various references to lightmap packing which is similar to what I'm looking for, but the algorithms for lightmapping tend to take non-rectangular images into account which actually complicates things more than I need them to be. Does anyone

CSS3 Radial Gradients with RGBA()

有些话、适合烂在心里 提交于 2019-11-28 17:58:31
I am working on a website which uses multiple css3 gradients as overlay for a background tiled with texture image site url: --snipped-- currently for header i am using following css: #header { background: #DBD6D3; height: 364px; background: -moz-radial-gradient(50% 0% 0deg,circle farthest-corner,#FFFFFF,#DBD6D3); background: -webkit-gradient(radial,50% 59,500,50% 0,40,from(#DBD6D3),to(#FFFFFF)); } #header .wrp{background:url('img/headerBg.png');height:100%;padding-top:40px;} here headerBg.png is a semi-transparent texture of size 5x5 pixel, ad for body I need to create this background: I need

CUDA - Multiprocessors, Warp size and Maximum Threads Per Block: What is the exact relationship?

寵の児 提交于 2019-11-28 17:31:33
问题 I know that there are multiprocessors on a CUDA GPU which contain CUDA cores in them. In my workplace I am working with a GTX 590, which contains 512 CUDA cores, 16 multiprocessors and which has a warp size of 32. So this means there are 32 CUDA cores in each multiprocessor which works exactly on the same code in the same warp. And finally the maximum threads per block size is 1024. My question is how the block size and the multiprocessor count - warp size are exactly related. Let me tell my

How to match texture similarity in images?

南楼画角 提交于 2019-11-28 16:55:06
What are the ways in which to quantify the texture of a portion of an image? I'm trying to detect areas that are similar in texture in an image, sort of a measure of "how closely similar are they?" So the question is what information about the image (edge, pixel value, gradient etc.) can be taken as containing its texture information. Please note that this is not based on template matching. Wikipedia didn't give much details on actually implementing any of the texture analyses. Do you want to find two distinct areas in the image that looks the same (same texture) or match a texture in one

glPixelStorei(GL_UNPACK_ALIGNMENT, 1) Disadvantages?

谁说我不能喝 提交于 2019-11-28 16:42:57
What are the disadvantages of always using alginment of 1? glPixelStorei(GL_UNPACK_ALIGNMENT, 1) glPixelStorei(GL_PACK_ALIGNMENT, 1) Will it impact performance on modern gpus? How can data not be 1-byte aligned? This strongly suggests a lack of understanding of what the row alignment in pixel transfer operations means . Image data that you pass to OpenGL is expected to be grouped into rows. Each row contains width number of pixels, with each pixel being the size as defined by the format and type parameters. So a format of GL_RGB with a type of GL_UNSIGNED_BYTE will result in a pixel that is 24

Updating a texture in OpenGL with glTexImage2D

我们两清 提交于 2019-11-28 16:21:51
问题 Are glTexImage2D and glTexSubImage2D the only ways to pass a buffer of pixels to a texture? At the moment I use in a setup function glTexImage2D passing null as the buffer, and then on the render loop I call glTexSubImage2D with the new buffer data on each iteration. But knowing that the texture will not change any property such as the dimensions, is there any more efficient way to pass the actual pixel data to the rendering texture? 回答1: In modern OpenGL there are 4 different methods to

about opengles and texture on android

吃可爱长大的小学妹 提交于 2019-11-28 14:20:39
As we know,in the OpenGL ES the class Renderer on android has 3 function:onDrawFrame, onSurfaceChanged, onSurfaceCreated. and we can load the texture in the onSurfaceCreated and onDrawFrame . I want to know can i load the texture before the "Renderer" .Likely, I have a class named "Map",and can i load the images texture in the "Map" before the "GLSurfaceView" created. or can i load the images texture before the function "onSurfaceCreated" and "onDrawFrame" . if someone know it,please help me. Thanks!! Not easily. But (almost) anything is possible. The critical concept to understand here is

make seamless height-map texture for sphere (planet)

一笑奈何 提交于 2019-11-28 14:09:39
I'm trying to generate height-map for spherical planet with perlin noise. How can I make it with seamless left/right borders? I smoothed heightmap in poles, but cannot understand how can I loop left and right sides. This is how my textures look liked for now: Mirroring (by y-axis) This is great for making seamless background textures. But as you mentioned the texture must not contain distinct patterns otherwise it would be obvious. This can be used as a start point for texture generator Morphing There are vector and raster morphs out there depend on the content of image. You can try to use

OpenGL font rendering using Freetype2

旧街凉风 提交于 2019-11-28 12:08:15
I'm trying to render a freetype font using OpenGL, following the example posted at http://en.wikibooks.org/wiki/OpenGL_Programming/Modern_OpenGL_Tutorial_Text_Rendering_02 . I've been able to generate a texture atlas from the font, creating shaders and creating quads. What I seem to get stuck at is passing the texture to the shader and/or getting the correct UVs for my quads. Been struggling for a good while now and really need the help. The following is the struct I use to create my texture atlas. struct FontCharacter { float advanceX; float advanceY; float bitmapWidth; float bitmapHeight;

Managing assets between desktop and device version in libgdx

只愿长相守 提交于 2019-11-28 12:06:44
I'm building a little Android game using libgdx. For now I have a copy of the game's assets in the desktop project folder and the Android project folder. For some strange reason I have to access those files differently in each of the two versions. This works fine in the desktop app but gives me a FileNotFound exception in the android app: Texture texture = new Texture(Gdx.files.internal("assets/someImage.png")); If I remove the "assets" from the filename it's the other way round (Android works, desktop crashes): Texture texture = new Texture(Gdx.files.internal("someImage.png")); I'm not sure