Hello Guest

Recent Posts

Pages: 1 ... 8 9 [10]
91
Bug Reports / RFE / Error JVM with glDraysArrays (VBO)
« Last post by Fire_Blaim on September 26, 2020, 13:40:45 »
I tried to develop with your great lib a vbo but when I start the program I have a jvm crash... I'm on arch linux in 64bits thanks for helping me !

Code: [Select]
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x0000000040901f3c, pid=5673, tid=0x00007fc363f18640
#
# JRE version: Java(TM) SE Runtime Environment (8.0_261-b12) (build 1.8.0_261-b12)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.261-b12 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  0x0000000040901f3c
#
# Core dump written. Default location: /home/fireblaim/Documents/GitHub/Template-LWJGL-3/core or core.5673
#
# An error report file with more information is saved as:
# /home/fireblaim/Documents/GitHub/Template-LWJGL-3/hs_err_pid5673.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

Code: [Select]
package fr.fireblaim.template.game;

import org.lwjgl.BufferUtils;

import java.nio.FloatBuffer;

import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL15.*;

public class Game {

    int vbo;
    int cbo;

    int vertexSize = 2;
    int colorSize = 3;

    int verticesSize;

    FloatBuffer vertexBuffer;
    FloatBuffer colorBuffer;

    public Game() {
        verticesSize = 2 * 2 * 4;

        vertexBuffer = BufferUtils.createFloatBuffer(verticesSize * vertexSize);
        colorBuffer = BufferUtils.createFloatBuffer(verticesSize * colorSize);

        int size = 1;

        colorBuffer.put(1).put(1).put(1);

        vertexBuffer.put(1).put(1);
        vertexBuffer.put(1 + size).put(1);
        vertexBuffer.put(1 + size).put(1 + size);
        vertexBuffer.put(1).put(1 + size);

        vertexBuffer.flip();
        colorBuffer.flip();

        vbo = glGenBuffers();
        cbo = glGenBuffers();

        glBindBuffer(GL_ARRAY_BUFFER, vbo);
        glBufferData(vbo, vertexBuffer, GL_STATIC_DRAW);

        glBindBuffer(GL_ARRAY_BUFFER, cbo);
        glBufferData(cbo, colorBuffer, GL_STATIC_DRAW);

        vertexBuffer.clear();
        colorBuffer.clear();
    }

    public void render() {
        glEnableClientState(GL_VERTEX_ARRAY);
        glEnableClientState(GL_COLOR_ARRAY);

        glBindBuffer(GL_ARRAY_BUFFER, vbo);
        glVertexPointer(vertexSize, GL_FLOAT, 0, 0L);

        glBindBuffer(GL_ARRAY_BUFFER, cbo);
        glVertexPointer(colorSize, GL_FLOAT, 0, 0L);

        glDrawArrays(GL_QUADS, 0, verticesSize);

        glDisableClientState(GL_VERTEX_ARRAY);
        glDisableClientState(GL_COLOR_ARRAY);
    }

    public void update() {

    }

}

I made a display class that worked and i don't forget the swapBuffers function.... I'm a beginner so I'm sorry if my code is not perfect and i'm french sorry for my bad english !
92
Read this: https://github.com/JOML-CI/JOML/wiki/Common-Pitfalls#angles-are-always-in-radians

Currently, you are passing 90 radians to Matrix4f.perspective()

made these getters and replaced camera.Zoom with camera.getZoom
i also replaced other things where necessary which is really only this:
Code: [Select]
front.x = (Math.cos(getYaw()) * Math.cos(getPitch()));
front.y = Math.sin(getPitch());
front.z = (Math.sin(getYaw()) * Math.cos(getPitch()));

It was an improvement of the white pixels being shown roughly 3 seconds instead of 1
video:https://drive.google.com/file/d/1xMTHa97qqNcODF4NdxA5TgCmpp7jMYSi/view?usp=sharing
so that wasnt the entire solution
93
Read this: https://github.com/JOML-CI/JOML/wiki/Common-Pitfalls#angles-are-always-in-radians

Currently, you are passing 90 radians to Matrix4f.perspective()
94
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
95
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
96
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.
97
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
98
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();
99
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
100
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
Pages: 1 ... 8 9 [10]