like i said, it has been a while, but i had those same issues back than.... but i did use several hundreds of threads, i did test with a 1000 threads, no performance issues, but clipping.albinopapa wrote:Yeah, if you are on the correct thread, the chili framework is already double-buffered, so the frames don't get updated until all is drawn to back buffer, so it's not an issue of seeing pixels from previous frames.NaturalDemon wrote:Hmmmm, if i remember correctly, you draw several hundreds of frames per second depending on your hardware.
But you only need max 60 Fps, i believe you see pixels from the previous frame drawn over the current frame.
You should build a state machine with a timer .... That updates a complete drawn frame instead of a partial frame to the gpu buffer once per 16 milisecond (ms). 1000 ms / 60 fps = 16.xxx ms
You only have 1 "backbuffer" and you keep updating those pixels while presenting to the gpu.
You could make a second buffer and alternate between them.
But you need a mechanism to slow down.
Help with math
-
- Posts: 97
- Joined: October 28th, 2012, 8:28 pm
Re: Help with math
Re: Help with math
erm, was referring to "forum thread" haha xD (not sure if albinopapa was referring to same thing), tho if you're referring to the kind of clipping that would be called "screen tearing" then he would have to turn on DX's vsync
always available, always on, about ~10 years c/c++, java[script], win32/directx api, [x]html/css/php/some asp/sql experience. (all self taught)
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat --
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat --
-
- Posts: 4373
- Joined: February 28th, 2013, 3:23 am
- Location: Oklahoma, United States
Re: Help with math
vsync is accomplished in DX 11 by the IDXGISwapchain::Present function
it is set to 1 in the framework, so it does have vsync enabled.
And yeah, I was talking about forum threads not CPU threads,.... and how many threads did you have running?
Code: Select all
HRESULT Present(
UINT SyncInterval, // <- 0 to disable vsync, 1-4 to enable
UINT Flags
);
And yeah, I was talking about forum threads not CPU threads,.... and how many threads did you have running?
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com
Re: Help with math
You are a wild man NaturalDemon.NaturalDemon wrote:like i said, it has been a while, but i had those same issues back than.... but i did use several hundreds of threads, i did test with a 1000 threads, no performance issues, but clipping.albinopapa wrote:Yeah, if you are on the correct thread, the chili framework is already double-buffered, so the frames don't get updated until all is drawn to back buffer, so it's not an issue of seeing pixels from previous frames.NaturalDemon wrote:Hmmmm, if i remember correctly, you draw several hundreds of frames per second depending on your hardware.
But you only need max 60 Fps, i believe you see pixels from the previous frame drawn over the current frame.
You should build a state machine with a timer .... That updates a complete drawn frame instead of a partial frame to the gpu buffer once per 16 milisecond (ms). 1000 ms / 60 fps = 16.xxx ms
You only have 1 "backbuffer" and you keep updating those pixels while presenting to the gpu.
You could make a second buffer and alternate between them.
But you need a mechanism to slow down.
Chili
Re: Help with math
result on image with a code below
Code: Select all
for (int a = 0; a < heigth; a++) {
for (int b = 0; b < width; b++) {
PutPixel((x+width) - b, (y+heigth) - a, image[b + a * width].GetR(), image[b + a * width].GetG(), image[b + a * width].GetB());
PutPixel(x, y, 255, 0, 0);
}
}
Code: Select all
if (bullets[a].y <= 0) {//if at the edge draw backwards
bullets[a].height -= bullets[a].speed;
bullets[a].y+= bullets[a].speed;
gfx.DrawSpriteBackW(bullets[a].x, bullets[a].y, bullets[a].width, bullets[a].height, Novalvl1, 0, 0, 0);
}else{ // if not at the edge draw normal
gfx.DrawSprite(bullets[a].x, bullets[a].y, bullets[a].width, bullets[a].height, Novalvl1, 0, 0, 0);
}
https://youtu.be/ePiNun8kIQ0
-
- Posts: 4373
- Joined: February 28th, 2013, 3:23 am
- Location: Oklahoma, United States
Re: Help with math
Just out of curiosity, why are you wanting to flip the image when the bullet gets to top of screen?
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com
Re: Help with math
imagine this , bullets goes y-- , and meteors goes y++ meteors draw backwards and bullets normal , so i can detect collision easily later , and if its bullet wont hit anything and reach edge then just collapse , at least i think so , of course i will need sprite collision so that might be not that important later , and will be easy to change , i am not sure yet i mean how i will deal with thatalbinopapa wrote:Just out of curiosity, why are you wanting to flip the image when the bullet gets to top of screen?
Re: Help with math
heh, might wanna read my previous post (b4 my last post xD)
always available, always on, about ~10 years c/c++, java[script], win32/directx api, [x]html/css/php/some asp/sql experience. (all self taught)
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat --
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat --
Re: Help with math
sorr for being stupid solved :
Code: Select all
int cc = (width * heigth) - 1;
for (int a = 0; a < heigth; a++) {
for (int b = 0; b < width; b++) {
PutPixel(x - b, y - a, image[cc].GetR(), image[cc].GetG(), image[cc].GetB());
PutPixel(x, y, 255, 0, 0);
cc--;
}
}
Re: Help with math
hmm, flipping verticly and horizontly? all you needed was to flip verticly in this case xD
hmm, what's the point of this line tho?
don't think you have to 'overwrite' the previous location (it would've most likely been erased cuz of screen clearing)
Code: Select all
int cc = (width * heigth) - 1;
for (int a = 0; a < heigth; a++) {
for (int b = 0; b < width; b++) {
int offset = a + (height - b) * width;
PutPixel(x, y - a, image[offset].GetR(), image[offset].GetG(), image[offset].GetB());
}
}
Code: Select all
PutPixel(x, y, 255, 0, 0);
always available, always on, about ~10 years c/c++, java[script], win32/directx api, [x]html/css/php/some asp/sql experience. (all self taught)
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat --
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat --