Tag Info

New answers tagged

2

Use polar coordinate system. Cast Moon's position to polar coordinates by formulas: r = sqrt( sqr(Moon_x - Earth_x) + sqr(Moon_y - Earth_y) ); phi = atan2( Moon_y - Earth_y, Moon_x - Earth_x ); Then, you can change angle (phi) to move Moon around the center: phi += angular_speed; And after that cast changed polar coordinates back to cartesian ...


8

You already know what you have to do, I'll just summarize it. There are three ways to solve your problem: Go ahead and make a conditional like you're saying, either by sampling the texture or by creating a separate uniform for this purpose. As you probably know, adding branching on a shader is almost never a good idea, and much less so in the fragment ...


1

What you want is a curvilinear perspective projection matrix to correct for the perspective projection distortion. aka barrel or pincushion projection: http://en.wikipedia.org/wiki/Curvilinear_perspective Basically, you distort the image with a projection that is the opposite of the distortion you don't want so it all comes out straight in the end. ...


0

You are most likely using compressed images on disk, when you try to access the data like images or audio files, the library is most likely decompressing them. One way to reduce memory is to use compressed texture formats. I don't know about libgdx but this is the way to go to reduce memory usage for textures. Regarding audio files, you can use lower ...


3

it's trivial, you can do it yourself. Assuming your sprites have alpha value 0 in unused areas, you can do the following (in pseudocode): pixels_out = pixels for y in pixels.height() for x in pixels.width() if pixels(x,y).alpha == 0, neighbour_in_sprite = false for y2 in [-1,0,1] for x2 in [-1,0,1] ...


6

You're not missing anything. The normal matrix exists in case the upper-left 3x3 of your regular model-view transformation is unsuitable for transforming normals (that is, contains non-uniform scale or other craziness). If you know the upper-left 3x3 is always suitable for use in the transformation of normals, there's no reason to bother with a separate ...


0

I suppose mobiles do not have dedicated Graphics cards (they have integrated GPUs) , so they utilize the RAM available on the device. To measure, you can try to allocate memory for textures until you run out of memory in order find an approximate limit on the VRAM available.



Top 50 recent answers are included