I got problem with my code:
for (int i = 0; i < grs::arr_genres.size(); i++)
{
_genre_ID.setString(std::to_string(grs::arr_genres[i].genre_ID));
_genre_ID.setPosition(windowSize1 - 1200, windowSize2 - 800 + fontsize + 10 * i);
_gname.setString(grs::arr_genres[i].genre_name);
_gname.setPosition(windowSize1 - 1200, windowSize2 - 800 + fontsize * 2 + 10 * i);
window.draw(_genre_ID);
window.draw(_gname);
}
Without window.draw(...)
everything works fine, even drawing text in every other place works good, like here:
text.setFont(font);
text.setFillColor(sf::Color::Black);
text.setPosition(x_center + 5, y_center + 10);
text.setStyle(sf::Text::Regular);
text.setCharacterSize(20);
text.setString(str);
window.draw(text);
This is part of code where I'm making button. However, at that one exact place mentioned in first block of code I keep getting Exception thrown at 0x01307C04 in Sem3-2019-MatUr.exe: 0xC0000005: Access violation reading location 0x00000000.
Also in this place I see glcontext.cpp not found
I just downloaded it from SFML github page - and clicked Browse and find glcontext.cpp...
and it showed that it is error connected with methodvoid GlContext::initResource()
exactly line 319, resourceCount++;
. Have anyone idea what is happening? Also I've noticed that this text is displayed in window only at first iteration of sf::RenderWindow loop. I tested puting static text like _gname.setString("static")
, even without loop, and it still puts error. Any ideas how to solve that?
User contributions licensed under CC BY-SA 3.0