RE: poke4 won't accept my 32bit values
- Posted by Mike The Spike <mtsreborn at yahoo.com> Mar 20, 2001
- 583 views
Let's see... #FFFFFFFF is a 4-byte integer value... Hmm... I tried doing this; poke4(#A0000, {#FFFFFFFF,0}) and it works... #FFFFFFFF = 429,496,729,5 so no problem there... Two causes if you ask me; poke4() is using a 31 bit integer as parameter, not a 32 bit one (As #FFFFFFFF = 11111111111111111111111111111111 in binary notation). atom_to_float32(0.0) is screwing up memory... Mike The Spike PS. If I see the code I can find out the cause of the error, but no doubt; poke4() is getting a value passed to it bigger than it can poke. Sollution: change 'poke4(pvCube+16,{#FFFFFFFF,0})' into 'poke(pvCube+16,{#FF,#FF,#FF,#FF})' ... --- Todd Riggins <triggins at ev1.net> wrote: > Yeah, I agree, this doesn't make any sense whats so > ever. The 'C' > translated code is: > > // Fill the array of TL vertices with > untransformed data for the > cube > g_pvCube[0] = D3DTLVERTEX( D3DVECTOR(-1,-1,-1 ), > 0, 0xffffffff, 0, > 0, 0 ); > g_pvCube[1] = D3DTLVERTEX( D3DVECTOR( 1,-1,-1 ), > 0, 0xff00ffff, 0, > 0, 0 ); > g_pvCube[2] = D3DTLVERTEX( D3DVECTOR(-1, 1,-1 ), > 0, 0xffff00ff, 0, > 0, 0 ); > g_pvCube[3] = D3DTLVERTEX( D3DVECTOR( 1, 1,-1 ), > 0, 0xff0000ff, 0, > 0, 0 ); > g_pvCube[4] = D3DTLVERTEX( D3DVECTOR(-1,-1, 1 ), > 0, 0xffffff00, 0, > 0, 0 ); > g_pvCube[5] = D3DTLVERTEX( D3DVECTOR( 1,-1, 1 ), > 0, 0xff00ff00, 0, > 0, 0 ); > g_pvCube[6] = D3DTLVERTEX( D3DVECTOR(-1, 1, 1 ), > 0, 0xffff0000, 0, > 0, 0 ); > g_pvCube[7] = D3DTLVERTEX( D3DVECTOR( 1, 1, 1 ), > 0, 0xff000000, 0, > 0, 0 ); > > definition of D3DTLVERTEX is: > > typedef struct _D3DTLVERTEX { > union { > D3DVALUE sx; > D3DVALUE dvSX; > }; > union { > D3DVALUE sy; > D3DVALUE dvSY; > }; > union { > D3DVALUE sz; > D3DVALUE dvSZ; > }; > union { > D3DVALUE rhw; > D3DVALUE dvRHW; > }; > union { > D3DCOLOR color; > D3DCOLOR dcColor; > }; > union { > D3DCOLOR specular; > D3DCOLOR dcSpecular; > }; > union { > D3DVALUE tu; > D3DVALUE dvTU; > }; > union { > D3DVALUE tv; > D3DVALUE dvTV; > }; > } D3DTLVERTEX, *LPD3DTLVERTEX; > > Definition of D3DVECTOR is: > > typedef struct _D3DVECTOR { > union { > D3DVALUE x; > D3DVALUE dvX; > }; > union { > D3DVALUE y; > D3DVALUE dvY; > }; > union { > D3DVALUE z; > D3DVALUE dvZ; > }; > } D3DVECTOR, *LPD3DVECTOR; > > > > Definition of D3DVALUE is: > > typedef float D3DVALUE, *LPD3DVALUE; > > This code in question works fine how I set up > "windows" code > to get the Exotica dll working with Euphoira. Chris > uses a diferent > method to set up "windows" to get the Exotica dll > working in > Euphoria using his ExoticaX sdk. > > the translated code of what is at the very top of > this page > in Euphoira is: > > poke( pvCube ,atom_to_float32(-1.0)) > poke( pvCube+4 ,atom_to_float32(-1.0)) > poke( pvCube+8 ,atom_to_float32(-1.0)) > poke( pvCube+12,atom_to_float32(0.0)) > poke4(pvCube+16,{#FFFFFFFF,0}) -- *DP* > This is where the > program will crash in the adverse file > --poke(pvCube+20,0) > poke( pvCube+24,atom_to_float32(0.0)) > poke( pvCube+28,atom_to_float32(0.0)) > > poke( pvCube+32,atom_to_float32( 1.0)) > poke( pvCube+36,atom_to_float32(-1.0)) > poke( pvCube+40,atom_to_float32(-1.0)) > poke( pvCube+44,atom_to_float32(0.0)) > poke4(pvCube+48,{#FF00FFFF,0}) > --poke(pvCube+52,0) > poke( pvCube+56,atom_to_float32(0.0)) > poke( pvCube+60,atom_to_float32(0.0)) > > poke( pvCube+64,atom_to_float32(-1.0)) > poke( pvCube+68,atom_to_float32( 1.0)) > poke( pvCube+72,atom_to_float32(-1.0)) > poke( pvCube+76,atom_to_float32(0.0)) > poke4(pvCube+80,{#FFFF00FF,0}) > --poke(pvCube+84,0) > poke( pvCube+88,atom_to_float32(0.0)) > poke( pvCube+92,atom_to_float32(0.0)) > > poke( pvCube+96,atom_to_float32( 1.0)) > poke( pvCube+100,atom_to_float32( 1.0)) > poke( pvCube+104,atom_to_float32(-1.0)) > poke( pvCube+108,atom_to_float32(0.0)) > poke4(pvCube+112,{#FF0000FF,0}) > --poke(pvCube+116,0) > poke( pvCube+120,atom_to_float32(0.0)) > poke( pvCube+124,atom_to_float32(0.0)) > > poke( pvCube+128,atom_to_float32(-1.0)) > poke( pvCube+132,atom_to_float32(-1.0)) > poke( pvCube+136,atom_to_float32( 1.0)) > poke( pvCube+140,atom_to_float32(0.0)) > poke4(pvCube+144,{#FFFFFF00,0}) > --poke(pvCube+148,0) > poke( pvCube+152,atom_to_float32(0.0)) > poke( pvCube+156,atom_to_float32(0.0)) > > poke( pvCube+160,atom_to_float32( 1.0)) > poke( pvCube+164,atom_to_float32(-1.0)) > poke( pvCube+168,atom_to_float32( 1.0)) > poke( pvCube+172,atom_to_float32(0.0)) > poke4(pvCube+176,{#FF00FF00,0}) > --poke(pvCube+180,0) > poke( pvCube+184,atom_to_float32(0.0)) > poke( pvCube+188,atom_to_float32(0.0)) > > poke( pvCube+192,atom_to_float32(-1.0)) > poke( pvCube+196,atom_to_float32( 1.0)) > poke( pvCube+200,atom_to_float32( 1.0)) > poke( pvCube+204,atom_to_float32(0.0)) > poke4(pvCube+208,{#FFFF0000,0}) > --poke(pvCube+212,0) > poke( pvCube+216,atom_to_float32(0.0)) > poke( pvCube+220,atom_to_float32(0.0)) > > poke( pvCube+224,atom_to_float32( 1.0)) > poke( pvCube+228,atom_to_float32( 1.0)) > poke( pvCube+232,atom_to_float32( 1.0)) > poke( pvCube+236,atom_to_float32(0.0)) > poke4(pvCube+240,{#FF000000,0}) > --poke(pvCube+244,0) > poke( pvCube+248,atom_to_float32(0.0)) > poke( pvCube+252,atom_to_float32(0.0)) > > > At the *DP* statement is where Euphoria says the > error code: > > C:\Programming\Exotica_users\chris_b\poke4 > bug\Failing Demo.exw:167 in > procedure FrameMove() > poke4 is limited to 32-bit numbers > vx = 0 > vy = 1 > vz = 0 > dwNumVertices = <no value> > === message truncated ===