Tag Info

New answers tagged

0

It seems that BufferedImage does not keep that kind of information from the original PNG file. The type of the BufferedImage may or may not correlate with the type of the PNG. You can check the type of the BufferedImage with BufferedImage.getType(), which may help you, but the implementation of image loading is free to convert the images to other formats at ...


1

Your problem is your translation matrices. You are not translating enough. Your quad starts at position (50, 50) and is of size (200, 200). That means we have 4 vertices: ( 50, 50) (250, 50) (250, 250) ( 50, 250) You are applying a translation of 200/2 (100) on both axis, which will transform your vertices to these: (-50, -50) (150, -50) (150, 150) ...


3

In very broad strokes, you can accomplish this by: Yes, using shaders Binding three textures to the shader program before drawing On your polygons, have the usual UV vec2 for each vertex. This is used by any of the textures Have another attribute which is "weight of each texture at this vertex". It could be a vec3 or three separate floats. For the ...


2

To get decent performance, you should define your own private class FloatArray which contains a float[] values; (lowercase f !) and an integer count which keeps track of the "logical" size. When there are no elements, set values to a new array of 16 items and count to zero. Then when you need to add elements, check whether count is greater than or equal ...


1

You cannot use a standard array without knowing its size. You must use an ArrayList. But that is not where your lag is coming from. You have an issue with your algorithm. If you share your code, we can help you beat it into submission. I suggest just starting and finishing with an ArrayList. If you are creating a new ArrayList and adding the objects ...


4

There are a few ways to manipulate individual pixels in 3D graphics APIs. The simplest is to render a 1x1 primitive. Contrary to what you are assuming, this is not that inefficient. Rendering primitives (triangles) is what the 3D graphics API and hardware are designed to do. If you're already rendering a bunch of geometry anyway, a few hundred extra ...


2

You're not actually rotating the light - at least not in the direction you think you are. You said you're using LightDir[1]++ to change the direction of the light. The direction starts as (0, 0, -1) - the negative Z direction (which appears to be towards the camera, in your program). After you press the "rotate light" key a bunch of times, the light ...



Top 50 recent answers are included