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

Pages: [1]
1
Graphics / Re: Draw pixels in real-time
« on: April 03, 2024, 04:17:38 pm »
Thank you very much for your help, everything is very clear. I will come back if needed.
Have a good day.

2
Graphics / Re: Draw pixels in real-time
« on: March 31, 2024, 07:18:20 am »
Sorry for the late reply. Thank you very much.
If I understand correctly, when I call renderTexture.getTexture(), the texture does not go back through the RAM; it stays on the graphics card, even if I use it to draw something else afterwards. Is that correct? And using an sf::RenderTexture would be the method that most closely resembles SDL, where everything is thought of in terms of pixel arrays, wouldn't it?
Another question. When using an sf::RenderTexture, what should the coordinates of the drawn vertices be for them to correspond properly to the points of the texture? If I'm not mistaken, an sf::Point vertex at (0.,0.) doesn't draw anything. Should the points be offset by 0.5 to hit the correct pixels?
I also did some tests with fragment shaders. Is the GLSL loaded by SFML portable across other platforms? For example, I code on macOS and I believe SFML uses OpenGL 2.1 in this environment. Will my shaders work on other platforms with more modern versions of OpenGL?
Thanks again for your help.
Have a good day.

3
Graphics / Draw pixels in real-time
« on: March 15, 2024, 02:33:46 pm »
Hello,
I'm looking to draw pixels in real-time with SFML, and I'm hesitating between sf::Image and sf::RenderTexture. What happens internally with these classes? What's the best practice between this,
sf::Image image;
image.create(1920, 1080);

image.setPixel(100, 200, sf::Color::Red);

sf::Texture texture;
texture.loadFromImage(image);
sf::Sprite sprite(texture);
window.clear();
window.draw(sprite);
window.display();
 
and that ?
sf::RenderTexture renderTexture;
renderTexture.create(1920, 1080);

renderTexture.clear();
sf::Vertex vertices[] = {sf::Vertex(sf::Vector2f(100, 200), sf::Color::Red)};
renderTexture.draw(vertices, 1, sf::Points);
renderTexture.display();

sf::Sprite sprite(renderTexture.getTexture());
window.clear();
window.draw(sprite);
window.display();
 


4
Window / full screen
« on: February 24, 2024, 05:55:15 pm »
Hello,
I cannot open a full screen window on MacBook M2 Pro. getFullscreenModes() returns nothing. What can I do?

Pages: [1]
anything