[solved] GET and PUT ( graphics ) commands slow down my program[solved]

New to FreeBASIC? Post your questions here.
grindstone
Posts: 744
Joined: May 05, 2015 5:35
Location: Germany

Re: GET and PUT ( graphics ) commands slow down my program

Postby grindstone » Aug 09, 2020 20:23

Daniel Ouellette wrote:With "ScreenSet 1.0", I thought I was writing first on a image instead of the screen. Can you explain how?
In principle, you are right. But the image you write to has the size of the screen, not of the image you want to show, and that's your problem here. You better write to an image that has the correct size and then copy it on the screen. Nonetheless I would recommend to keep the ScreenSet/ScreenCopy method to avoid flicker.
Daniel Ouellette
Posts: 47
Joined: Apr 17, 2011 17:43
Location: Montréal, Canada
Contact:

Re: GET and PUT ( graphics ) commands slow down my program

Postby Daniel Ouellette » Aug 09, 2020 20:26

I'm sorry, I don't understand anymore!
Daniel Ouellette
Posts: 47
Joined: Apr 17, 2011 17:43
Location: Montréal, Canada
Contact:

Re: GET and PUT ( graphics ) commands slow down my program

Postby Daniel Ouellette » Aug 09, 2020 20:27

I answered too quickly!
Daniel Ouellette
Posts: 47
Joined: Apr 17, 2011 17:43
Location: Montréal, Canada
Contact:

Re: GET and PUT ( graphics ) commands slow down my program

Postby Daniel Ouellette » Aug 09, 2020 20:30

grindstone wrote: In principle, you are right. But the image you write to has the size of the screen, not of the image you want to show, and that's your problem here. You better write to an image that has the correct size and then copy it on the screen. Nonetheless I would recommend to keep the ScreenSet/ScreenCopy method to avoid flicker.
So it's okay the way I did it?
fxm
Posts: 9794
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: GET and PUT ( graphics ) commands slow down my program

Postby fxm » Aug 09, 2020 20:32

Daniel Ouellette wrote:
fxm wrote:Can you directly draw the image in an image buffer (1024x768) and not on the screen (no longer using GET), then just PUT the image on the screen center (by using one only screen page, without ScreenSet, neither CLS, neither FLIP).
How to do this ?

PSET, PRESET, LINE, CIRCLE, DRAW, DRAW STRING and PAINT can directly draw to an image buffer (see documentation).
Then, only use PUT to copy the image buffer to the screen center.
grindstone
Posts: 744
Joined: May 05, 2015 5:35
Location: Germany

Re: GET and PUT ( graphics ) commands slow down my program

Postby grindstone » Aug 09, 2020 20:34

Daniel Ouellette wrote:
grindstone wrote:If the image is composed of multiple parts it's maybe better to do it invisible in the background.
So with ScreenSet and GET?
Seems we are a bit asynchronous. *grin*

With ScreenSet, but without GET. Have a look at the snippet I posted. Set up the image you want to show the way you did before, but write it to the image I called "img5" instead to the screen. Place this code between the "'#######..." lines and delete the "Circle.." line (it was only to demonstrate that the image is updated periodically). It should work then.
Daniel Ouellette
Posts: 47
Joined: Apr 17, 2011 17:43
Location: Montréal, Canada
Contact:

Re: GET and PUT ( graphics ) commands slow down my program

Postby Daniel Ouellette » Aug 09, 2020 20:43

I will try and tomorrow I will come back with this, thanks to you and the others.
Daniel Ouellette
Posts: 47
Joined: Apr 17, 2011 17:43
Location: Montréal, Canada
Contact:

Re: GET and PUT ( graphics ) commands slow down my program

Postby Daniel Ouellette » Aug 09, 2020 22:16

I had some time and I realized that I was far from the electronics I do. This program that I did in Freebasic is very long, maybe too long, and was done with a bit of everything without worrying about the follow up, like a beginner. I'm going to have to rework everything so that it's only in graphics, so that I can do everything in an image buffer instead of a screen, so that I can forget about the GET command. In fact, many commands cannot currently be used with a target buffer, such as PRINT. So I'll have to keep GET for now and modify another version of the program in my spare time.
Daniel Ouellette
Posts: 47
Joined: Apr 17, 2011 17:43
Location: Montréal, Canada
Contact:

Re: GET and PUT ( graphics ) commands slow down my program

Postby Daniel Ouellette » Aug 09, 2020 22:35

So, unless there's something else to replace the GET command for faster execution, I think that's conclusive, if you agree
BasicCoder2
Posts: 3571
Joined: Jan 01, 2009 7:03
Location: Australia

Re: GET and PUT ( graphics ) commands slow down my program

Postby BasicCoder2 » Aug 09, 2020 22:42

I don't know how many others know or guessed what you are trying to do but I can't figure it out to say yes or no to anything you wrote.
I never found the need to use GET when using images.
You mention using PRINT so I wondered if using draw string might be another option.
Daniel Ouellette
Posts: 47
Joined: Apr 17, 2011 17:43
Location: Montréal, Canada
Contact:

Re: GET and PUT ( graphics ) commands slow down my program

Postby Daniel Ouellette » Aug 09, 2020 22:53

Yes, I'm actually going to change everything to just be in graphics commands like using Draw String instead of Print, it's that like a beginner I used both and that for a lot of other commands, I mixed it all up. So the best thing is to make a better version of this program which will take a lot of time. For now, I will keep the GET for the current version.
Daniel Ouellette
Posts: 47
Joined: Apr 17, 2011 17:43
Location: Montréal, Canada
Contact:

Re: GET and PUT ( graphics ) commands slow down my program

Postby Daniel Ouellette » Aug 09, 2020 23:36

I studied electronics and assembler language at a time when PCs and high-level languages did not exist. I learned on my own with QB and I never needed to excel in PC computer languages because it wasn't necessary in my job to design electronic devices with microcontrollers, it may seem unthinkable nowadays, but it really is the case. The electronic devices I design don't need PCs to work, even if I use them to work.
Daniel Ouellette
Posts: 47
Joined: Apr 17, 2011 17:43
Location: Montréal, Canada
Contact:

Re: GET and PUT ( graphics ) commands slow down my program

Postby Daniel Ouellette » Aug 09, 2020 23:41

In fact, at the beginning, I was programming directly in machine code and the assembler came afterwards.
Daniel Ouellette
Posts: 47
Joined: Apr 17, 2011 17:43
Location: Montréal, Canada
Contact:

Re: GET and PUT ( graphics ) commands slow down my program

Postby Daniel Ouellette » Aug 09, 2020 23:59

At first glance, it may seem that I didn't evolve along with computer language. But, with microcontrollers, I have always favoured assembler and machine code to keep control of the compilation. This allowed me to analyse an analog signal of more than 50K points, its frequency decomposition in real time, the application of computer filters and much more in 200mS.
Daniel Ouellette
Posts: 47
Joined: Apr 17, 2011 17:43
Location: Montréal, Canada
Contact:

Re: GET and PUT ( graphics ) commands slow down my program

Postby Daniel Ouellette » Aug 10, 2020 13:28

Hi everyone, about my last message, it's out of the Freebasic context, I'm more microcontroller than PC and we can't compare them in terms of performance, they're completely different environments. I just wanted to say that my skills are more at the microcontroller level than at the PC level, you surely noticed it in relation to my lack of knowledge for PCs.

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 4 guests