Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - legalian

Pages: [1]
1
Graphics / OpenGL on Yosemite produces flashing screen
« on: July 22, 2018, 12:29:48 am »
Hello,
I'm trying to set up a SFML project with some OpenGL elements drawn over. I've tried following examples I've found online, but they either produce a black screen or a screen such as the one i've attached. Here is the code I'm currently using:

initialization:
    videomode =sf::VideoMode::getFullscreenModes()[resolution];
    sf::ContextSettings settings;
    settings.majorVersion = 2;
    settings.minorVersion = 1;
   
    window.create(videomode,"Opengl",fullscreen?sf::Style::Fullscreen:sf::Style::Default,settings);
    window.setFramerateLimit(60);
    sf::Image icon;
    if (!icon.loadFromFile(resourcePath() + "icon.png")) throw;
    window.setIcon(icon.getSize().x, icon.getSize().y, icon.getPixelsPtr());
    if (!starfont.loadFromFile(resourcePath() + "sansation.ttf")) throw;
    window.setVerticalSyncEnabled(true);
    glEnable(GL_TEXTURE_2D);
    glewExperimental = GL_TRUE;
    glewInit();
    glViewport(0, 0, videomode.width, videomode.height);
    window.setActive(true);
    glClearDepth(1.f);
    glClearColor(0.3f, 0.3f, 1.f, 1.f);
    glEnable(GL_DEPTH_TEST);
    glDepthMask(GL_TRUE);
 


Main loop:
    go->window.setActive(true);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    checkError();
 

My checkError() function calls glGetError() and prints the error if there is one.

Has anyone run into a similar problem?

EDIT: The code I put here originally wasn't a minimal example, so here's a more minimal example without any vbos or anything. I'm just aiming for a window with a solid fill color, but this gives me a window that flashes between my fill color and the glitchy screen.


Pages: [1]
anything