textures

Libgdx save SpriteBatch in a texture

蹲街弑〆低调 提交于 2019-12-10 11:42:58
问题 I would like to know if it possible to save a spriteBatch in a texture . SpriteBatch batch = new SpriteBatch(); After drawing a few thing inside the batch , I would like to save all thing that contains the SpriteBatch in One texture (something like a screenshot ). I have no idea to how to do it, I searched on the web and on the libgdx doc but didn't found. Thanks you 回答1: You can render to a FrameBufferObject (FBO). See https://github.com/mattdesl/lwjgl-basics/wiki/FrameBufferObjects An FBO

copyTextureToTexture results in horrible aliasing artifacts in three.js

大城市里の小女人 提交于 2019-12-10 11:38:09
问题 When I use copyTextureToTexture to copy texture1 with a loaded image to texture2 -a datatexture created with the same dimensions and format, I get strong aliasing artifacts like all GPU filtering is disabled -most of it at least, as anisotropy seems to work partially. I'm struggling for the last 2-3 days to find a solution, but still I'm not sure if this is a three.js bug, or am I missing something. Any help will be appreciated. Even a WEBGL solution is welcome, as long as it can work along

Three.js Repeat texture fail

ε祈祈猫儿з 提交于 2019-12-10 11:24:22
问题 I'm trying to make a simple floor texture, but it seems that wrapS and wrapT don't works. Look at the result: http://hpics.li/321350c var texture = THREE.ImageUtils.loadTexture( "Game/Texture/drytext.png" ); texture.wrapS = THREE.RepeatWrapping; texture.wrapT = THREE.RepeatWrapping; texture.repeat.set( 4, 4 ); var floorMaterial = new THREE.MeshBasicMaterial( { map: texture, side: THREE.DoubleSide }); var floorGeometry = new THREE.PlaneGeometry(20, 20, 10, 10); var floor = new THREE.Mesh

glGenerateMipmap - non-power-of-2

六眼飞鱼酱① 提交于 2019-12-10 10:55:05
问题 Environment Ubuntu 17.04, Chrome 60. Runs this example local without warnings/errors : https://github.com/mdn/webgl-examples/tree/gh-pages/tutorial/sample6 Then replace cubetexture.png with an non-power-of-2 image here : https://github.com/mdn/webgl-examples/blob/gh-pages/tutorial/sample6/webgl-demo.js#L220 Got as expected warnings/errors : [.Offscreen-For-WebGL-0x13d050ba2c00]RENDER WARNING: texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible

OpenGL - Texture mapping in vertex or fragment shader?

倖福魔咒の 提交于 2019-12-10 10:24:40
问题 Is there texture of an object/triangles mapped in the fragment shader or the vertex shader? Whether if it is on the vertex or fragment shader, if you are programming shaders it's something that you have to code yourself right? Without shader you just assinged the tex coords and opengl mapps it without you knowing, but with shaders you have to do it yourself, right? 回答1: Usually the texturing happens in the fragment shader. This is the place where triangle's fragments gain a color. Usually in

DDS texture loading

瘦欲@ 提交于 2019-12-10 10:20:00
问题 How would I load a dds texture file into an OpenGL 2dtexture or cube map texture? 回答1: I believe you use the glCompressedTexImage2DARB method and its friends. This PDF seems to contain some promising info that may be helpful to you. 回答2: Depending on your needs, the DevIL library can take care of feeding OpenGL with a DDS file content. 回答3: If the DDS contains a compressed texture then use glCompressedTexImage2DARB(), if it contains uncompressed data the usual glTexImage2D procedure applies.

Reasonable texture sizes in android

℡╲_俬逩灬. 提交于 2019-12-10 06:26:18
问题 I'm trying to develop an app that uses opengl on android, and ideally make it run on any phone as old as the original droid (or at least any phone that has OpenGL ES 2.0 support). Currently, I'm using a 2048x2048 ETC1 texture compression. It works fine on the Droid X I'm testing it on, but I currently don't have an original droid to test it on, and I can't find much data on this topic either. I know the G1 didn't do well with textures bigger than 512x512, and the droid seems to do fine with

OpenGL Textures form SDLSurface goes too dark

此生再无相见时 提交于 2019-12-10 03:49:10
问题 I've quite the same problem than this OpenGl goes too dark but the answer doesn't work for me. I'm trying to display a image thanks to a surface converted to a texture and the result is too damn dark: Original: after openGL On the left is the original, on the right the OpenGl img. Here's my code: void TexturedRect::draw(int scroll){ glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glBindTexture(GL_TEXTURE_2D, _texture); glEnable(GL_TEXTURE_2D); glBegin(GL_QUADS); //Begining the cube's drawing

OpenGL texture tilted

有些话、适合烂在心里 提交于 2019-12-09 20:09:34
问题 When I load a texture in OpenGL and this has one ( GL_ALPHA ) or three components per pixel ( GL_RGB ), the texture appears tilted. What makes this happen? As additional detail, the relation width/height seems to affect. For example, an image of 1366x768(683/384) appears tilted while an image of 1920x1080(16/9) is mapped correctly. 回答1: This is probably a padding/alignment issue. GL, by default, expects rows of pixels to be padded to a multiple of 4 bytes. A 1366 wide texture with 1 byte or 3

libGDX- Exact collision detection - Polygon creation?

試著忘記壹切 提交于 2019-12-09 19:04:50
问题 I've got a question about libGDX collision detection. Because it's a rather specific question I have not found any good solution on the internet yet. So, I already created "humans" that consist of different body parts, each with rectangle-shaped collision detection. Now I want to implement weapons and skills, which for example look like this: Skill example image Problem Working with rectangles in collision detections would be really frustrating for players when there are skills like this: