New answers tagged

1

A background really isn't anything but an image that you draw before anything else. The easiest way to do that is to import the image using image.load() and save it to the variable background. After doing that create a new variable background_y that saves the position of where the background is. After that, go to your update function and decrement ...


2

If I'm reading this right, the answer seems to be right there in the continuation of that line: metallic - the metallic-ness (0 = dielectric, 1 = metallic). This is a linear blend between two different models. The metallic model has no diffuse component and also has a tinted incident specular, equal to the base color. (With the implication that ...


3

SurvivalMachine nailed one of your problems (you can see that the texture is repeated twice). Your other problem (the texture is a big blob instead of a crosshair) is because you don't use transparency : some of the completely transparent pixels of your texture have a green color value (that's a common sight with optimized PNGs). Just enable blending with ...


2

Maybe there's more problems, but at least this looks incorrect: gl.glTexCoord2f(2f, 1.0f); Your texture is repeated horizontally 2 times because its wrap mode is repeat and the coordinates you set are over 1 (in this case 2f). To fix this, replace 2f with 1f: gl.glTexCoord2f(1f, 1.0f);


0

I'm assuming you have paintComponent() already set up. You just need to use java.util.Timer and java.util.TimerTask. Timer is a class that runs a method implemented in TimerTask after a delay. TimerTask is an abstract class that allows you to implement the method that Timer runs. The function that Timer runs is TimerTask's run(). In TimerTask's run(), you ...


0

How many times are you calling render from the Tile class? Because every time you do it adds 5 new enemys. If you are calling that render method a lot then I would suggest moving the for loop to the constructor.


1

OK, assuming that render() gets called once per frame you are telling your game to create 5 new enemies every frame in the tile class. This would lead to creating hundreds of enemies per second. I think you only want to use that for loop once when initialising the game. That way you will only make 5 (until you decide to make more). look in the ...


0

Arc lengths for Bezier curves are only closed form for linear and quadratic ones. For cubics, it is not guaranteed to have a closed solution. The reason is arc length is defined by a radical integral, for which has a closed for only 2nd degree polynomials. Just for reference: The length of a quadratic Bezier for the points (a,p) (b,q) and (c,r) is (a^2ยท(...


2

When you have a 2d game with pixel-art graphics, having a fixed resolution makes many things far easier. You know exactly how much fits on the screen without having to stretch your graphics (and automatic resizing by non-integer factors really hurts the image quality on pixel art). There are games where the camera-space doesn't have much effect on the ...


2

Think of your question in terms of tessellation with your sphere formed by rings. If you have a tessellation factor of 5, you will have a top cap, 2 middle sections, and a bottom cap. The bottom two tessellation ring being the 25% bottom cap and the top tessellation two rings the 25% top cap. The center is therefore one ring at the equator with a set of ...


0

In your Main you create an Engine object an Call run() on it. But in the constructor you also Call run. Could it be that you have two Threads where you want only one ?


1

In the case of a masked texture, only fully opaque pixels should update the depth buffer. Any pixel that is partially or completely transparent should not update the depth buffer. Updating the depth buffer will prevent pixels of greater depth from being drawn/calculated, and pixels with alpha need to blend with pixels in the background. If no blending occurs,...


0

Try changing the value of MAX_BUFFER_STRATEGY to 2, it sounds to be like there isn't a doubble buffer on the code, if nto comment below the rest of the code, and i will have a mess around with it later on, or might be able to see something else.


1

The cubemaps used in Image Based Lighting should only contribute to the scene once because they don't represent light coming from a single light source like your point lights for example, but from every direction from the environment. This means that they should be added to the light buffer only once, which you could do in either of these passes: In the ...


3

There are two factors that I've found to be the simplest and easiest way to decide which of the available GPUs will be the most powerful for a game: Device Type (Discrete vs. Integrated vs. Other) Graphics Memory Now of course for gaming more VRAM doesn't always mean better performance (a 980 Ti [6GB] usually outperforms a Titan X [12GB] in games) but in ...



Top 50 recent answers are included