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 - matjoeman

Pages: [1]
1
Window / Re: Why does SFML with an Opengl 3.0 context draw twice?
« on: April 15, 2013, 08:14:49 am »
I repeated the test without drawing the triangles and the error is the same. glClear draws the wrong color and there is still the black bar. I also tried with glClearColor set to red and in the OpenGL 3.0 context it drew magenta which again is incorrect.

I repeated the test under Arch Linux with Mesa 9.1.1 and got the same results.

I wrote another test using freeglut and glutinitcontextversion to 3.0 and there were no issues, so I think this is somehow an SFML problem.

2
Window / Why does SFML with an Opengl 3.0 context draw twice?
« on: April 14, 2013, 04:01:12 am »
I've been working on a 3D application using SFML for context creation and OpenGL 3.0. For some reason when I attempt to create the context using OpenGL 3.0 it seems to draw the image slightly narrowed and doubled with a black bar in between, and the screen seems to be cleared with green instead of red for some reason. If I change the context to 2.1 it draws normally. Originally I was having this problem using modern OpenGL code but I've provided a sample using the fixed function pipeline so that the problem is clearer.

#include <SFML/Window.hpp>
#include <SFML/OpenGL.hpp>

int main()
{
    // create the window
    sf::ContextSettings settings;
    settings.depthBits = 24;
    settings.stencilBits = 8;
    settings.antialiasingLevel = 4;
    settings.majorVersion = 3;
    settings.minorVersion = 0;

sf::Window window(sf::VideoMode(800, 600), "OpenGL", sf::Style::Default, settings);

// load resources, initialize the OpenGL states, ...
glClearColor(1.0, 0.0, 0.0, 1.0);

// run the main loop
bool running = true;
while (running)
{
    // handle events
    sf::Event event;
    while (window.pollEvent(event))
    {
        if (event.type == sf::Event::Closed)
        {
            // end the program
            running = false;
        }
    }

    // clear the buffers
    glClear(GL_COLOR_BUFFER_BIT);

    // draw...
    glBegin(GL_TRIANGLES);
    glVertex3f( 0.0, 1.0, 0.0);
    glVertex3f(-1.0,-1.0, 0.0);
    glVertex3f( 1.0,-1.0, 0.0);
    glEnd();

    // end the current frame (internally swaps the front and back buffers)
    window.display();
}

return 0;
}
If I Change these two lines:
   settings.majorVersion = 3;
   settings.minorVersion = 0;
To these:
   settings.majorVersion = 2;
   settings.minorVersion = 1;
The window draws normally.

Here are screenshots of what is happening.




The second image is a little messed up because my computer lagged. It shouldn't have that orange tone.

My setup is:

Ubuntu 12.10 Intel i7-3630QM Intel HD Graphics 4000

From glxinfo: OpenGL renderer string: Mesa DRI Intel(R) Ivybridge Mobile OpenGL version string: 3.0 Mesa 9.0.2 OpenGL shading language version string: 1.30

From lspci: Kernel driver in use: i915

I thought this might be a driver issue but I've had success running OpenGL 3.0 programs using GLUT and no deprecated functionality so it must have been creating a valid OpenGL 3.0 context and working.

I'm very confused as to why this is happening.

Pages: [1]
anything