Question

I'm developing an OpenGL application using the sb6::application framework provided by SuperBible v6, and although it always works fine on my computer (even when I run the executable outside of my DE), no one else who I send it to can get it to run. It can't be an issue with OpenGL versions, since my friend has v4.2. (I have v4.3, but it's an extremely rudimentary program so I highly doubt I've done anything exclusive to v4.3) It might have to do with a missing file since the window just closes instantly when he starts it, but I can't figure out what file. It might be a .dll or something (I've assumed that I can just put any needed .dlls in the same folder as the executable) but I haven't been able to find out which one. I got my friend to run DependencyWalker and I specifically tracked down and sent him the ones that DependencyWalker said he was missing, and there was still no improvement.

SuperBible has absolutely no documentation on the sb6::application class and doesn't give any information about how to set up a project to be portable. Or if it does I haven't been able to find it even after days of searching.

Not sure which parts of the code are relevant to post, but here are the init() and startup() functions from the sb6::application class.

void init()
{
    // Redirect output to this file.
    //freopen("myoutput.txt", "w", stdout);

    ready = false;

    static const char title[] = "Forkits";

    sb6::application::init();

    memcpy(info.title, title, sizeof(title));

}

void save_viewport_size()
{
    // Get the size of the window
    glGetIntegerv(GL_VIEWPORT, m_viewport);
    std::cout << m_viewport[0] << " " << m_viewport[1] << " " << m_viewport[2] << " " << m_viewport[3] << std::endl;
}

void startup(void)
{

    // Check version
    GLint version = 0;
    //glGetFloatv(GL_VERSION, &version);
    //glGetIntegerv(GL_VERSION, &version);
    //std::cout << "Version number " << glGetString(GL_VERSION) << std::endl;
    //printf("%s %s\n", glGetString(GL_RENDERER), glGetString(GL_VERSION));

    // Save the size of the initial viewport
    glGetIntegerv(GL_VIEWPORT, m_viewport);
    std::cout << m_viewport[0] << " " << m_viewport[1] << " " << m_viewport[2] << " " << m_viewport[3] << std::endl;

    program = glCreateProgram();
    GLuint vs = glCreateShader(GL_VERTEX_SHADER);
    glShaderSource(vs, 1, vs_source, NULL);
    glCompileShader(vs);

    print_shader_log(vs);

    GLuint fs = glCreateShader(GL_FRAGMENT_SHADER);
    glShaderSource(fs, 1, fs_source, NULL);
    glCompileShader(fs);

    print_shader_log(fs);

    glAttachShader(program, vs);
    glAttachShader(program, fs);

    glLinkProgram(program);

    print_linker_log(program);

    glGenVertexArrays(1, &vao);
    glBindVertexArray(vao);

    // Set parameters
    glSamplerParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    glSamplerParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    glSamplerParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);

    // Set up alpha blending
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    ready = true;
    flag_running = true;

    int init_success = Forkits::init(&sprites);

    logic = new std::thread(old_main);

}
Was it helpful?

Solution

You're right, you should just be able to put the .dlls in the same directory as the executable and it'll work. It's possible that sb6 is reliant on other .dlls that you have but your friend doesn't. Or more likely, your friend's .dlls are out of date. That is one route of investigation. It is interesting that the window opens up successfully, and then closes. To me, that points to a problem setting up your OpenGL context. Can you post the code that you call to set up OpenGL?

Another, and in my opinion, better route to take would be to remove sb6 from your application entirely and switch to another, more portable application framework. Sb6 is only intended for practice, if you want a more robust framework I would switch. Since you've only done a small project using sb6, now is also an excellent time to change over because the code changes would be minimal and (relatively :)) painless. Here are a few libraries I suggest:

SDL - My personal favorite. It'll do everything from setting up a window, handling input, networking, playing sounds, and even threading. And it (claims) to be completely portable. Be warned, however. They just went through a major update (1.2 to 2.0) and the documentation hasn't completely caught up yet.

GLFW - If you're making a dedicated OpenGL application, this might be a better option. Since it's built from the ground up to work with OpenGL (unlike SDL, which first and foremost is a windowing framework and doesn't care what you put in the windows) it's faster to set up to work with OpenGL.

SFML - Appears to be a varient of SDL. To be honest, I haven't used this one before, but if you like it, tell me how it is!

There are others out there as well, but these are the big three I've heard of. Let me know if you have any questions about running them.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top