textures

How to copy texture1 to texture2 efficiently?

我怕爱的太早我们不能终老 提交于 2019-11-27 14:08:52
问题 I want to copy texture1 to texture2. The most stupid way is copying tex1 data from GPU to CPU, and then copy CPU data to GPU. The stupid code is as below: float *data = new float[width*height*4]; glBindTexture(GL_TEXTURE_2D, tex1); glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_FLOAT, data); glBindTexture(GL_TEXTURE_2D, tex2]); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, width, height, 0, GL_RGBA, GL_FLOAT, data); As I know, it must exist a method that supports data copying from GPU tex to GPU

WebGL create Texture

青春壹個敷衍的年華 提交于 2019-11-27 13:49:02
问题 I successfully created a WebGL texture from an image and drew it into a canvas element. function initTexture(src) { texture = gl.createTexture(); texture.image = new Image(); texture.image.onload = function() { handleLoadedTexture(texture) } texture.image.src = src; } I also tried to create a texture from one of these datatypes, but without success. [object ImageData] [object CanvasPixelArray] [object CanvasRenderingContext2D] Is it possible to create a texture just with an image's pixel

Packing rectangular image data into a square texture

馋奶兔 提交于 2019-11-27 11:28:45
问题 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

CSS3 Radial Gradients with RGBA()

房东的猫 提交于 2019-11-27 10:58:18
问题 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

How to match texture similarity in images?

≡放荡痞女 提交于 2019-11-27 10:02:30
问题 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. 回答1: Do you

glPixelStorei(GL_UNPACK_ALIGNMENT, 1) Disadvantages?

给你一囗甜甜゛ 提交于 2019-11-27 09:52:04
问题 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? 回答1: 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

about opengles and texture on android

∥☆過路亽.° 提交于 2019-11-27 08:45:12
问题 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.

THREE.js - Can't load texture locally

亡梦爱人 提交于 2019-11-27 08:12:41
问题 I have a local file in which I try to load texture like this: var texture = THREE.ImageUtils.loadTexture( 'image.jpg' ); var cubeGeo = new THREE.CubeGeometry( 50, 50, 50 ); var cubeMat = new THREE.MeshBasicMaterial( { map: texture } ); var cube = new THREE.Mesh( cubeGeo, cubeMat ); scene.add( cube ); The image doesn't show (the cube is black). When I move the whole folder to a server, and load it from there, the image is displayed. My question is, why does it work when the files are on a

Transparent textures behaviour in WebGL

ⅰ亾dé卋堺 提交于 2019-11-27 07:52:40
Environment: WebGL, Chrome. I have the following behavior when using transparent png's as textures for models: Image A - the tree hides the building behind it and I see the world box texture. It also hides itself (back branches are not visible) At the same time - Image B - works properly, the window is transparent and I see what's behind A: B: Both screenshots were made on same the scene at the same time from different camera positions. Textures are produced by the same algorithm. I can't understand what's the difference between window and branches transparency. My main question is - how to

Change the color or texture of a SCNText node object (Swift - Scenekit)

守給你的承諾、 提交于 2019-11-27 07:01:20
问题 How do I set the texture of a SCNText object? This is what I have and nothing changes in the appearance: // myNode is a working SCNText element let mat = SCNMaterial() met.diffuse.contents = UIImage(contentsOfFile: "texture.png") myNode.geometry.firstMaterial = mat 回答1: A text geometry may contain one, three, or five geometry elements: If its extrusionDepth property is 0.0, the text geometry has one element corresponding to its one visible side. If its extrusion depth is greater than zero and