Hello Guest

Recent Posts

Pages: 1 ... 6 7 [8] 9 10
71
Camera:https://pastebin.com/Vb1xFir6
Main:https://pastebin.com/wMchBSbV
shaders:https://pastebin.com/UmQyRFNs

The problem is that i should see a model of a dragon befor i added the camera that worked about fine.
now i can only see some white pixels that disapear really fast even when i keep setting the position of the camera to 0 -3 0
this means that something is wrong with my rendering.
I would appreciate some help
72
Lightweight Java Gaming Library / Re: Why do all my Vectors get messed up
« Last post by coolian on September 20, 2020, 14:52:09 »
nvm there isnt
73
Lightweight Java Gaming Library / Re: Why do all my Vectors get messed up
« Last post by coolian on September 20, 2020, 14:47:01 »
somewhere in here https://pastebin.com/Vb1xFir6
is still an error but it propably is'nt related to this question.
74
Lightweight Java Gaming Library / Re: Why do all my Vectors get messed up
« Last post by KaiHH on September 20, 2020, 12:39:55 »
Code: [Select]
Matrix4f viewMatrix = new Matrix4f();
Vector3f pos = Position;
Vector3f up = Up;
Vector3f front = Front;
viewMatrix = viewMatrix.lookAt(pos, pos.add(front), up);
that is done because im pretty sure doing
Code: [Select]
viewMareiy.lookAt(Position, Position.add(Front), Up);would change the Position vector which for creating the view matrix i obviously dont want.
There is absolutely zero difference between your first code and the second line... You just assign the same instance to new local variables, that still point to the same object instance.
Therefore, you still modify the vector stored in Position/pos. You can do something like:
Code: [Select]
viewMareiy.lookAt(Position, Position.add(Front, new Vector3f()), Up);
in order to store the addition result in a new vector object.

Also, please read this first: https://github.com/JOML-CI/JOML/wiki/Common-Pitfalls#methods-without-a-dest-parameter-modify-this-and-return-this
75
Lightweight Java Gaming Library / Re: Why do all my Vectors get messed up
« Last post by coolian on September 20, 2020, 11:50:15 »
Ok i just gotta not do Math.toRadians();
76
Lightweight Java Gaming Library / Re: Why do all my Vectors get messed up
« Last post by coolian on September 20, 2020, 11:44:42 »
Code: [Select]
front.x = (float) (Math.cos(Math.toRadians(Yaw)) * Math.cos(Math.toRadians(Pitch)));
front.y = (float) Math.sin(Math.toRadians(Pitch));
front.z = (float) (Math.sin(Math.toRadians(Yaw)) * Math.cos(Math.toRadians(Pitch)));
Front = front.normalize(Front);
those calculations are the problem it seems they mess up x
77
Lightweight Java Gaming Library / Re: Why do all my Vectors get messed up
« Last post by coolian on September 20, 2020, 11:37:38 »
The FRONT Constant gets messed up but idk where because its not when it gets created
78
Lightweight Java Gaming Library / Why do all my Vectors get messed up
« Last post by coolian on September 19, 2020, 23:41:16 »
I have  a Camera class:https://pastebin.com/ykmAj8zv
and the xyz components of the Vectors from joml get set to nan for some reason in any other class the only thing hats being done to it is telling the camera to process keypresses mousescroll and mouse position data aswell as getting the view matrix, getting the zoom and creating it
the reason things like
Code: [Select]
Matrix4f viewMatrix = new Matrix4f();
Vector3f pos = Position;
Vector3f up = Up;
Vector3f front = Front;
viewMatrix = viewMatrix.lookAt(pos, pos.add(front), up);
that is done because im pretty sure doing
Code: [Select]
viewMareiy.lookAt(Position, Position.add(Front), Up);would change the Position vector which for creating the view matrix i obviously dont want.
Why do all the Vectors get messed up.
79
OpenGL / Re: Why do fragment shaders actually work?
« Last post by KaiHH on September 17, 2020, 13:55:52 »
You can query the actual depth bits via:
Code: [Select]
glGetFramebufferAttachmentParameteri(GL_FRAMEBUFFER, GL_DEPTH, GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE)
on any (including the default) framebuffer.
I don't think that you will get anything better than a 24 bits depth buffer for the default framebuffer on any hardware. Just look at the output of glxinfo.
If you explicitly want a 32-bit depth buffer, you are going to have to create a custom framebuffer object.
80
OpenGL / Re: Why do fragment shaders actually work?
« Last post by Source_of_Truth on September 17, 2020, 12:48:34 »
Most/all drivers, when linking a GLSL program with a single fragment shader output variable, will assign that output variable to framebuffer color attchment 0.

Okay, that answers 90% of my question, basically everyone assumes that it works this way and paranoid people like me just do a

Code: [Select]
glBindFragDataLocation(programId, 0, "fragColor" );

before linking the program with the fragment shader in the original post. Thanks.

As for the GLFW hints regarding color depth: The graphics card supports a list of fixed render buffer configurations, most commonly 8 bits per pixel for all color channels with optionally a 24-bit depth buffer and 8-bit stencil buffer. The hint you give to GLFW only specifies that the actual framebuffer configuration you get when GLFW creates the window will at least have that many bits per color channel (but not fewer).

Okay, but how exactly do I then control the exact format of my render framebuffer in an LWJGL setup then?

The whole GLFWWindow obviously does a ton of magic, among them probably calls to glRenderbufferStorage(), especially since resizeable windows are supported.

So you are saying that the following code

Code: [Select]
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_API);
glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_NATIVE_CONTEXT_API);

glfwWindowHint(GLFW_RED_BITS, 8);
glfwWindowHint(GLFW_GREEN_BITS, 8);
glfwWindowHint(GLFW_BLUE_BITS, 8);
glfwWindowHint(GLFW_ALPHA_BITS, 8);
glfwWindowHint(GLFW_DEPTH_BITS, 32);
glfwWindowHint(GLFW_STENCIL_BITS, 0);

will probably produce a GL_RGBA8 + GL_DEPTH_COMPONENT32F buffer, but I cannot be sure? Like it could also be a GL_SRGB8_ALPHA8 + GL_DEPTH32F_STENCIL8 one?

Basically, I would like to e.g. ensure that the stencil bits I do not care about are put to good use in the example above, instead of an "inferior" depth resolution and 8 dead bytes.
Pages: 1 ... 6 7 [8] 9 10