Author |
Topic: 3D editor tryout (12 triangles) (Read 326 times) |
|
michael
Full Member
member is offline


Posts: 157
|
 |
Re: 3D editor tryout (12 triangles)
« Reply #2 on: Sep 20th, 2017, 12:54am » |
|
Quote:| assuming that you are wanting to keep your programs cross-platform (and I hope you are!) |
|
The original version that I experimented with was 100% BBCSDL compatible. In fact the majority of all my work since I started BBC Basic has been cross platform orientated. ( I have been trying to reinvent windows right from the start )
The BBCSDL version is a simple merger of the two programs.
The only minor obstacle for cross platform was sharing the same screen as the renderer. I would need to deal with time sharing of the screen. So I would get a flicker that *REFRESH would not be able to solve. (as far as I know)
Not a big deal though, because once the 12 triangles get their own specific color scale, it should be easy to work with the slight flashing.
The other idea I have been thinking of is having 2 instances of BBCSDL in the same directory and then I could create two windows like in the one I provide.
If you have any suggestions that may solve the shared graphics, I could work it out.
Regardless, a 100% BBCSDL version will be made from the same program. (minor modifications)
|
| « Last Edit: Sep 20th, 2017, 01:10am by michael » |
Logged
|
I like reinventing the wheel, but for now I will work on tools for D3D
|
|
|
Richard Russell
Administrator
member is offline


Posts: 803
|
 |
Re: 3D editor tryout (12 triangles)
« Reply #3 on: Sep 20th, 2017, 08:36am » |
|
on Sep 20th, 2017, 12:54am, michael wrote:| The other idea I have been thinking of is having 2 instances of BBCSDL in the same directory and then I could create two windows like in the one I provide. |
|
I had assumed that is what you would do. Running two separate processes (the 3D editor and the renderer), as you do in BB4W, has several advantages - not least that it makes better use of the multiple CPU cores typically available on a modern PC (even a Raspberry Pi has multiple cores). I don't think it would be sensible to attempt it any other way.
I wonder if you have somehow convinced yourself that to achieve that you need to 'compile' one of the programs, but that's not true at all. When the BBCSDL IDE runs a BASIC program, it does it by launching another instance of the interpreter in another process. You can do exactly the same with your program: the 'editor' can launch the 'renderer', both being normal .bbc files.
Quote:| If you have any suggestions that may solve the shared graphics, I could work it out. |
|
What you're doing now is basically fine and I wouldn't suggest making any major changes to the architecture. You will need to 'streamline' the way the FVF file is shared to make the two programs cooperate more smoothly, but that should not be too difficult.
Again there's a close correspondence with the way SDLIDE.bbc works when debugging a BASIC program. The IDE launches the program in another process, and that process opens a shared file to which it writes the 'List Variables' information. The IDE opens that same file and displays the variable list in the familiar way. It seems as though the IDE and the BASIC program are sharing memory but they're not - they're just sharing a file!
So I think you should carry on as you are now, but instead of expecting the user to launch the renderer program your 3D editor program should do that itself. If you're unsure how to achieve that simply copy PROCexecute() from SDLIDE.bbc which contains the multi-platform code required to do it:
Code: DEF PROCexecute(bbcfile$, flag$) ON ERROR LOCAL IF FALSE THEN IF BB4W% THEN OSCLI "RUN """ + @lib$ + "..\bbcwrun6.exe"" """ + bbcfile$ + """;" ELSE CASE @platform% AND &FF OF WHEN 0: SYS "WinExec", """" + @lib$ + "..\bbcsdl"" """ + bbcfile$ + """ " + flag$, 1 OTHERWISE: OSCLI "RUN """ + @lib$ + "../bbcsdl"" """ + bbcfile$ + """ " + flag$ + ";" ENDCASE ENDIF ENDIF : RESTORE ERROR ENDPROC Richard.
|
|
|
|
|