Tag Info

New answers tagged

0

As stated previously, layering is done in LWJGL by drawing everything in a certain order. I'd like to add a little to the responses people have given to answer your specific question: " if the player goes in front of the tree/enemy (lower than the objects y-coordinate) then show the player in front), if the player goes behind the tree/enemy (higher than the ...


0

If you want it to be in update, you can use the setCenterX and setCenterY methods. mouseImage.setCenterX(Mouse.getX()); mouseImage.setCenterY(Mouse.getY()); However Y coordinates are going to be reversed. If you want them to correspond to proper ones you can do: mouseImage.setCenter(container.getInput().getMouseY());


1

One way of doing this is creating and loading an image into memory that is as large as the background. However, this seems like a horrible waste of memory. To affect the whole screen with a fragment shader you don't need a full-screen texture, just a full-screen polygon (one quad or two triangles). The four vertices would have attributes on them. At the ...


0

I suggest you make a skybox: A skybox is a large cube which you render around your camera which will give you the ability to pass each pixel through a fragment shader. And you can render anything onto the skybox: a color, an image, a gradient, etc. Just be sure to call glClear(GL_COLOR_BUFFER_BIT || GL_DEPTH_BUFFER_BIT); A good tutorial on this topic is ...


1

If you are just filling with a solid color then you could pass that color to the fragment shader as a uniform, and process it from there. Use a full screen quad for the fragment shader to render onto. Another way is to this to render the background to an FBO and do the full screen quad trick but apply the FBO texture to it. This would be very memory ...


1

Yes! I have figured it out. LWJGL texture files must have dimensions equal to powers of 2 (2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048 etc). Otherwise OpenGL will clamp them to nearest power.


0

You could also use a jar bundler to create a .app and .exe with your icon.


0

I'm sure there is an implemented way of doing this in lwjgl, but you could just find the lwjgl image png and replace it with your png.


1

What a dump question. I put the cubemap to the wrong samplerCube. I assigned the map to cubemap[1] not cubemap[0]. Great example of "I wouldn't do something like this. The error must be somewhere in the OpenGL code!" :D


0

There are multiple issues with this code. First of all your quad vertices are not centered around the origin, this doesn't have to be a problem but note that it will use the corner of the quad as the pivot to rotate the sprite then. Secondly, you are rotating on the X-axis. This seems weird since the general direction your camera in looking in is the -Z ...


1

The way to do this is with a FBO (Frame Buffer Object). You can render each pass to a FBO and use it as a texture input in the next stage, any kind of deferred shading and post processing is reliant upon this functionality. https://www.opengl.org/wiki/Framebuffer_Object


0

You can useDisplay.getWidth() / 2 - (Your truetypefont).getWidth(your text) / 2 to center it horizontally



Top 50 recent answers are included