Author |
Topic: re: endless graphics draws and LBBooster (Read 1678 times) |
|
michael
Guest
|
|
re: endless graphics draws and LBBooster
« Thread started on: Sep 9th, 2015, 08:44am » |
|
I just found this forum. Thanks for the information and the link Richard.
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline
Posts: 1348
|
|
Re: re: endless graphics draws and LBBooster
« Reply #1 on: Sep 9th, 2015, 10:33am » |
|
on Sep 9th, 2015, 08:44am, michael wrote:Thanks for the information and the link Richard. |
|
LB4's 'segmented' graphics are the cause of much grief. Whilst occasionally useful, far more commonly they result in unwanted side-effects such as windows that are not redrawn when uncovered (or restored from being minimized), or excessive memory usage. These effects are avoidable, but only at the expense of some complication and only if you are aware of there being a problem in the first place!
So it was an early design decision that LBB would use a more conventional double-buffered approach, whereby graphics are initially drawn onto an off-screen memory surface and then 'blitted' to the screen when required. Not only does this solve both problems, but it is an architecture that Windows is specifically designed to support (with API functions such as GetBoundsRect, InvalidateRect and BitBlt).
Despite this significantly different internal architecture, LBB is compatible with the vast majority of LB graphics programs. This is helped by the fact that FLUSH and REDRAW are implemented in LBB, albeit that they do something rather different from what they do in LB (see the LBB Help docs).
For those few graphics programs which are incompatible there are usually straightforward workarounds to allow them to run in LBB.
Richard.
|
|
Logged
|
|
|
|
michael
Guest
|
|
Re: re: endless graphics draws and LBBooster
« Reply #2 on: Sep 9th, 2015, 2:47pm » |
|
Liberty Basic did have options like the gx libraries and OpenGL resources. Of course I wanted to just focus on the base graphics for my experiments. Finding the options out now makes it so I need to modify my simulated 3D image tools to gxGL so I can step out to the "blitter" as they worded it. My question though is, are the gx libraries and the OpenGL resource 100% compatible with Liberty basic booster? Oh, and (since I do see there is a mention of LBB enhancements) does LBB have a way of extracting the color value of a pixel with perhaps a one command request?
|
« Last Edit: Sep 9th, 2015, 2:58pm by michael » |
Logged
|
|
|
|
Richard Russell
Administrator
member is offline
Posts: 1348
|
|
Re: re: endless graphics draws and LBBooster
« Reply #3 on: Sep 9th, 2015, 3:20pm » |
|
on Sep 9th, 2015, 2:47pm, michael wrote:My question though is, are the gx libraries and the OpenGL resource 100% compatible with Liberty basic booster? |
|
I'm afraid I don't know what the 'gx libraries' are so I can't help you there, perhaps somebody else can. As far as OpenGL is concerned that is definitely compatible with LBB, as the author of Cabinet Planner can I think confirm!
Quote:does LBB have a way of extracting the color value of a pixel with perhaps a one command request? |
|
Nothing additional to what LB provides (i.e. calling the GetPixel API), no. Even if LBB were to provide such a function it would not necessarily be any faster, since it would need to call GetPixel internally and that's a fairly slow API.
Richard.
|
|
Logged
|
|
|
|
michael
Guest
|
|
Re: re: endless graphics draws and LBBooster
« Reply #4 on: Sep 9th, 2015, 3:26pm » |
|
One more question.. I was looking at your documentation on LBB and it mentioned it made everything in a stand alone program. Does this mean the bmp images and the wave files ...ect are inserted into the executable ?!!! :O
Oh and here is a link to the gxGL library code http://basic.wikispaces.com/gx+Graphics+Library
|
« Last Edit: Sep 9th, 2015, 3:31pm by michael » |
Logged
|
|
|
|
RobM
Junior Member
member is offline
Posts: 91
|
|
Re: re: endless graphics draws and LBBooster
« Reply #5 on: Sep 9th, 2015, 3:48pm » |
|
on Sep 9th, 2015, 3:20pm, Richard Russell wrote:As far as OpenGL is concerned that is definitely compatible with LBB, as the author of Cabinet Planner can I think confirm!
Richard. |
|
Yes it is, and with the added speed of LBB, 3d graphics render much more smoothly.
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline
Posts: 1348
|
|
Re: re: endless graphics draws and LBBooster
« Reply #6 on: Sep 9th, 2015, 5:20pm » |
|
on Sep 9th, 2015, 3:26pm, michael wrote:Does this mean the bmp images and the wave files ...ect are inserted into the executable ?!!! |
|
Yes, optionally. You can 'embed' such resource files in the EXE such that they are automatically extracted the first time it is run. Of course you can use a 'proper' installer like Inno Setup if you prefer, which will provide more sophisticated options, but when you just need to store some images and wave files etc. the simple LBB capability is useful.
One good use of this feature is to put a program on a website which the end user just has to click on and select 'Run'. Then the browser does all the work behind the scenes, without the user having to worry about manually downloading and installing etc. first.
Richard.
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline
Posts: 1348
|
|
Re: re: endless graphics draws and LBBooster
« Reply #7 on: Sep 10th, 2015, 08:50am » |
|
on Sep 9th, 2015, 3:26pm, michael wrote:Oh and here is a link to the gxGL library code |
|
I've tried the four demo programs listed at gxGraphicsLibraryHome and they seem to run perfectly in LBB. In fact LBB is well suited to a library such as this because I just needed to add the following line at the end of each of the demo programs:
Code: In LB, which has no include capability, I would have needed to copy the library code into each program.
Richard.
|
|
Logged
|
|
|
|
michael
Guest
|
|
Re: re: endless graphics draws and LBBooster
« Reply #8 on: Sep 10th, 2015, 09:05am » |
|
That's amazing!! And to think I tried to make a simulated DLL in LB.. Essentially, what you showed me would allow me to make modules for many things. I would also suppose you would surprise me further and say that LBB could also be used to somehow make a DLL?
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline
Posts: 1348
|
|
Re: re: endless graphics draws and LBBooster
« Reply #9 on: Sep 10th, 2015, 9:17pm » |
|
on Sep 10th, 2015, 09:05am, michael wrote:I would also suppose you would surprise me further and say that LBB could also be used to somehow make a DLL? |
|
Actually it can't, or at least I've never worked out a way to do it (I'm not sure whether it's theoretically possible or not).
Richard.
|
|
Logged
|
|
|
|
michael
Guest
|
|
Re: re: endless graphics draws and LBBooster
« Reply #10 on: Sep 11th, 2015, 02:26am » |
|
I tried to make include work in LBB but the program doesn't recognize it. I put it at the end of my main program and then executed it. Because of the missing program module (subroutines that are separated from the program and saved in a separate .bas file) I looked at the links concerning it in LBB and I cant figure why it doesn't work.
And a little subject for your amusement: Quote :"Spheres are really hard to make " http://canevian.conforums.com/index.cgi?board=Development&action=display&num=1441915542
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline
Posts: 1348
|
|
Re: re: endless graphics draws and LBBooster
« Reply #11 on: Sep 11th, 2015, 05:46am » |
|
on Sep 11th, 2015, 02:26am, michael wrote:I cant figure why it doesn't work. |
|
Most likely reasons:
Not starting in the first column. Unlike a conventional comment, 'include must be at the very beginning of the line.
No CRLF afterwards. If you are putting it at the very end of the program, make sure you have added a newline after the filename. Richard.
|
|
Logged
|
|
|
|
michael
Guest
|
|
Re: re: endless graphics draws and LBBooster
« Reply #12 on: Sep 11th, 2015, 07:59am » |
|
Obviously I am doing something wrong. lets say this is my main program.. I have include at the start of the program: (the program wont run if the sub is put there.) Code:
'include mytools.bas
nomainwin
open "The sphere subroutine !!Created by Michael Gallup (free for the public to use)" for graphics_nsb_fs as #1
#1 "trapclose [quit]"
#1 "fill black ; home ; down ; north"
'************H***V***S***R***G***B**Dimmer
call sphere 500,500,220,225,240,250,1
call sphere 50,50,25,225,240,250,9
call sphere 100,100,50,200,200,200,4
call sphere 200,200,100,140,200,200,2
wait
[quit]
close #1
end
and here is the program it would add to the above code. I would have saved it as mytools.bas do you know how it would be corrected?
Also the code bellow would need to be put at the base of the program. Code:
sub sphere h,v,size,x,c,a,dimmer ' dimmer cannot be more than 24
#1 "place ";h;" ";v
for y=1 to size
#1 "down"
#1 "color ";x;" ";c;" ";a
#1 "size 2"
#1 "circle ";y
#1 "flush"
x=x-dimmer
c=c-dimmer
a=a-dimmer
if x<2 then x=2
if c<2 then c=2
if a<2 then a=2
next y
end sub
|
« Last Edit: Sep 11th, 2015, 08:09am by michael » |
Logged
|
|
|
|
tsh73
Full Member
member is offline
Gender:
Posts: 210
|
|
Re: re: endless graphics draws and LBBooster
« Reply #13 on: Sep 11th, 2015, 10:50am » |
|
'include doesn't work as a first line. It is documented in a help file: Quote:For maximum compatibility with Liberty BASIC Workshop the 'include directive is ignored when it is at the very beginning of the program. See this Wiki article for more information, and for details of how to integrate LBW with LBB. |
|
|
|
Logged
|
|
|
|
Rod
Full Member
member is offline
Gender:
Posts: 110
|
|
Re: re: endless graphics draws and LBBooster
« Reply #14 on: Sep 11th, 2015, 5:06pm » |
|
The use of flush in the middle of the loop is not appropriate. If you ran this in LB with a size of 200 then every time the window was moved minimised or restored there would be 200 drawing actions. Perhaps not with LBB but certainly with LB.
Flush should be use sparingly and at the end of a looped or multiplexed drawing routine.
|
|
Logged
|
|
|
|
|