Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - a

Pages: [1] 2
1
Blitz / Re: [BMAX + MaxGUI] Filter photos.
« on: February 25, 2008 »
AFAIK, images are better for drawing and stuff like you would do in a game and pixmaps are better for editing, but MUCH slower in drawing. also, pixmaps can be converted to other stuff(textures, images) or colordepth/size can be changed easily. but when you want to do effects and not draw much stuff like in a game but just some images i guess pixmaps would be the better solution. but remember the conversion from pixmaps to images takes much time, too.

2
Blitz / Re: Depth Shadows and Framebuffers [BMAX]
« on: February 11, 2008 »
ok. as you can see in my sig, ive got a new machine (well, some new parts :D)
problem: the video card. it just sucks. i thought it would be ok, but... cs1.6 on lowest graphics and 1024x768: max 25fps
and so is the compatibility: shaders work (still no idea which version), but somehow it just cant manage the framebuffer extension, even after installing the newest drivers (before, it couldnt even manage opengl at all, with the CD drivers, which is also strange, because opengl even worked on a pc without any gfx drivers installed...)

the thing now is: is it really useful to develop framebuffers if they dont work on some X 1000 chipsets? or is it just another driver issue here???

EDIT: seemed to have problems with the shared memory. when set to 32mb it didnt work, but in 128mb it did (a bit ;))...

3
Blitz / Re: Depth Shadows and Framebuffers [BMAX]
« on: January 20, 2008 »
wow! thanks man! this will help me a lot!

unfortunatelly my pc at home broke and i just cant get to work(im on a secondary system here; only at weekends...). it will probably take a bit longer to do/finish this stuff. also, ive decided, to make a little opengl-engine which includes some of the basic stuff(meshes(->entities), cameras, lights, textures,...) first and if this all works, i'll add the shaders and the special effects and all of this stuff

4
Blitz / Re: Depth Shadows and Framebuffers [BMAX]
« on: January 12, 2008 »
well its faster on my ATI, too of course :) that's why i want to do this!
and shaders... i'm not really good at writing them. actually i'm a noob at this and didn't really write at least one^^ also i don't know how to implement them properly. of course i downloaded toms mini-shader-engine from bb.com and it did work on the fly(with a toon and a perpixel-lighting shader) but i still have no idea how to pass textures to shaders which is a big problem when i HAVE to pass them (i'd try to write/steal a *good* parallax shader then, too[see the link downwards])...

oh and i noticed something: the FBO's done in bmax work on my fathers pc (ati x600 se) but not the original source from ati.com (http://ati.amd.com/developer/SDK/Samples_Documents.html#opengl theres an FBO sample). well it does work but the cubemapping and the shadows dont...

sorry for not posting an exe but my webspace (ok its the webspace from devils child^^ but he gave me 30mb ;)) had some problems. here is it:
http://www.dev-ch.de/upload/files/DrFreak339/bmax_ogl_depth_shadows.rar

5
Blitz / Depth Shadows and Framebuffers [BMAX]
« on: January 06, 2008 »
ok, so ive downloaded a source from blitzbasic.com(http://www.blitzbasic.com/Community/posts.php?topic=60672) which showed really pretty depth shadows. i changed more and more stuff and finally wanted to add framebuffers instead of using the default copytex-method to get even better performance, but it doesnt seem to work: as it seems, the FBO-method copies the whole buffer and not only the depth buffer and projects this finally. so ive got 2 options now (this is where someone of you should help me ;)):
either, i use the color buffer to make soft shadows, or, the probably faster method: i let the FB not use a color-buffer and do it as i did before and make those hard-edged shadows

ok enough said now:
heres the source and the keys are: [1]=show shadowmap, [2]=enable/disable shadows, [3]=wireframe on/off
also, theres the old method included in this which copies the texture(does work for me)

PS: sorry for the crappy code, but its very experimental!

EDIT: ok, ive found a good code sample that does exactly what i want. thy for your help anyway!
PS: ill report in, if i have it working

6
aaah ok. i thought of stuff like memory-hackers (DMA stuff), which could be blocked in vista and that this app here "hacks" the memory of other programs, too("before size-4" could mean that 4 bytes are even written to another program, not only wrong written in this program). well, i know that memory accesses to other programs even with self-written programs arent blocked in XP (i wrote my own-> didnt work really well ;)), so i thought it should be a vista-only problem. but i think your idea makes more sense and the most important thing now is that it works on (hopefully) all the machines!

7
ok, paul, just saw your post after uploading the new exe, so here you can have it anyways^^: http://www.dev-ch.de/upload/files/DrFreak339/poke_pixel_vista.rar

changes: 1. the offset in the ram is requested in each main loop
2. size is substracted by 4 (yep, i should have thought about this before^^)
it should work bugfree on each system now!

oh and paul: i think its XP not noticing. doesnt vista has this new "security features", which XP doesnt has?

and here is the source (forgot to include into the archive, sorry):
Code: [Select]
;.lib "kernel32.dll"
;apiRtlMoveMemory(Destination*,Source,Length):"RtlMoveMemory"
;apiRtlMoveMemory2(Destination,Source*,Length):"RtlMoveMemory"
Const ScreenWidth=320
Const ScreenHeight=240
Graphics ScreenWidth,ScreenHeight,32,2
SetBuffer BackBuffer()

Global VideoBank=CreateBank(ScreenWidth*ScreenHeight*4) ;create virtual buffer in 32 bit(4 bytes per pixel)

Repeat
 BufferInfo=CreateBank(32) ;store buffer information here
 LockBuffer()
  api_RtlMoveMemory BufferInfo,GraphicsBuffer()+72,32
  size=PeekInt(BufferInfo,20)*PeekInt(BufferInfo,24)*PeekInt(BufferInfo,28)/8
  offset=PeekInt(BufferInfo,0)
 UnlockBuffer()
 If BankSize(VideoBank)<size Then RuntimeError "Could not initialise buffer."+Chr(13)+"Program will quit."
 FreeBank BufferInfo

 col=Rand($000000,$FFFFFF)
 For currentpos=0 To size-4 Step 4 ;yes, thanx jim ;)
  PokeInt VideoBank,currentpos,col ;draw to virtual buffer
 Next

 api_RtlMoveMemory2 offset,VideoBank,size ;copy virtual buffer to graphics buffer
 Color 255,0,0
 Text 10,10,GetFPS()
 Flip 0
Until KeyHit(1)
End

Global FPS,FPSFrame,FPSTime
Function GetFPS(ms=1000)
ctime=MilliSecs()
FPSFrame=FPSFrame+1
If ctime-FPSTime>ms
 FPS=FPSFrame*1000/ms
 FPSFrame=0
 FPSTime=ctime
EndIf
Return FPS
End Function

Function Pixel(x,y,hexcol=$000000)
If x>-1 And x<ScreenWidth And y>-1 And y<ScreenHeight
 PokeInt VideoBank,(y*(ScreenWidth)*4)+(x*4),hexcol
EndIf
End Function

8
ok, heres the update. its just a little change: im getting the buffer information(-> RAM offset) new in each main-loop.
vista users please test.

Code: [Select]
;.lib "kernel32.dll"
;apiRtlMoveMemory(Destination*,Source,Length):"RtlMoveMemory"
;apiRtlMoveMemory2(Destination,Source*,Length):"RtlMoveMemory"
Const ScreenWidth=320
Const ScreenHeight=240
Graphics ScreenWidth,ScreenHeight,32,2
SetBuffer BackBuffer()

Global VideoBank=CreateBank(ScreenWidth*ScreenHeight*4) ;create virtual buffer in 32 bit(4 bytes per pixel)

Repeat
 BufferInfo=CreateBank(32) ;store buffer information here
 LockBuffer()
  apiRtlMoveMemory BufferInfo,GraphicsBuffer()+72,32
  size=PeekInt(BufferInfo,20)*PeekInt(BufferInfo,24)*PeekInt(BufferInfo,28)/8
  offset=PeekInt(BufferInfo,0)
 UnlockBuffer()
 If BankSize(VideoBank)<size Then RuntimeError "Could not init buffer"
 FreeBank BufferInfo

 col=Rand($000000,$FFFFFF)
 For currentpos=0 To size Step 4
  PokeInt VideoBank,currentpos,col ;draw to virtual buffer
 Next

 apiRtlMoveMemory2 offset,VideoBank,size ;copy virtual buffer to graphics buffer
 Color 255,0,0
 Text 10,10,GetFPS()
 Flip 0
Until KeyHit(1)
End

Global FPS,FPSFrame,FPSTime
Function GetFPS(ms=1000)
ctime=MilliSecs()
FPSFrame=FPSFrame+1
If ctime-FPSTime>ms
 FPS=FPSFrame*1000/ms
 FPSFrame=0
 FPSTime=ctime
EndIf
Return FPS
End Function

Function Pixel(x=-1,y=-1,hexcol=$000000)
If x>-1 And x<ScreenWidth And y>-1 And y<ScreenHeight Then PokeInt VideoBank,(y*(ScreenWidth)*4)+(x*4),hexcol
End Function

EDIT: slowdown of ~15-20%, but if it works for vista users... its probably worth it

9
ok, looks like, you have to free the buffer (in vista only?), before you exit the program or else it will crash, am i understanding this right? anyways, i have no idea, how to do this. im going to search the kernel32.dll. there has to be a function to free the memory to avoid crashes

10
hmm.. i expected more on a double core machine. anyways: i did some tests concerning buffer handles: locking the buffers takes(!) about 20% of the speed and changing the offset of the pointer doesnt work. i have to access the buffer like this i think.

oh and: this isnt Bmax  ;) its 2D, but you need access to kernel32.dll functions

EDIT: i just noticed that drawing directly to the frontbuffer instead to the backbuffer gives about 6% more speed and it stops flickering (in wondowed mode)

11
vista.. well, i cant test it.. also, none of my friends has it. they all have XP and they can run it without problems, but i think this could be it.
also i should mention: its theoretically not important, what card you have, because its winXP(and older)-software-drawing-stuff; only vista uses hardware to accelerate. i think you just have 1. fast ram and 2. a fast transfer from the cpu to the ram. i am really sure, expensive cards dont change this, because the PC from me, where its running with about 900 fps has a really cheap X600SE and on the pc with 200 fps i have a X1300 Pro(its about double the size of the x600 ;) )

12
wow.. so much fps! didnt think of something like this!
ok, to the errors: cant run from temp: probably(!) a bug in blitz, where it cant load the decls/cant find the dll?
2nd bug: perhaps windows wants his memory back or something. i dont know, how internal blitz routines work. probably the "copy to virtual buffer" copies also somewhere else... this seems really bad, i have no idea how i could fix this...

btw: i think blitz finds all .dll's either defined with a decls(mostly in the same folder) or in the system32 dir, so "temp=???" brings an error...

13
ok, here you go... seems to be to large for DBF-webspace, so i've uploaded it to my own webspace: http://www.dev-ch.de/upload/files/DrFreak339/direct_pixel.rar

EDIT: be sure to have a .decls for kernel32.dll with the lines:
Code: [Select]
.lib "kernel32.dll"
apiRtlMoveMemory(Destination*,Source,Length):"RtlMoveMemory"
apiRtlMoveMemory2(Destination,Source*,Length):"RtlMoveMemory"

14
ok guys, again: im trying to get all the speed possible, but only in software mode (no WritePixel(Fast))!
i thought it could be useful for everyone, if there'd be a stable (and sometimes faster) software version of this, especially for demos or stuff. can you help me getting the code even faster?

Code: [Select]
;.lib "kernel32.dll"
;apiRtlMoveMemory(Destination*,Source,Length):"RtlMoveMemory"
;apiRtlMoveMemory2(Destination,Source*,Length):"RtlMoveMemory"

Const ScreenWidth=320
Const ScreenHeight=240
Graphics ScreenWidth,ScreenHeight,32,2
SetBuffer BackBuffer()

Global VideoBank=CreateBank(ScreenWidth*ScreenHeight*4) ;create virtual buffer in 32 bit(4 bytes per pixel)
BufferInfo=CreateBank(32) ;store buffer information here
LockBuffer()
 apiRtlMoveMemory BufferInfo,GraphicsBuffer()+72,32
 size=PeekInt(BufferInfo,20) * PeekInt(BufferInfo,24) * PeekInt(BufferInfo,28)/8 ;global size of buffer in bytes
 offset=PeekInt(BufferInfo,0) ;?not sure? - i think its the offset of the buffer in the RAM
UnlockBuffer()
If BankSize(VideoBank)<size Then RuntimeError "Could not create buffer"

Repeat
 col=Rand($000000,$FFFFFF)
 For currentpos=0 To size Step 4 ;<- this is the drawing loop, which fills the screen!
  PokeInt VideoBank,currentpos,col ;draw to virtual buffer
 Next
 ;Pixel(MouseX(),MouseY()) ;mousecursor

 apiRtlMoveMemory2 offset,VideoBank,size ;copy virtual buffer to graphics buffer
 Color 255,0,0
 Text 10,10,GetFPS()
 Flip 0
Until KeyHit(1)
End

Global FPS,FPSFrame,FPSTime ;stolen from ashadow ;)
Function GetFPS(ms=1000)
ctime=MilliSecs()
FPSFrame=FPSFrame+1
If ctime-FPSTime>ms
 FPS=FPSFrame*1000/ms
 FPSFrame=0
 FPSTime=ctime
EndIf
Return FPS
End Function

Function Pixel(x=-1,y=-1,hexcol=$000000)
If x>-1 And x<ScreenWidth And y>-1 And y<ScreenHeight Then PokeInt VideoBank,(y*(ScreenWidth)*4)+(x*4),hexcol
End Function

PS: look for the drawing loop, i noticed some strange things in there:
1. it seems that adding a random drawing color increases speed
2. for-next-loops are the fastest. normally, while-wend should be the fastest, but its the slowest and repeat-until is ranked 2nd

PS2: having a good processor/fast ram increases speed very strong: i got ~250fps on my sempron 3000+ and about ~920fps on a athlon 3200+. what fps do you have? also, Devils Child has even more fps with writepixelfast, which is always slower on my PCs

15
Blitz / Re: Fast Fire [BB2D]
« on: August 10, 2007 »
~120 fps ("Flip 0") - athlon64 3200+; x600 se

16
Blitz / Re: another lens demo with source [BMax]
« on: August 06, 2007 »
ok, ive tested it now.. i got 11fps, sometimes 12...

17
Blitz / Re: another lens demo with source [BMax]
« on: August 03, 2007 »
my version (only 1 buffer manipulated  ::) ) :
Code: [Select]
Global MX,MY
Global d=200,r=Int(d/2),m=50
Global s#=Sqr(r*r-m*m)
Dim tfm(d*d*2)
Dim org(d*d*2)

Graphics 1024,768,32,2
HidePointer
SetBuffer BackBuffer()

Lens()
Global bg=LoadImage("forlense.png")

Repeat
Cls
DrawImage bg,0,0

MX=MouseX():MY=MouseY()
If MX=>GraphicsWidth()-d Then MX=GraphicsWidth()-d
If MY>=GraphicsHeight()-d Then MY=GraphicsHeight()-d

LockBuffer BackBuffer()
CopyOrg()
Draw()
UnlockBuffer BackBuffer()

Flip
Until KeyHit(1)
End

Function Lens()
Local x,y,a,b,z
For y=-r To -r+(d-1)
 For x=-r To r+(d-1)
  If (x*x+y*y)>=(s*s)
   a=x:b=y
  Else
   z=Sqr(r*r-x*x-y*y):a=Int(x*m/z+0.8):b=Int(y*m/z+0.8)
  EndIf
  tfm(1+(y+r)*d+(x+r))=(b+r)*d+(a+r)
 Next
Next
End Function

Function CopyOrg()
Local x=0,i,j
For i=MX To (MX+d)-1
 For j=MY To (MY+d)-1
  org(x)=ReadPixelFast(i,j,BackBuffer())
  x=x+1
 Next
Next
End Function

Function Draw()
x=1
For i=0 To d-1
 For j=0 To d-1
  WritePixelFast(i+MX,j+MY,org(tfm(x)))
  x=x+1
 Next
Next
End Function

18
Blitz / Re: another lens demo with source [BMax]
« on: August 02, 2007 »
of course.. my debugger is always disabled ;)
i know the stuff with debugger and speeddown and memory checks of blitz...

19
Blitz / Re: another lens demo with source [BMax]
« on: August 02, 2007 »
ahem.... *crappy x600se*..., 512 mb ram, athlon64 3200+

yep, the "se" IS slow... really...

20
Blitz / Re: another lens demo with source [BMax]
« on: August 01, 2007 »
well, i worked it out a bit, but ive still got only ~15-20fps at 1024x768, whereas my direct translation from bmax to bb3d brought me about 2fps or something...

Pages: [1] 2