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.

Login to post a reply

Server time is: 2017-06-23 02:46:47
Your offset time is: 2017-06-23 02:46:47