lwjglgamedev / lwjglbook-bookcontents-leg Goto Github PK
View Code? Open in Web Editor NEWBook contents for the book "3D Game Development with LWJGL 3" (https://ahbejarano.gitbook.io/lwjglgamedev/).
Book contents for the book "3D Game Development with LWJGL 3" (https://ahbejarano.gitbook.io/lwjglgamedev/).
Hi!
On OSX if you use Retina display, glfwSetWindowSizeCallback does not work properly. See the related forum topic here: http://forum.lwjgl.org/index.php?topic=5976.0
Using glfwSetFramebufferSizeCallback fixes the problem.
I had a short discussion with the LWJGL guys, I think it does worth to use the explanation from that chat in the memory management part.
http://forum.lwjgl.org/index.php?topic=6488.0
Some online forums posts and LWJGL 3 blogs (http://forum.lwjgl.org/index.php?topic=6351.msg33842#msg33842 http://blog.lwjgl.org/memory-management-in-lwjgl-3) mention the preference to use methods other than BufferUtils to allocate memory for buffer objects, recommending memAlloc and/or stackAlloc.
Should the use of BufferUtils throughout the code/book be replaced with these preferred methods?
In the shader file, this line has a typo:
newNormal = texture(material.normalMap, text_coord).rgb;
It should be normalMap only, not material.normalMap
Chapter1 is followed by Chapter10. Logically it should be followed by Chapter2.
I noticed that while the license for this project is Apache 2.0, it does not include a copyright year or a copyright holder.
In the latest release of LWJGL, there is STBImage class for loading images. Is there any particular reason to use PNGDecoder in the book?
If you wish I can rewrite the needed chapter :)
Hi,
I really enjoy your gitbook, it's very helpful! However in the texture chapter, I feel like you should at least mention how to work with alpha values in an image. It's not even that hard from what I googled (https://learnopengl.com/Advanced-OpenGL/Blending). Of course, I can always pull the repository and add it myself and then do a pull request. I just would like to know your thoughts on this matter.
Cheers!
Hi!
I learn OpenGL using your tutorial, thinmatrix's tutorials and learnopengl.com's tutorials. I do not copy the codes, write my own mixing the knowledge I learned from all of them.
Yesterday I debugged a lot when I finished to implement my lightning, because light was so strange (simple cube exported from blender):
https://drive.google.com/open?id=0Bz3i57GvpVZhYXRqRlpzY2lYQnM
Debugged hours and found that all of my code is OK(?), so I started to think is my obj ok as well?
I downloaded the dragon and it was OK. Downloaded your cube.obj from the source code and it was OK as well.
https://drive.google.com/open?id=0Bz3i57GvpVZhMUFaUWI4dnZLbEk
The interesting thing is that I downloaded several cube.obj files from the internet, and all of them were wrong, such as:
https://drive.google.com/open?id=0Bz3i57GvpVZhVUh5eFVNUm5YZWM
So my question is: I followed your and thinmatrix's tutorials as how to export OBJ from blender and I fail. What could be the problem? I just open blender, export and use this settings:
https://drive.google.com/open?id=0Bz3i57GvpVZhSHFXRm9GcDQwOVk
And I got the strange colors as it was shown on the first link.
Am I doing something wrong in blender? Is my code the bad guy?
One more thing: I use for OBJ loading the thinmatrix's approach, but tried the failing cube.obj files with your objloader as well, but nothing changed.
I use CentOS now, Intellij Idea and the latest Java/LWJGL/Blender.
First I would like to thank you very much for this awesome tutorial. It is rare that I have the patience to read through pages of explanations but your writing is very easy to follow.
I am having problems with the rendering of the system fonts in Chapter 12 part 3. As you can see on the screen shot some letters seem to have misaligned texture. It is supposed to read "M m M D d". I am running your maven project with Eclipse with JRE version: OpenJDK Runtime Environment (11.0+28) on a windows 10. I did not see any problems in previous chapters but I tried running some of the projects towards the end (for example chapter 28) and I get a crash. I could create a new issue but maybe it is related. Maybe my system is corrupted. Anyway when I run chapter 28, the window appears very small in the top left corner and disappear with the following console message:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffde6472503, pid=9620, tid=16872
#
# JRE version: OpenJDK Runtime Environment (11.0+28) (build 11+28)
# Java VM: OpenJDK 64-Bit Server VM (11+28, mixed mode, tiered, compressed oops, g1 gc, windows-amd64)
# Problematic frame:
# C [ntdll.dll+0x12503]
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\Users\ramho\eclipse-workspace\lwjglbook\chapter28\hs_err_pid9620.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
So, I'm working on a sort of Minecraft-like clone, and everything worked great up until I added the lighting system. Without ambient light, every mesh is completely black. My first thought was that the normals I was supplying were wrong, but I don't think so. This is how I define my normals: new Vector3f(1, 0, 0)
this specific normal is used on a left-facing face, and I have tried flipping the normals.
After I found out it wasn't working, I copied and pasted the shader code and lighting code, so that's not the problem. I really don't see what could be wrong. The only light that works is ambient.
Here is my code for creating the light sources:
ambientLight = new Vector3f(0.5f, 0.5f, 0.5f);
pointLight = new PointLight(new Vector3f(1.0f, 1.0f, 1.0f), new Vector3f(0, 0, 0), 100.0f, new Attenuation(1.0f, 0.0f, 0.0f));
directionalLight = new DirectionalLight(new Vector3f(1.0f, 1.0f, 1.0f), new Vector3f(-1.0f, -1.0f, 0.0f), 100.0f);
If you have any suggestions for what I should be doing or what I can do to debug, please let me know. Thank you.
Full source code is available here: https://github.com/cjburkey01/Cubulus
You do it like this when computing the vertex normals:
v0.normal.add(normal).normalize();
v1.normal.add(normal).normalize();
v2.normal.add(normal).normalize();
Is it correct?
It seems to me that the newly added normal will take more weight if there're more than 2 triangles and It's not an arithmetic mean.
Am I missing something?
Hi all.
My question and source code will be based on secion 9 (camera) because IMHO there is no need to go any further to explain my problem or post my whole source code.
In my application I want to have a 3D scene (all objects expecting hud, text a.s.o. are in 3D space) but they are shown only from one side, camera will not be movable. You could imagine a plattformer game. But there should be more than one layer for the backgrounds (textured quads will be ok I think) and this make a problem, because the z-buffer differences result in scaling/resizing of the textured quads, since the objects are at different distances to the camera. How do I avoid the resizing /scaling of my objects done by the perspective projection?
I don't want to solve this with the orthographic 2D scene.
I tried to implement it in 2 to ways, the z coordinate set for all positions to 0.
First way was in the vertex shader after all projections:
gl_Position.z=(u_zOffset-1.0)*gl_Position.w;
Second way in the fragment shader, setting the the end the gl_fragDepth to some value, range [0, 1], for example:
gl_FragDepth = 0.5f;
Both methods didn't have any effects. What do I wrong? Is there an other way to go?
regards
The source code for the book itself is also publishd in GitHub.
that line is missing an "e" in published.
It seems that updates to this repository are not being compiled into the website https://lwjglgamedev.gitbooks.io/3d-game-development-with-lwjgl anymore.
For example, the page https://lwjglgamedev.gitbooks.io/3d-game-development-with-lwjgl/content/chapter06/chapter6.html still references a very old JOML version 1.9.6 (from 2017), but the version has been updated many times in the GitHub repo already.
I am assuming that this also applies to any other of the many many changes to the book.
After rendering UI with NanoVG, you restore the state. You forgot to restore the GL_CULL_FACE stuff. Maybe default state should be set at one place.
Hi!
Was left for a while trying Unity, got sick of it! :D
Back again, and started from scratch again, to get a deep understanding now.
Here is the current issue I found.
The indices wrong for the cube.
These will be good though:
// Front face 0, 1, 3, 3, 1, 2, // Top Face 4, 0, 3, 5, 4, 3, // Right face 3, 2, 7, 5, 3, 7, // Left face 6, 1, 0, 6, 0, 4, // Bottom face 2, 1, 6, 2, 6, 7, // Back face 7, 6, 4, 7, 4, 5,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.