Sending bitmaps

About Truespace Archives

These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.

They are retained here for archive purposes only.

Sending bitmaps // Scriptorium

1  |  

Post by Wigand // Jan 6, 2008, 10:29am

Wigand
Total Posts: 462
pic
Here is one of my test objects to receive bitmaps from an other

TS instance via UDP



' Execute

' Called to execute the command

Sub Execute(params)

On Error resume Next


Dim fn

Dim daten

Dim frm

Dim x

Dim y

Dim xmax

Dim ymax

Dim Bild

Dim ar

Dim color


' This is the dll call function set

Set fn=Node.AccessNearFnSet("ConInit")

' every pixels has its color

Set color=System.CreateDO("Common Data Package/Color Data")


' if the function is available

If isobject(fn) Then


' I look for a "Start" string in my stream

' but not use it yet

If fn.RECEIVE()= "Start" Then


End If


daten=fn.RECEIVE()


' the datas after the "Head" are picture format and resolution of x an y

If left(daten,4)= "Head" Then


ar=split(daten,"|")


frm=ar(1)

xmax=ar(2)

ymax=ar(3)


' I initialize the output picture of the object

Bild.CreateEx xmax,ymax,frm


End If



' If a "P" (for point) arrives I take the x and y coordinates and then the three

' following numbers as

' Red Green Blue values


If left(daten,1)="P" Then


ar=split(daten,"|")


x=ar(1)

y=ar(2)

R=ar(3)

G=ar(4)

B=ar(5)


color.SetRed8=R

color.SetGreen8=G

color.SetBlue8=B


' I set a Pixel in the output bitmap

' I think here is the problem. Because I use a timer to poll the incoming

' Datas and the bitmap do not hold the color.


Bild.SetPixel x,y,color



End If




Else


End If





End Sub

Post by Wigand // Jan 8, 2008, 9:39am

Wigand
Total Posts: 462
pic
I want to share some things I detected while testing bitmap via UDP.


Sending data with VBscripts is fast enough for single pictures.

But it is a problem to receive so many pakets with a script. I loose many

information along the way. For this reason it would be neccesary to

write handshake functions, but this will decrease performance.

I sent the data from a TS script to a VB6 programm, because it is not

possible to use Winsock_DataArrival event in TS script. In TS I have

to use polling methods, and that is realy slooow.


Maybe it is possible to use a TCP connection...
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn