Hi good afternoon.
I'm looking for the program please (see picture for the x16) and the source code.
I'm interested in how the image buffer was created for this.
Thanks.
Where is this program for the x16 please?
Where is this program for the x16 please?
- Attachments
-
- ship.jpg (26.72 KiB) Viewed 2917 times
- desertfish
- Posts: 1096
- Joined: Tue Aug 25, 2020 8:27 pm
- Location: Netherlands
Re: Where is this program for the x16 please?
It is one of the commander x16 examples that ship with Prog8.
Try It Now!
https://github.com/irmen/prog8/blob/mas ... mk3-gfx.p8
(By the way, I don't know if you already knew this, but here is the directory with the whole bunch of Prog8 example programs: https://github.com/irmen/prog8/tree/master/examples )
Try It Now!
https://github.com/irmen/prog8/blob/mas ... mk3-gfx.p8
(By the way, I don't know if you already knew this, but here is the directory with the whole bunch of Prog8 example programs: https://github.com/irmen/prog8/tree/master/examples )
- Attachments
-
- cobramk3-gfx.prg
- (3.68 KiB) Downloaded 953 times
Re: Where is this program for the x16 please?
how can you do the rotation with a buffer?
- desertfish
- Posts: 1096
- Joined: Tue Aug 25, 2020 8:27 pm
- Location: Netherlands
Re: Where is this program for the x16 please?
I don't really understand what you mean with "with a buffer".
I can explain globally how it works and you can maybe follow along in the source code for the details:
- the ship is made up of points and lines stored in arrays.
- the points are rotated using a 3x3 rotation matrix that is applied to each of the points of the ship. If you google this term you will get tons of details on how this is done
- the hidden line removal is done by calculating the direction the surface normal of every surface of the ship is pointing. If it is pointing towards you it is marked visible, if it points away from you into the screen, it is marked invisible (because it lies on the back side of the ship)
- note that there is a mistake still in calculating this because some surfaces are still visible at some angles where they should not be.
- screen is cleared.
- lines of the visible surfaces are drawn.
- repeat
I can explain globally how it works and you can maybe follow along in the source code for the details:
- the ship is made up of points and lines stored in arrays.
- the points are rotated using a 3x3 rotation matrix that is applied to each of the points of the ship. If you google this term you will get tons of details on how this is done
- the hidden line removal is done by calculating the direction the surface normal of every surface of the ship is pointing. If it is pointing towards you it is marked visible, if it points away from you into the screen, it is marked invisible (because it lies on the back side of the ship)
- note that there is a mistake still in calculating this because some surfaces are still visible at some angles where they should not be.
- screen is cleared.
- lines of the visible surfaces are drawn.
- repeat
Re: Where is this program for the x16 please?
------------------------------------------------------------------------------
I don't really understand what you mean with "with a buffer".
-------------------------------------------------------------------------------
Draw the finished image in the background and then bring the entire image to the front in the visible area.
greeting.
I don't really understand what you mean with "with a buffer".
-------------------------------------------------------------------------------
Draw the finished image in the background and then bring the entire image to the front in the visible area.
greeting.
- desertfish
- Posts: 1096
- Joined: Tue Aug 25, 2020 8:27 pm
- Location: Netherlands
Re: Where is this program for the x16 please?
Oh, it doesn't use double buffering. It draws all the pre-rotated lines as quickly as it can after clearing the display. That's why you still see it flickering, because this process takes longer than a frame to complete
Re: Where is this program for the x16 please?
how can a double buffer be created in x16?
Thanks.
Thanks.
Re: Where is this program for the x16 please?
You can only double buffer some modes. Not enough vram to double buffer 8 bit color, but you can do 4bit or lower.
And remember you can get clever with a raster interrupt and change the pallette as often as every scan line if you want, so a 4 bit bitmap could have more than 16 unique colors in it if you're clever.
And remember you can get clever with a raster interrupt and change the pallette as often as every scan line if you want, so a 4 bit bitmap could have more than 16 unique colors in it if you're clever.
Re: Where is this program for the x16 please?
Hello thanks for the information.
Please explain to me how I can create a 4bit screen and at which address the screens are located for me as a beginner.
Thanks.
greeting
Please explain to me how I can create a 4bit screen and at which address the screens are located for me as a beginner.
Thanks.
greeting