It is currently Wed Jul 08, 2020 11:42 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: DrawingBuffer() and Brushes
PostPosted: Fri Jun 02, 2006 12:16 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Feb 09, 2006 11:27 pm
Posts: 2544
I found out, that on some graphic cards there is an impact, when the DrawingBuffer() command is used (should only return a memory value)

On a Mobility Radeon, the polygon in the following is not seen, only when removing the three DrawingBuffer lines...

On other graphic cards I did not have this effect, so I don't know if I wrote some wrong code, it's a hardware or software bug?!


Code:
Global Dim Polygon(8)

InitSprite()
win=OpenWindow(1,0,0,600,600,"3D-View",#PB_Window_ScreenCentered|#PB_Window_BorderLess)
   OpenWindowedScreen(win,0,0,600,600,0,0,0)

   polygon(0)=0
   polygon(1)=0
   polygon(2)=500
   polygon(3)=0
   polygon(4)=500
   polygon(5)=500
   polygon(6)=0
   polygon(7)=500

Repeat
windc=StartDrawing(ScreenOutput())

   DxMem=DrawingBuffer()
   DxMul=DrawingBufferPitch()
   DxPix=DrawingBufferPixelFormat()

DrawingMode(#PB_2DDrawing_Transparent)

winbrush=CreateSolidBrush_($ffff)
SelectObject_(windc,winbrush)
Polygon_(windc,@Polygon(),4)
DeleteObject_(winbrush)
StopDrawing()
FlipBuffers()

Until WaitWindowEvent(10) = #WM_CHAR


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Jun 02, 2006 4:21 pm 
Offline
Always Here
Always Here

Joined: Mon Sep 22, 2003 6:45 pm
Posts: 7446
Location: Norway
I also have this effect on a ProSavage DDR.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Jun 02, 2006 5:39 pm 
Offline
Always Here
Always Here
User avatar

Joined: Sat Aug 30, 2003 5:58 pm
Posts: 5883
Location: Denmark
Same on radeon 9600 xt 256


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Jun 02, 2006 10:34 pm 
Offline
Addict
Addict

Joined: Sat Apr 10, 2004 1:20 pm
Posts: 1143
Location: Germany
and same on Radeon X800GTO²
Quote:
0
Der Vorgang wurde erfolgreich beendet.
87
Falscher Parameter.
87
Falscher Parameter.
183
Eine Datei kann nicht erstellt werden, wenn sie bereits vorhanden ist.
87
Falscher Parameter.
0
Der Vorgang wurde erfolgreich beendet.
2
Das System kann die angegebene Datei nicht finden.
0
Der Vorgang wurde erfolgreich beendet.

maybe someone could post the error codes in english :idea:
Code:
ProcedureDLL.s GetLastError()
  err=GetLastError_()
  Debug err
  buffer.l=0
  ferr=FormatMessage_(#FORMAT_MESSAGE_ALLOCATE_BUFFER|#FORMAT_MESSAGE_FROM_SYSTEM,0,err,0,@buffer,0,0)
  If buffer<>0
    errormsg$=PeekS(buffer)
    LocalFree_(buffer)
    errormsg$=RemoveString(errormsg$,Chr(13)+Chr(10))
    ProcedureReturn errormsg$
  EndIf
EndProcedure

Global Dim Polygon(8)

InitSprite()
win=OpenWindow(1,0,0,600,600,"3D-View",#PB_Window_ScreenCentered|#PB_Window_BorderLess)
   OpenWindowedScreen(win,0,0,600,600,0,0,0)

   polygon(0)=0
   polygon(1)=0
   polygon(2)=500
   polygon(3)=0
   polygon(4)=500
   polygon(5)=500
   polygon(6)=0
   polygon(7)=500

Repeat
 windc=StartDrawing(ScreenOutput())

   DxMem=DrawingBuffer()
   err$=GetLastError()
   debug err$
   CallDebugger
   ;DxMul=DrawingBufferPitch()
   ;DxPix=DrawingBufferPixelFormat()

   ;DrawingMode(#PB_2DDrawing_Transparent)

   ;winbrush=CreateSolidBrush_($ffff)
   ;old=SelectObject_(windc,winbrush)
   ;Polygon_(windc,@Polygon(),4)
   ;DeleteObject_(winbrush)
   ;SelectObject_(windc,old)
 StopDrawing()

 FlipBuffers()

Until WaitWindowEvent(10) = #WM_CHAR


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Jun 05, 2006 8:10 am 
Offline
Addict
Addict
User avatar

Joined: Sat Feb 19, 2005 5:05 pm
Posts: 1769
Location: Norway
Not sure it's actually a bug, Fred need to clarify this.
My guess is that it's a documentation error regarding DrawingBuffer()

This example works. (sorry, quick and dirty just to show the difference)

Code:
Global Dim Polygon(8)

InitSprite()
win=OpenWindow(1,0,0,600,600,"3D-View",#PB_Window_ScreenCentered|#PB_Window_BorderLess)
   OpenWindowedScreen(win,0,0,600,600,0,0,0)

   polygon(0)=0
   polygon(1)=0
   polygon(2)=500
   polygon(3)=0
   polygon(4)=500
   polygon(5)=500
   polygon(6)=0
   polygon(7)=500

Repeat
windc=StartDrawing(ScreenOutput())
If windc

   DxMem=DrawingBuffer()
   DxMul=DrawingBufferPitch()
   DxPix=DrawingBufferPixelFormat()
 StopDrawing()

 windc=StartDrawing(ScreenOutput())
 If windc
 
  DrawingMode(#PB_2DDrawing_Transparent)
 
  winbrush=CreateSolidBrush_($ffff)
  SelectObject_(windc,winbrush)
  Polygon_(windc,@Polygon(),4)
  DeleteObject_(winbrush)
  StopDrawing()
 EndIf
EndIf
FlipBuffers()

Until WaitWindowEvent(10) = #WM_CHAR


Yep! StopDrawing() must be done then drawing has to be restarted again to do/use other gfx functions.
The reason for this is that I supect PB enteres into direct buffer manipulation,
so you must do StopDrawing() so PB can go back to normal buffering.

You also have to take great care exactly "when" you edit the graphics memory buffer directly.
You either should do it at the very start of your routine before any other gfx effects,
or at the very end when you are done with your gfx functions.

If you place DrawingBuffer() after all your other processing so that only StopDrawing is next your code works.
I have no idea why it behaves like this, but as I said. I'm unsure if this is a bug or a windows "feature"


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Jun 06, 2006 7:27 am 
Offline
Addict
Addict
User avatar

Joined: Thu Feb 09, 2006 11:27 pm
Posts: 2544
Start/StopDrawing costs a lot of time, I'll try to do a fast 3D rotation, so I needed to reduce these commands when possible.

I think I've solved it (at least for my special case), now the polygon (press 'c' in view mode to change color themes), boxes, text and lines ('a' changes the antialiasing mode) live all together in one StartStop Drawing code segment...

If you like to see the result...
>>> http://sudokuprogram.googlepages.com/forerunner.exe
you may also need
>>> http://sudokuprogram.googlepages.com/MichaelVogel.hst


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye