WritePixels3D?

Blitz3D Forums/Blitz3D Programming/WritePixels3D?

WillKoh(Posted 2004) [#1]
Is there no way to write individual pixels (with a new alpha value) in a texture(buffer)?


TartanTangerine (was Indiepath)(Posted 2004) [#2]
When you say "no way" what is your actual problem. I have managed to do this but it's not very stable since the GFX card does not like me locking the texture buffer. However maybe I have mis-understood the question :)


WillKoh(Posted 2004) [#3]
Well, I mean it seems complicated. I read in a tutorial textures extend from 0.1-1.0 regardless of their actual dimensions, so I tried writingpixel 0.3,0.2 and so (on a texture sized 100x100).. A smooth increasing transparancy from left to right was my idea...


AbbaRue(Posted 2004) [#4]
Try using 128x128. Directx don't like textures that aren't even multiples of 2.
2,4,8,16,32,64,128,256,512,1024,etc.
I don't know if that will solve your problem but it will get rid of a
possible other problem.
Here is an example of how I create a texture on the fly with writepixel, maybe it will help.
You can even write the pixels after the texture is applied to something,
and you will see the changes take effect in front of you. NOTE rca is the Alpha byte.
Also the SetBuffer commands are very important.
Here is the code:

ts=512 ;Texture creation using WritePixel
tex57=CreateTexture (ts,ts,1)
SetBuffer TextureBuffer (tex57,0)
For cdy= 0 To ts-1
For cdx= 0 To ts-1
rca=255
rcg=Rnd(100,255)
;If rcg<70 Then rcg=0
rcr=rcg
rcb=rcg
argb=0 ;clear color
argb=(rca Shl 24) Or (rcr Shl 16) Or (rcg Shl 8) Or (rcb)
;If rcg<74 Then argb=0 ;just to be sure lots of black
WritePixel cdx,cdy,argb

Next
Next

SetBuffer BackBuffer()

Roger WillKoh Over and Out.


Rob Farley(Posted 2004) [#5]
You're confusing texture co-ords with UV co-ords.

UV co-ords will go from 0 - 1 whereas your texture co-ords will go from 0 - x (where x is the size of the texture).

So if your texture is 128x128 for example. The UV of the bottom right pixel would be 1,1 the top left would be 0,0. 64 pixels across the texture would be 0.5 on the U co-ord.

I hope that makes some sense.