Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled exception at 0x00007FFD22983B29 Microsoft C++ exception: std::runtime_error (Error when loading SCREEN with GLFW) #458

Open
rede676 opened this issue Oct 5, 2020 · 0 comments

Comments

@rede676
Copy link

rede676 commented Oct 5, 2020

after putting:

// Create a nanogui screen and pass the glfw pointer to initialize
screen = new Screen();
screen->initialize(window, true);

I get error Unhandled exception at 0x00007FFD22983B29 in Janus Engine.exe: Microsoft C++ exception: std::runtime_error at memory location 0x000000CD1659F590.

Full File

`#include <glad/glad.h>
#include <GLFW/glfw3.h>

#define NOMINMAX

#include

#include "RenderManagement.h"
#include <nanogui/nanogui.h>
#include

using namespace nanogui;

void framebuffer_size_callback(GLFWwindow* window, int width, int height);
void processInput(GLFWwindow* window);

void mouse_callback(GLFWwindow* window, double xpos, double ypos);
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset);

RenderManagement* m_render_management;

Screen* screen = nullptr;

int main()
{
glfwInit();

glfwSetTime(0);


glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

glfwWindowHint(GLFW_SAMPLES, 0);
glfwWindowHint(GLFW_RED_BITS, 8);
glfwWindowHint(GLFW_GREEN_BITS, 8);
glfwWindowHint(GLFW_BLUE_BITS, 8);
glfwWindowHint(GLFW_ALPHA_BITS, 8);
glfwWindowHint(GLFW_STENCIL_BITS, 8);
glfwWindowHint(GLFW_DEPTH_BITS, 24);
glfwWindowHint(GLFW_RESIZABLE, GL_TRUE);


GLFWwindow* window = glfwCreateWindow(1600, 1200, "Janus Engine", NULL, NULL);
if (window == NULL)
{
    std::cout << "Failed to create GLFW window" << std::endl;
    glfwTerminate();
    return -1;
}
glfwMakeContextCurrent(window);

if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))
{
    std::cout << "Failed to initialize GLAD" << std::endl;
    return -1;
}

glClearColor(0.2f, 0.25f, 0.3f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);

// Create a nanogui screen and pass the glfw pointer to initialize
screen = new Screen();
screen->initialize(window, true);

glViewport(0, 0, 1800, 1200);

glfwSwapInterval(0);
glfwSwapBuffers(window);

glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);

glfwSetCursorPosCallback(window, mouse_callback);
glfwSetScrollCallback(window, scroll_callback);

// tell GLFW to capture our mouse
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);

m_render_management = new RenderManagement();

while (!glfwWindowShouldClose(window))
{
    processInput(window);

    m_render_management->Render();

    glfwSwapBuffers(window);
    glfwPollEvents();
}


glfwTerminate();
return 0;

}

void framebuffer_size_callback(GLFWwindow* window, int width, int height)
{
glViewport(0, 0, width, height);
}

void processInput(GLFWwindow* window)
{
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
{
glfwSetWindowShouldClose(window, true);
}

m_render_management->processInput(window);

}

void mouse_callback(GLFWwindow* window, double xpos, double ypos)
{
m_render_management->mouse_callback(window, xpos, ypos);
}

void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
{
m_render_management->scroll_callback(window, xoffset, yoffset);
}`

@rede676 rede676 changed the title Unhandled exception at 0x00007FFD22983B29 in Janus Engine.exe: Microsoft C++ exception: std::runtime_error at memory location 0x000000CD1659F590. Unhandled exception at 0x00007FFD22983B29 Microsoft C++ exception: std::runtime_error (Error when loading SCREEN with GLFW) Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant