textures

how to flip a pixmap to draw to a texture in libgdx?

孤街浪徒 提交于 2019-11-28 03:08:18
问题 So what I'm trying to do is to generate a background image for my game by drawing pixmaps to a texture. So far I can do that, but now I need to draw the pixmaps flipped in the X or Y axis to the texture. However I can't find anything to do so. The pixmap class does not provide that functionality. Then I thought I could draw a flipped texture region to a texture, but so far I haven't found how to do so. So I was wondering how can I do such a thing, would it be possible to flip a png image with

Differences and relationship between glActiveTexture and glBindTexture

梦想与她 提交于 2019-11-28 02:31:29
From what I gather, glActiveTexture sets the active "texture unit". Each texture unit can have multiple texture targets (usually GL_TEXTURE_1D, 2D, 3D or CUBE_MAP). If I understand correctly, you have to call glActiveTexture to set the texture unit first (initialized to GL_TEXTURE0 ), and then you bind (one or more) "texture targets" to that texture unit? The number of texture units available is system dependent. I see enums for up to 32 in my library. I guess this essentially means I can have the lesser of my GPU's limit (which I think is 16 8) and 32 textures in GPU memory at any one time? I

Bump-map a sphere with a texture map

我是研究僧i 提交于 2019-11-28 02:30:15
We would like to bump-map a sphere with a texture map. However, the surface of the sphere has an area that is 10 times the area of the texture map(area for both in pixels). Describe different ways in which the texture map can be used for bump mapping. Spektre usually rectangle texture is used for spheres texture (u,v) coordinates are used as angles for spherical coordinates. The result is that texels are bigger near equator and smaller near poles. At poles all the texels merge to single pixel. This is how to do it texturing spheres normal/bump mapping When you use these maps (color,normal

How to map different textures to different faces of a cube in WebGL?

时光总嘲笑我的痴心妄想 提交于 2019-11-28 02:15:27
问题 I have the following cube coordinates: var vertices = [ // Front face -1.0, -1.0, 1.0, 1.0, -1.0, 1.0, 1.0, 1.0, 1.0, -1.0, 1.0, 1.0, // Back face -1.0, -1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0, 1.0, -1.0, -1.0, // Top face -1.0, 1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, // Bottom face -1.0, -1.0, -1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, -1.0, -1.0, 1.0, // Right face 1.0, -1.0, -1.0, 1.0, 1.0, -1.0, 1.0, 1.0, 1.0, 1.0, -1.0, 1.0, // Left face -1.0, -1.0, -1.0, -1.0, -1.0, 1

Texture atlas offset/repeat works for meshes but is ignored for point system particles

夙愿已清 提交于 2019-11-28 02:15:06
问题 I am using a texture atlas to hold a sequence of images. When mapping to a mesh with MeshLambertMaterial , using Texture.offset and Texture.repeat works beautifully to cut the subtexture out of the entire image. However, using the exact same texture instance for a PointCloudMaterial renders the particles with the entire atlas, not just the selected subimage. I tried to follow the three.js source code, but the documentation is scarce. Is there a workaround for this better than using canvases

Tiling a 2D Texture to Fill a Rectangle

故事扮演 提交于 2019-11-28 02:06:39
问题 Is it possible to tile an image in XNA so that it fills the entirety of a rectangle? I've tried Googling the subject, but I can't find anything that seems to work (I'm probably missing something obvious though). I found this MSDN page, but I can't seem to get it to work. Here's my code: spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.LinearWrap, null, null); But this just stretched the texture to fill the rectangle, not tile it. Any help is appreciated. Thanks in advance. 回答1:

How to bind an array of textures to a WebGL shader uniform?

有些话、适合烂在心里 提交于 2019-11-28 00:46:02
问题 I need to handle many objects which share only a few textures. Defining and loading textures one by one manually (as described in another post on SO) does not feel right... even more so since there's no switch (index) {case:...} statement in WebGL. So I wanted to pass the texture to use for a vertex as a vertex attribute, and use this number as an index into some "array of textures" in the fragement shader. But the OpenGL wiki on Samplers (not quite the perfect reference for WebGL, but the

iOS Textures Taking 33% Extra Memory

萝らか妹 提交于 2019-11-28 00:14:41
问题 I was testing my iOS game and noticed a discrepancy between how much memory it was taking up and how much it thought it should be taking up. Eventually I narrowed down the problem to textures taking 33% more memory than I thought they should be taking. For instance, I would think a 256x256 uncompressed 32-bit texture should take 256*256*4 bytes = 256k. However, I would notice the app's memory grow by something like 340k when allocating a 256x256 texture. It was as if the device were

What is the range of OpenGL texture ID?

守給你的承諾、 提交于 2019-11-27 23:42:46
问题 I have an object which owns a property Texture_ID. I need to initialize the value for Texture_ID in constructor, so I want some value unused by OpenGL to present that the texture is not yet set. I don't know whether zero (0) is a good value? If there is a range that OpenGL applies to texture IDs, I want a value out of this range. Any idea? 回答1: 0 is the value you're looking for (to represent an unset texture ID/uncreated texture), as 0 is never a valid texture ID. 回答2: I would rather

How do I apply proper perspective to this OpenGL ES texture?

眉间皱痕 提交于 2019-11-27 22:49:01
问题 I would like to describe my objective and get some feedback of a proposed solution. I am quite new to OpenGL ES (or OpenGL at all), so please be gentle. I would also like to mention that the platform is iPad (iOS) with it's belonging restrictions. Objective: To let the user place vertices in which a texture should be drawn properly in the correct perspective (or at least adjustable perspective). To explain what I mean, consider the following example. Let's say that we have a photograph of a