i wanted to speed this up and having some more flexibility for realtime effects like twirl. in this way i created an array and started to write my own drawing functions (writing changed pixels directs into the array).
the last methode works too but is very slow in compare to the drawing direct to screen routine 8O I ever tought handling a graphic in an array would be mutch better and faster for manipulations.
when getting my tool ready i want that the routines are platform indpendent (for example an array;) if possible. so it would be nice to finding a way that dont require DX, OGL, GDI. The user should be able to use the results for his DX, OGL, GDI routines
If you think that DX based routines would speed my routines for realtime drawing and manipulations a lot up - then my routines should work from now only on windows with dx platforms
following working small example will show you the big different between drawing direct to an image and drawing to an array. please dont blame me that plotting the finished drawed/manipulated array is slow - i know and please remeber that this only happen when all operations are finished.
Code: Select all
Dim dTexture(256,256)
; ---- routine for drawing a box direct into array ------
Procedure DrawArray_Box(x,y,width,height,col)
For ix = x To x+width
For iy = y To x+height
dTexture(ix,iy) = col
Next
Next
EndProcedure
; ------ draw box direct into array ------
MessageRequester("Start","Drawing box into array",0)
starttime=TimeGetTime_()
For i = 0 To 100
DrawArray_Box(100,100,100,100,255)
Next
totaltime=TimeGetTime_()-starttime
MessageRequester("Finish","Array finished in "+Str(totaltime)+" milliseconds",0)
; ------ draw box direct to bitmap ------
CreateImage(0,256,256)
MessageRequester("Start","Draw box direct to bitmap",0)
starttime=TimeGetTime_()
StartDrawing(ImageOutput())
For i = 0 To 100
Box(100,100,100,100,255)
Next
StopDrawing()
totaltime=TimeGetTime_()-starttime
MessageRequester("Finish","Bitmap finished in "+Str(totaltime)+" milliseconds",0)
; ---- Save Bitmap - Array Methode ----
SaveImage(0,"c:\DrawTest_ToBitmap.bmp")
; ---- Save Bitmap - Bitmap Methode ----
CreateImage(1,256,256)
StartDrawing(ImageOutput())
For x = 0 To 255
For y = 0 To 255
col = dTexture(x,y)
Plot (x,y,col)
Next
Next
StopDrawing()
SaveImage(1,"c:\DrawTest_ToArray.bmp")
End
91 ms - drawing direct into array
2 ms - drawing direct to bitmap
i have seen code snips and answers from guys to try GetDIBits_ and SetDIBits_ and using pointers but havent really understand it
please let us discuse the fastest way with full working examples and good documentation. many thanks
i think direct memory access would be the best and fastest way (no array!?). how to code this?
