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

Pages: [1]
1
General / tryng to use sfml, opengl to draw on the same window
« on: November 02, 2016, 09:22:36 pm »
Im trying to use opengl and sfml to draw stuff on a same screen, it is and i followed the sfml tutorial. this is my code structure

glDraw...

window.pushGLStates();

window.draw(...);

window.popGLStates();

glDraw...

but the error i get is that   OpenGL error (1282) detected in user code, you should check for errors with glGetError(). what could have gone wrong, please help

2
I'm trying to create a vector which contains several rectangles (blockRect) in the block class, when the third rectangle (blockRect) in the vector array hit another rectangle (endRect) defined in another class, it (the third blockRect in the vector) should be deleted in the vector, but it gives me a error: vector subscript out of range, I can't figure out why, any help please?

this is the code which I try to delete the third blockRect in the vector (there is 4 blockRect in Vec1, and Vec 2 basicly contains endRect for collision):

for (int i = 0; i < Vec2.size(); i++) {
        if (Vec2.endRect.getGlobalBounds().intersects(blocksClass.Vec1[2].blockRect.getGlobalBounds())) {
            blocksClass.Vec1.erase(blocksClass.Vec1.begin() + 2);
    }
}


Pages: [1]