textures

How can I put two different textures on the front and back of a plane?

点点圈 提交于 2019-11-26 21:35:55
问题 PRoblem: i'm trying to create (just for fun) a simple poker card (with a card back and a card front). I have two different images, for back and front. I easily created a Plane geometry with a single texture for both sides, but i really don't know how to assign a texture for a side and the other texture for the other side... i tried this (without success :( ): var textureBack = new THREE.ImageUtils.loadTexture( 'images/cardBack.png' ); var textureFront = new THREE.ImageUtils.loadTexture(

Android OpenGL Texture Compression

穿精又带淫゛_ 提交于 2019-11-26 21:23:19
I need some help finding information (or an example) of how to use texture compression for Android. I have a lot of PNG's right now and I need to reduce the amount of memory they take up. I was looking at PVR compression but I can't figure out how to use this within OpenGL. Could some point me in the right direction or offer some examples as I cannot find anything. gergonzalez There are mainly four texture compression types supported on Android: ETC1 (Ericsson texture compression) . This format is supported by all Android phones. But, it doesn't support an alpha channel, so can only be used

Read texture bytes with glReadPixels?

那年仲夏 提交于 2019-11-26 19:54:02
问题 I want to dump raw texture data to disk (to read back later), and I'm not sure about glReadPixel will read from the currently bound texture. How can I read the buffer from my texture? 回答1: glReadPixels function reads from framebuffers, not textures. To read a texture object you must use glGetTexImage but it isn't available in OpenGL ES :( If you want to read the buffer from your texture then you can bind it to an FBO (FrameBuffer Object) and use glReadPixels : //Generate a new FBO. It will

OpenCV image loading for OpenGL Texture

我是研究僧i 提交于 2019-11-26 19:21:51
问题 I want to load an image (jpg and png) with OpenCV as OpenGL Texture. Here is how I load the image to OpenGL: glEnable(GL_TEXTURE_2D); textureData = loadTextureData("textures/trashbin.png"); cv::Mat image = cv::imread("textures/trashbin.png"); if(image.empty()){ std::cout << "image empty" << std::endl; }else{ glGenTextures( 1, &textureTrash ); glBindTexture( GL_TEXTURE_2D, textureTrash ); glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE

Multiple transparent textures on the same mesh face in Three.js

百般思念 提交于 2019-11-26 18:22:16
Is it possible to lay multiple textures on top of each other on the same face in Three.js so that the alpha blending is done GPU accelerated in webGL? The textures are (or should be) applied to the same face so that the bottom texture (texture 1) is without alpha channel and the above textures are alpha channeled in a way like texture 2 in the below image example. This blending can be achieved using HTML5 Canvas as pre-step, but because texture bitmaps can be huge, I prefer to skip Canvas blending operations. I tested by creating a copy of the mesh and applying one texture per mesh and made

Three.js multiple materials on object loaded via OBJMTLLoader

会有一股神秘感。 提交于 2019-11-26 17:31:46
问题 I have ".obj" and ".mtl" files of a model and I'm loading it via OBJMTLLoader . ".mtl" specifies texture to apply to a model, and three.js loads model and renders it with applied texture just fine. But here's the thing. Once an object is loaded, I would like to apply another texture onto it. This is because first texture represents surface material of an object. And second texture is a drawing, that I'd like to position at a specific location on a model. My question is: how to apply a second

Responding to RAM availability in iOS

你说的曾经没有我的故事 提交于 2019-11-26 16:45:28
问题 I have a texture-heavy OpenGL game that I'd like to tune based on how much RAM the device has. The highest resolution textures I have work fine on an iPhone 4 or iPad2, but earlier devices crash in the middle of loading the textures. I have low-res versions of these textures, but I need to know when to use them. My current tactic is to detect specific older devices (3GS has a low-res screen; iPad has no camera), then only load the hi-res textures for IPad2 and above and iPhone 4 and above —

WebGL - wait for texture to load

隐身守侯 提交于 2019-11-26 16:44:28
问题 How do I test if the WebGLTexture object is 'complete' ? Currently I get this message: [WebGLRenderingContext]RENDER WARNING: texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering or is not 'texture complete' I get this warning because the render-loop is trying to use the texture before its image has finished loading, so how to fix that? 回答1: The easiest way to fix that is to make a 1x1 texture at creation time. var tex = gl

Convert an UIImage in a texture

ⅰ亾dé卋堺 提交于 2019-11-26 16:33:00
问题 In my opengl project I need to convert an UIImage in texture; what's the way to do it? Can you help me? 回答1: I haven't test the following but i will decompose the conversion in 3 steps: Extract info for your image: UIImage* image = [UIImage imageNamed:@"imageToApplyAsATexture.png"]; CGImageRef imageRef = [image CGImage]; int width = CGImageGetWidth(imageRef); int height = CGImageGetHeight(imageRef); Allocate a textureData with the above properties: GLubyte* textureData = (GLubyte *)malloc

Read pixels from a WebGL texture

拜拜、爱过 提交于 2019-11-26 16:28:37
问题 I have a WebGLTexture object. How do I get pixels of that texture (similar to WebGL's readPixels, but for a texture)? One idea I have is to create a canvas and a WebGL context with preserveDrawingBuffer=true, and render my texture on this canvas so that it shows 2D flat, and then use readPixels. Is this approach reasonable? Does anyone have a sample code for this? 回答1: You can try attaching the texture to a framebuffer and then calling readPixels on the frame buffer. at init time // make a