New answers tagged

0

LWJGL is a low level framework that includes window creation, input handling and other low level features. Libgdx is a full featured 2d and 3d game framework that is built on top of LWJGL. The typical workflow for drawing a triangle on screen with LWJGl is: 1- Create a window using the included GLFW3 framework. 2- Create an Opengl context using the built in ...


0

LWJGL is Lightweight Java Game Library. It is not engine. LWJGL is a Java library that enables cross-platform access to popular native APIs useful in the development of graphics (OpenGL), audio (OpenAL) and parallel computing (OpenCL) applications. This access is direct and high-performance, yet also wrapped in a type-safe and user-friendly layer, ...


3

LibGDX is based on LWGL and its advantage are that a lot of the base stuff is already written and you don't need to write it. Some people prefer to write it themselves though. LibGDX is generally used in mobile game development, but can also be used on Windows, Mac and Html. Some final words: For beginners I would suggest using LibGDX, because it is easier ...


1

A guess (too long to put in a comment): If spotFactor becomes 0.6 at a specific pixel, from this float spotFactor = dot(lightDirection, spotLight.direction); then color goes negative here (as you said spotLight.cutoff is 0.71): color = calcPointLight(spotLight.pointLight, normal) * (1.0 - (1.0 - spotFactor)/(1.0-spotLight.cutoff)); will ...


1

There is at least one serious problem in the code. In calcLight(), the test below is invalid. Calling pow with a negative first argument is undefined behaviour, so you need to test specularFactor sooner. float specularFactor = dot(directionToEye, reflectDirection); specularFactor = pow(specularFactor, specularPower); if(specularFactor > 0) ...


4

Unexpectedly black pixels sometimes indicate that you've got an infinity or NaN in the shader somewhere. For example normalize(vec3(0,0,0)) will generate a NaN. To me, the most obvious candidate in the above shader is the reflectDirection variable, but I could be wrong. GLSL has isinf() and isnan() functions that you can use to detect those cases. If that ...


2

At first glance, this looks far too complicated. Lwjgl should have something to the effect of 'getmouseposition()'. Call this function every iteration of your game loop, cast or set it as a Vec2d, then use that position to blit or draw the mouse you want. All of your blits should be called every game iteration in some kind of draw loop. Mind you, I was ...



Top 50 recent answers are included