OpenGL – die neusten Beiträge

Java ImGui Error EXCEPTION_ACCESS_VIOLATION?

Ich habe ein Tutorial von GamesWithGabe geschaut (2d game Engine) und habe beim Imgui part einen Fehler bekommen. Ich musste vom Tutorial schon vieles ändern, wegen neuen Versionen. Jetzt bekomme ich beim Aufstartet folgenden Error:

08:38:22: Executing ':Main.main()'...


> Task :compileJava UP-TO-DATE
> Task :processResources NO-SOURCE
> Task :classes UP-TO-DATE


> Task :Main.main() FAILED
Hello LWJGL 3.3.6+1!
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffbcc295071, pid=7900, tid=15668
#
# JRE version: OpenJDK Runtime Environment Temurin-21.0.6+7 (21.0.6+7) (build 21.0.6+7-LTS)
# Java VM: OpenJDK 64-Bit Server VM Temurin-21.0.6+7 (21.0.6+7-LTS, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)
# Problematic frame:
# C  [igxelpicd64.dll+0xd45071]
#
# 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:\dev\Java\SuperMariusImGui\JAVA_Loic_Steiner_SuperMarioProjekt\hs_err_pid7900.log
#
# If you would like to submit a bug report, please visit:
#   https://github.com/adoptium/adoptium-support/issues
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
2 actionable tasks: 1 executed, 1 up-to-date


FAILURE: Build failed with an exception.


* What went wrong:
Execution failed for task ':Main.main()'.
> Process 'command 'C:\Program Files\Eclipse Adoptium\jdk-21.0.6.7-hotspot\bin\java.exe'' finished with non-zero exit value 1


* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.


BUILD FAILED in 1s
08:38:24: Execution finished ':Main.main()'.

Wieso bekomme ich diesen Error und wie kann ich den Fixen?? Ich brauche wirklich Hilfe, ich mache ein Projekt und muss Freitag abgeben.

programmieren, Java, Informatik, OpenGL, .gradle

WebGL - Clip Space | Pixel Space?

// Renderer Beispiel
 render(){
       const s2  = new Square(300, 100, 70, [0, 1, 1, 1]);
       s2.setup(this.context, this.program); 
       s2.render(this.program, this.context, deltaTime);

       this.vertexManager.draw(3, 0, 4, 100, 100, 0, [0,0,1,1]);
 }
// 

export class Square extends Renderable {
    constructor (x, y, size, color) {
        super();
        this.x = x;
        this.y = y;
        this.size = size;
        this.color = color;
        this.vertices = new Float32Array([
            -size / 2, -size / 2,
            size / 2, -size / 2,
            size / 2, size / 2,
            -size / 2, size / 2,
        ]);
        this.vertexBuffer = null;
        this.colorBuffer = null;
        this.transformationMatrix = createIdentityMatrix3();
    }

    setup (gl, program) {
        this.vertexBuffer = gl.createBuffer();
        gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer);
        gl.bufferData(gl.ARRAY_BUFFER, this.vertices,  gl.STATIC_DRAW);
    }

    updateTransformationMatrix (x, y, scaleX, scaleY, angle) {
        const translationMatrix = createTranslationMatrix(x, y);
        const rotationMatrix = createRotationMatrix(angle);
        const scalingMatrix = createScalingMatrix(scaleX, scaleY);

        // Combine the matrices: translation * rotation * scaling
        const combinedMatrix = multiplyMatrices(rotationMatrix,          multiplyMatrices(translationMatrix, scalingMatrix));

        // Save the transformation matrix
        this.transformationMatrix = combinedMatrix;
    }


    render (program, gl, camera, deltaTime) {
        gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer);

        // Re-enable the vertex attribute array
        const positionLocation = gl.getAttribLocation(program, 'a_position');
        gl.enableVertexAttribArray(positionLocation);
        gl.vertexAttribPointer(positionLocation, 2, gl.FLOAT, false, 0, 0);

        const colorLocation = gl.getUniformLocation(program, 'u_color');
        gl.uniform4fv(colorLocation, this.color);

        const matrixLocation = gl.getUniformLocation(program, 'u_matrix');
        this.updateTransformationMatrix(this.x, this.y, 1.0, 1.0,  0);
        gl.uniformMatrix3fv(matrixLocation, false, this.transformationMatrix);

        gl.drawArrays(gl.TRIANGLE_FAN, 0, this.vertices.length / 2 + 1);
    }
}

export default class VertexManager {
    constructor (gl, program) {
        this.gl = gl;
        this.program = program;
        this.buffers = new Map();
        this.initBuffers();
    }

    initBuffers () {
        this.createBuffer(BUFFER_TYPES.CIRCLE, createPolygonVertices(64, 1));
        this.createBuffer(BUFFER_TYPES.SQUARE, new Float32Array([
            -0.5, -0.5,
            0.5, -0.5,
            0.5, 0.5,
            -0.5, 0.5,
        ]));
    ....
    }

    createBuffer (type, vertices) {
        const buffer = this.gl.createBuffer();
        this.gl.bindBuffer(this.gl.ARRAY_BUFFER, buffer);
        this.gl.bufferData(this.gl.ARRAY_BUFFER, vertices, this.gl.STATIC_DRAW);
        this.buffers.set(type, { buffer, vertexCount: vertices.length / 2 });
    }

    draw (type, x, y, scaleX, scaleY, rotation, color) {
        const { buffer, vertexCount } = this.buffers.get(type);

        this.gl.bindBuffer(this.gl.ARRAY_BUFFER, buffer);

        // Re-enable the vertex attribute array
        const positionLocation = this.gl.getAttribLocation(this.program, 'a_position');
        this.gl.enableVertexAttribArray(positionLocation);
        this.gl.vertexAttribPointer(positionLocation, 2, this.gl.FLOAT, false, 0, 0);

        // Setup the color
        const colorLocation = this.gl.getUniformLocation(this.program, 'u_color');
        this.gl.uniform4fv(colorLocation, color);

        const matrixLocation = this.gl.getUniformLocation(this.program, 'u_matrix');
        // Create transformation matrices directly in pixel space
        const translationMatrix = createTranslationMatrix(x, y);
        const rotationMatrix = createRotationMatrix(rotation);
        const scalingMatrix = createScalingMatrix(scaleX, scaleY);

        // Combine them: translationMatrix * rotationMatrix * scalingMatrix
        const combinedMatrix = multiplyMatrices(rotationMatrix, multiplyMatrices(translationMatrix, scalingMatrix));

        // Pass the transformation matrix to the shader
        this.gl.uniformMatrix3fv(matrixLocation, false, combinedMatrix);

        this.gl.drawArrays(this.gl.TRIANGLE_FAN, 0, vertexCount);
    }
}

Meine Frage ist, warum mein Quadrat korrekt im Pixel-Space gerendert wird, während die draw-Operation in meinem VertexManager Clip-Space zeichnet, obwohl beide denselben Shader verwenden. Ich habe das Problem schon seit Stunden versucht zu lösen. Hat jemand eine Lösung oder einen Hinweis, was ich möglicherweise falsch mache?

Bild zum Beitrag
JavaScript, Code, OpenGL, Webentwicklung

Computer mit Software statt mit Hardware schneller machen?

Also meine Idee wäre das man z.B. die Bildausgabe von Spielen und auch von alltäglichen Dingen über Software beschleunigt, und sagen wir mal das man aus 10fps -> 100 fps machen kann. Das wäre auch recht ökologisch da der Energiebedarf nicht steigen würde da der Computer diengleichen Watt verbraucht und nicht höher takten muss. Außerdem kann man sich so die Herstellung von neuen Teilen ersparen, welche gerade bei Aluminium extrem viel Energie verbraucht.

Neuere Computer könnten ebenfalls profitieren und mit eben noch weniger Taktrate das gleiche erreichen. Weniger Auslastung würde auch die Kühlung begünstigen und wieder Energie sparen. Auch die Reduzierung von übertragenen Daten im Netzwerk kann hilfreich sein und so die Latenz verbessern und dazz verhindern das Internetknoten überlastet werden.

Selbstverständlich ist desto weniger Ram auch besser da so mehr Ram für andere Arbeiten frei bleibt um idealfall nichts auf das Speichermedium geschrieben/gelesen werden muss.

Was haltet ihr davon? Habt ihr Umsetzungsideen? Oder vielleicht sogar konkrete Software?

Finde ich nicht so gut 77%
Finde ich von Vorteil 23%
PC, Computer, Computerspiele, Handy, Betriebssystem, Mathematik, Linux, CPU, Grafikkarte, Hardware, Elektronik, programmieren, RAM, Gaming, Update, AMD, Intel, Nvidia, OpenGL, Softwareentwicklung, Treiber, DirectX, x86, Laptop

Welche Engine würdet ihr benutzen um 2D Games für Android zu programmieren?

Zur Erklärung: ich habe bis jetzt schon sehr viel für Android mit Java in Android Studio programmiert und bin hier nun an die Grenzen des SurfaceViews gestoßen ..... die Performance. Bei meinem letzten Spiel hatte ich nur noch mit Glück um die 25FPS (mit Glück lief die draw() und update() Methode 25mal pro Sekunde durch ... meistens deutlich weniger) und das ist einfach zu wenig. Jetzt meine Frage, wie würdet ihr mir Empfehlen jetzt weiter zu machen ? Soll ich weiter für Android programmieren, aber diesmal mit einer Engine ? Ich habe in absehbarer Zeit nur vor 2D Spiele zu entwickeln. Es wäre schön, wenn ich bei Java bleiben könnte, da ich jetzt schon seit fast 3 Jahren mit Java programmiere. Und jetzt zur eigentlichen Frage: welche Engine würdet ihr mir empfehlen ?

  • (am wichtigsten) Es sollte viele Tutorials dazu geben (egal ob auf Deutsch oder Englisch)
  • Ich würde gerne bei Java bleiben
  • die Engine sollte kostenlos benutzbar sein und man sollte auch Apps ohne weitere kosten mit dieser Engine veröffentlichen können
  • (optimal) wäre wenn die Engine keine Werbung ins Spiel für sich einbaut
  • (davon hab ich keine Ahnung) Wie sieht es mit Cross-Plattfrom Support aus ?

Bitte antwortet nicht einfach nur mit einem Wort (dem Engine namen )... sondern begründet die Antwort auch in Bezug auf die 5 Punkte.

Computer, App, Technik, programmieren, Java, engine, Android, OpenGL, Technologie, Unity, Spiele und Gaming

Meistgelesene Beiträge zum Thema OpenGL