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

Pages: [1]
1
Window / Re: Conflict OpenGL - SFML?
« on: November 26, 2019, 02:36:08 pm »
That's plausible. Now I can handle it, thanks.

2
Window / Re: Conflict OpenGL - SFML?
« on: November 25, 2019, 11:05:07 am »
That doesn't explain the problem since I can't see why to clear the depth buffer and stencil buffer, too, when only drawing a plain texture. But it solves the problem, the code below works well. Some questions are left, but that's a matter of OpenGL not of SFML. Thank you.

void CScreen2::Update (float timestep) const {
    glClear (GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
    window->clear (sf::Color (25, 50, 100, 255));
    DrawTexture (texid, 100, 100, 1, OR_BOTTOM);
    window->display();
}
 

3
Window / Conflict OpenGL - SFML?
« on: November 24, 2019, 05:08:07 pm »
Hello
I've a question about the following code:

void CScreen2::Update (float timestep) const {
    glClearColor (0.1, 0.2, 0.4, 1.0);
    sf::RenderWindow *window = app.winctrl.GetWin ();  // get a pointer to the instance of RenderWindow
    window->clear (sf::Color (25, 50, 100, 255));
//      glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
    DrawTexture (texid, 100, 100, 1, OR_BOTTOM);    // drawn in classic opengl manner
    window->display();
}
 

Update() is a callback, called in every frame. In this function I've to draw a lot of things with OpenGL, not with SFML graphics. The texture is only a test object. The code above doesn't work, it shows the empty background, not the texture. But when I change the window->clear() call with glClear() then all seems to be ok. Same when I add the line with glClear().
Could anyone explain this effect?

Pages: [1]
anything