flat assembler
Message board for the users of flat assembler.

Index > Windows > Picture in window from memory address

Author
Thread Post new topic Reply to topic
Fastestcodes



Joined: 13 Jun 2022
Posts: 75
Fastestcodes
Which is the fastest way?
Post 04 Jul 2022, 06:50
View user's profile Send private message Reply with quote
Fastestcodes



Joined: 13 Jun 2022
Posts: 75
Fastestcodes
How can we do this?
Read pic0 to mem0
read pic1 to mem1
read pic2 to mem2
read pic3 to mem3
Label0:
Show pic0 (in window) from mem0
wait 10ms
show pic1 from mem1
wait 10ms
show pic2 from mem2
wait 10ms
show pic3 from mem3
wait 10ms
jmp Label0
Post 05 Jul 2022, 14:45
View user's profile Send private message Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 652
Location: Russia
macomics
Why 10 ms? 25 fps = 40 ms
Post 05 Jul 2022, 14:50
View user's profile Send private message Reply with quote
Fastestcodes



Joined: 13 Jun 2022
Posts: 75
Fastestcodes
0ms-5000ms
Post 05 Jul 2022, 18:56
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 18846
Location: In your JS exploiting you and your system
revolution
Fastestcodes wrote:
Which is the fastest way?
... to ...
Fastestcodes wrote:
wait 10ms
You want to wait in the fastest way possible?

Maybe this?
Code:
mov rcx,10ms
loop $ ; is this the fastest possible wait?    
Or this?
Code:
mov rcx,10ms
@@:
  dec rcx
  jnz @b ; is this the fastest possible wait?    
Or this?
Code:
mov rcx,10ms
@@:
  sub rcx,1
  jnz @b ; is this the fastest possible wait?    
Or this?
Code:
invoke Sleep,10ms ; is this the fastest possible wait?    
The fastest possible way to put images onto a screen is to use the GPU. That is its job. You can do that "instantly" by simply changing the pointer to the source image.

But why must it be "fast"? You have a 10ms delay anyway. And the monitor probably doesn't show much more than 100 frames/second. So all the time in between the CPU is just twiddling its thumbs.


Last edited by revolution on 05 Jul 2022, 20:27; edited 1 time in total
Post 05 Jul 2022, 19:11
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1251
Roman
Quote:
use the GPU

Direct2D to draw many sprites or images.
Or Directx 10\11 or OpenGL
Post 05 Jul 2022, 19:29
View user's profile Send private message Reply with quote
Fastestcodes



Joined: 13 Jun 2022
Posts: 75
Fastestcodes
"You can do that "instantly" by simply changing the pointer to the source image."
How can I this eactly? Show me(and every people) example,pls.

Fast load,10ms wait: you see pictures.
Slow load, 0ms wait: you see half loaded part pictures, stroboscope monitor.
Post 06 Jul 2022, 09:17
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 577
Location: Ukraine
Overclick
For simple window setup child-window with required class, then update pointer. Or create few child-windows and switch visibility attributes.
Setup timer by SetTimer and do your changes by its events.
Post 06 Jul 2022, 09:47
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 18846
Location: In your JS exploiting you and your system
revolution
Fastestcodes wrote:
"You can do that "instantly" by simply changing the pointer to the source image."
How can I this eactly? Show me(and every people) example,pls.

Fast load,10ms wait: you see pictures.
Slow load, 0ms wait: you see half loaded part pictures, stroboscope monitor.
Use one of the libraries that Roman suggested, and use double buffering and flip the images "instantly".

If you really need to wait 10ms, then simply preload all the images into the GPU buffer and flip them "instantly" using the GPU resources to do the work.

But you can also display one image and prepare a new image in a hidden buffer, so there is no preload, then a half finished image is not on display. Once prepared then wait for a variable amount time until the next 10ms period.

Using any of those GPU libraries you can also synchronise the output with the vertical retrace and there is no image tearing, regardless of how long it takes to prepare eac image.

Although I would add SDL to the list of potential libraries that Roman showed.
Post 06 Jul 2022, 10:43
View user's profile Send private message Visit poster's website Reply with quote
Fastestcodes



Joined: 13 Jun 2022
Posts: 75
Fastestcodes
I need sample code. (like Masm32 example codes, or similar)
Post 06 Jul 2022, 11:41
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.