Skip to content

game #462

Description

@daniyal4181

/ #include <GLFW/glfw3.h>
//#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>

int main() {
// Initialize GLFW
if (!glfwInit()) return -1;

// Create a window
GLFWwindow* window = glfwCreateWindow(800, 600, "3D Game", NULL, NULL);
if (!window) {
    glfwTerminate();
    return -1;
}

// Make the window's context current
glfwMakeContextCurrent(window);

// Main loop
while (!glfwWindowShouldClose(window)) {
    // Clear the screen
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    // Draw something (e.g., a cube)
    glm::mat4 model = glm::mat4(1.0f);
    glm::mat4 view = glm::lookAt(glm::vec3(0, 0, 5), glm::vec3(0, 0, 0), glm::vec3(0, 1, 0));
    glm::mat4 projection = glm::perspective(glm::radians(45.0f), 800.0f / 600.0f, 0.1f, 100.0f);

    // Swap buffers
    glfwSwapBuffers(window);

    // Poll events
    glfwPollEvents();
}

glfwTerminate();
return 0;

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions