Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

3 Dimensional Chat / How to create a primitive using the memblocks?

Author
Message
CoreGrid
User Offline
Joined: 16th Feb 2017
Location:
Posted: 17th Jun 2017 02:48
I couldnt find any examples or topics on how to use the memblocks together with the mesh. And im really stuck, im trying to create a model in real time.
For example a simple slope that has 2 faces so 3 vertexes for each face. I know i can just use the plane command but my point is to understand how to use this.
Could someone with more experience with memblocks help me with this?
29 games
11
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 17th Jun 2017 18:45
This is a simple example I created a while ago, it still works for me so I hope it does for you.

+ Code Snippet

The code creates a triangle rather than a rectangular plain. It doesn't have any uv coordinates but it does show all the information required and where it goes in the memblock to make a single polygon. Unfortunately I don't have any other examples but this aught to be enough to get you started.
Hover Car Race Challenge! - available now on Google Play
Invaders of the 29th Dimension - available now on Google Play
Find me on indieDB
LBFN
10
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 17th Jun 2017 20:02
Nice little program 29 games. I've never really took the time to learn much about memblocks, but I'm thinking maybe it is worth looking into.



So many games to code.....so little time.
CoreGrid
User Offline
Joined: 16th Feb 2017
Location:
Posted: 17th Jun 2017 22:41
Thanks 29 games! Ill change the code to make it work with tier 2 and will post the result here.
CoreGrid
User Offline
Joined: 16th Feb 2017
Location:
Posted: 18th Jun 2017 21:49
29 games i tried to convert this code to c++ but dont understand what this should be:

`create a texture for the object
`required for the MAKE OBJECT command
create bitmap 1, 1, 1
set current bitmap 1
ink rgb(250,0,0),0
line 0,0,1,1
get image 1, 0, 0, 1, 1
set current bitmap 0
delete bitmap 1

`create a memblock for the object
make memblock 1, 108 :`create memblock of correct size

write memblock dword 1, 0, 274 :`write FVF to memblock - I remember the default 338 not working for some reason
write memblock dword 1, 4, 32 :`write FVF size to memblock - this is the number of bytes required per polygon - 32 bytes
write memblock dword 1, 8, 3 :`write number of vertices to memblock - each polygon will have three vertices


Then i tried copy and pasting this into agk2 but this game me an error on pretty much every line, i dont really know how to use this.
Dmowskavitto
User Offline
Joined: 18th Aug 2017
Location:
Posted: 18th Aug 2017 08:56
Hi, I am trying to use this in alchemy and i find that the ordering is completely different
http://www.3d-architectural-rendering.com
James H
10
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 19th Aug 2017 18:45
CoreGrid Yes because that code is for DarkBasic Pro, you will have to see if there are equivalent commands in AppGameKit and use it as a guide to write your own and/or re-post this on the AppGameKit board if needs be - this is the wrong board really and has barely any activity anyway.

Dmowskavitto Got no idea what that is exactly but different software might appear to handle the order differently because default world orientation can be different, for example I can export stuff from an older version of Blender 3D but when I load it into DarkBasic Pro the orientation of the object can be different, even though in Blender the Cartesian co-ords seem to be the same as well as the object orientation, to that end there are export options in Blender allowing you to treat the export with different XYZ directions for Forward and Up(also allows for negative XYZ directions). Hope that made some sense.
Win 7 Pro 64 bit SP1, AMD A4-5300 APU 3.4GHz, 8GB DDR3, NVidia GeForce GTX 750 1GB GDDR5, ASUS A55BM-E

Login to post a reply

Server time is: 2017-09-19 16:11:29
Your offset time is: 2017-09-19 16:11:29