New answers tagged

2

I know it's stupid to answer my own question but... With very, very big thanks to @Ben I fixed this problem by creating SDL_Surface and load image to it once for each TextureAsset and store it inside TextureAsset instead of creating new SDL_Surface for same texture and free it each draw call.


0

Expanded post on comment:"JSON is just a means of storing text information right? Why not just hold a path to the sprite in the JSON file? Then whenever you obtain the information in the JSON file, call Resources.Load (jsonPath); ?" The JSON language cannot directly load Sprites into Unity3D. However, as JSON can deal with strings, we can quite easily hold ...


0

I found that rendering dynamic Entity-textures in XNA such as cubes or "planes" needs alot of HLSL knowledge, how to throw in shaders and more. I scrapped my XNA project and started with Java OpenGL "LWJGL". ThinMatrix had a good tutorial series with a quick runtrough of the glsl shader system. with "dynamic" I meant rendering and changing the ...


1

So here's the deal with 9 patches (or as @hamza-hasan called them in the comments "9 slice scaling"). Either way the concept the same. The concept is pretty simple. Slice your source image up into 9 sections as shown in the image below. For reference I've drawn 4 red lines to represent how the texture might be sliced up to create the 9 patches. I've also ...


1

I don't know if this could help you, but this is everything I do for good MipMapping: public int loadTexture(String fileName){ Texture texture = null; try { texture = TextureLoader.getTexture("PNG", new FileInputStream("res/textures/"+fileName+".png")); GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D); //I preffer LINEAR_MIPMAP because ...


2

As suggested in the comments, you should try to use Tri-Linear filtering and MipMaps. The reason using TextureFilter.MipMapLinearLinear results in a black box is that you haven't generated the texture with MipMaps. In order to do so, simply pass a second parameter to the Texture constructor as true like so: img = new Texture("circle.png", true);


0

I found out that it was a lack of memory that helped me to open the picture.


0

Looks like putting images in asset folder and loading them using BitmapFactory.decodeStream(ins) would increase loading speed a lot. See this post for details


2

You shouldn't call dispose directly on a Texture loaded by an AssetManager, they are disposed the the AssetManager is cleared or disposed or if you call unload on the AssetManager and pass the Texture. The reason you shouldn't dispose assets from an AssetManager is that they can be shared between many other assets (two fonts may use the same texture for ...


1

You would need to convert your texture into a rectangle, which is just a position and size. Your entity that is displaying the texture, should have the position, and the texture itself could potentially hold the size (this is completely dependent on how you are currently doing your spritebatch draw calls). It would end up looking something like: Dim ...


3

The texture regions inside don't need to be powers of two. But texture compression cells are often 4x4 so you have to be careful when using compressed textures that the edges of two texture regions don't share the same cell or they'll be compressed together which will degrade the quality if they have different colors. You should leave a N pixel border ...


0

It might be your system or limitations in WebGL. Unless the screen you are resizing to is a Power-of-two texture. (POT/NPOT) Then your selections for read and write pixels would be off. From the docs for the Texture-Importer: It is possible to use other (non power of two - “NPOT”) texture sizes with Unity. Non power of two texture sizes generally take ...


0

There is much simpler solution for re-sizing. public static Texture2D Resize(Texture2D source, int newWidth, int newHeight) { source.filterMode = FilterMode.Point; RenderTexture rt = RenderTexture.GetTemporary(newWidth, newHeight); rt.filterMode = FilterMode.Point; RenderTexture.active = rt; Graphics.Blit(source, rt); nTex = new ...


1

I would say Edge padding. (Even if you have disabled MipMaps) If the ‘gutters’ (blank areas between UV’s) have colors/transparencies that are very different from the colors inside the UV’d areas, then those colors can ‘bleed’ together which creates seams on the model. This problem will also occur when neighbouring UV shells have different colors; as the ...


0

One way of achieving this would be to save the portion of the screen where they've made their edits by taking a screen shot using the ScreenUtils.getFrameBufferPixmap method and then dumping the Pixmap data to a file using the PixmapIO class that can write PNGs from a Pixmap. public class ScreenshotFactory { private static int counter = 1; public static ...



Top 50 recent answers are included