Dark Bit Factory & Gravity
PROGRAMMING => Freebasic => Topic started by: ScottyBrosious on January 07, 2007
-
I can't seem to find no tutorials on OpenGL Accum buffer.
I heard it can be use for things like motion blur, anti-aliasing ect...
Can someone please show me the basics of it?
I have a fireworks demo that is slowed down because the
motion blur is done by remembering points but it could be
speeded up with OpenGL's Accum buffer if only I knew how to
use it.
So could someone please teach me about it?
please
-
If you're using ptc it's not possible because you need to change the way OpenGL is initialised.
You need to set
cAccumBits
cAccumRedBits
cAccumGreenBits
cAccumBlueBits
cAccumAlphaBits
in the PIXELFORMATDESCRIPTOR.
The values will either be 24,8,8,8,0 or 32,8,8,8,8.
Once you've done that, each time you've rendered a frame, do
glReadBuffer(GL_BACK)
glAccum(GL_ACCUM, 0.5)
and that will add 0.5 of the backbuffer into the accumulation buffer.
When you want to retrieve the accumulation buffer to the screen,
glAccum(GL_RETURN, 1)
To clear the accumulation buffer to black
glClearAccum(0,0,0,1)
glClear(GL_ACCUM_BUFFER_BIT)
If you want to do this for motion blur, I think the sequence would be
render scene to backbuffer
accumulate
copy accumulation buffer to back buffer
flip
Jim
-
I can't test this atm as i'm using glfw and can't find how to enable the accumulation buffer but possibly something like this'll work (with a little messing around with the values) so as long as you have the buffer enabled or whatever when you initialise opengl, do this at the end of your rendering process before you flip the buffers:
'scale the contents (builds up from previous renders) of the accum buffer by 0.6
glaccum(gl_mult,0.6)
'scale the pixel buffer by 0.4 and add to the accum buffer (contents of pixel buffer not changed by this)
glaccum(gl_accum,0.4)
'copy the contents of the accum buffer scaled by 1.0 into the pixel buffer
glaccum(gl_return,1.0)
I think that's how it works but I think it can be quite slow too.
-
That's exactly how it works, I've just changed my Menger Sponge demo, and it took only 6 lines.
I didn't need to change the main startup code, I just added
glClearAccum(0,0,0,1);
glClear(GL_ACCUM_BUFFER_BIT);
glReadBuffer(GL_BACK);
and then just before I call SwapBuffers() I do
glAccum(GL_MULT, 0.75f);
glAccum(GL_ACCUM, 0.25f);
glAccum(GL_RETURN, 1.0f);
And that's it. It works really quick too.
Jim
-
Scotty,
I did an intro once that got killed on pouet (worst score I ever got and Ive had a few). The main reason was that it used accumulation buffer which seems to vary in performance and quality across cards much more than I thought it did. I looked around and sure enough very few people use it in intros/demos. Probably for this reason.
I think for fireworks or simple object,it might be better to do something like (typed form memory so may be buggy):
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDisable (GL_DEPTH_TEST);
glColor4f (0.0,0.0,0.0,0.5); // half alpha and black
drawScreensizeRectangle();//instead of clearing screen
glEnable (GL_DEPTH_TEST);
glDisable(GL_BLEND);
drawMyScene();
This should leave a trail behind your objects.
Its not ideal as a whole screen alpha blend is not that fast but it will at least be much more consistent than accumulation buffer support.
Also its not true motion blur (which should lead the object not just follow it) but then who cares?
-
The main reason was that it used accumulation buffer which seems to vary in performance and quality across cards much more than I thought it did.
Certainly from the things Stonemonkey and myself were trying today, even with the initialisation it can be tricky. For instance my driver gives me an accumulation buffer even if I specify cAccumBits=0, whereas most drivers need 1 or 32 in there, and most new cards use a 64 bit buffer.
How long ago was this demo?
Jim
-
Hmmm... I've been searching around, but I can't find a way to initialize the stencil buffer with GLFW either. Maybe they will add that functionality if we request it. The site says that they are working on version 2.6 now. If not, I think I'm going to start using gfxlib for my opengl stuff. Last week, Lillo added an extension requester function already. The only thing we need now, is a way to request the stencil buffer bits amount and the accumulation buffer bits amount. I'm going to request this. Actually, I think with these functions added, gfxlib would be better than glfw. :inspired:
-
If by gfxlib you mean fbgfx then it can already be made to work. You just have to watch that the defines for the flags for enabling stecil/accum buffers have been changed between 0.16 and 0.17 and that's caused a few problems with source not matching libs.
Jim
-
Do you mean there is a way to request the actual bits, or just the buffers?
-
In fbgfx, setting GFX_ACCUMULATION_BUFFER and GFX_STENCIL_BUFFER sets cAccumBits=32 and cStencilBits=32 when it initialises the pixel format. What you *actually* get is up to the driver. In mine I get 64 bit accumulation buffer, with 16bit RGBA channels. And I get that even when cAccumBits=0 !!
Jim
-
Jim,
the intro I refer to was just last year. Its possible I screwed some initialisation like you say but I did a little research afterwards and found people on the web complaining about accumulation buffer support. Now if its on the web it, just has to be true ::)
-
cool i didnt know the about the accum buffer i just changed one off my proges to use it and although it works the speed has changed from around 60fps to 1 or 2fps on my geforce 4 ti4600 so im guesing its either my card or the way ive implimented it?
'
' Paralax Starfield.
' By Clyde Radcliffe & Special thanks to Blitz Amateur for the Random Function.
' Made in Dec '06
' modifyd slightly for opengl now in 3d
Option Explicit
Option Static
#Include Once "windows.bi"
#Include Once "GL\gl.bi"
#Include Once "GL\glext.bi"
#Include Once "GL\glu.bi"
#Include Once "fbgfx.bi"
#Include Once "crt.bi"
type mat
m0 as double
m1 as double
m2 as double
m3 as double
m4 as double
m5 as double
m6 as double
m7 as double
m8 as double
m9 as double
m10 as double
m11 as double
m12 as double
m13 as double
m14 as double
m15 as double
end type
type entity_pos
x_pos as double
y_pos as double
z_pos as double
end type
type entity_rot
x_rot as double
y_rot as double
z_rot as double
end type
type entity
position as entity_pos ptr
rotation as entity_rot ptr
matrix as mat ptr
end type
declare sub loadentityidentity( object as entity ptr )
declare sub positionentity( object as entity ptr , byval xpos as double , byval ypos as double , byval zpos as double )
declare sub moveentity( object as entity ptr , byval xpos as double , byval ypos as double , byval zpos as double )
declare sub moveentityW( object as entity ptr , byval xpos as double , byval ypos as double , byval zpos as double )
declare sub rotateentity( object as entity ptr , xpos as double , ypos as double , zpos as double )
declare sub copymatrix4x4( destination as entity ptr , byval source as entity ptr )
declare sub mulmatrix4x4( byval matrix1 as entity ptr , byval matrix2 as entity ptr , resultmatrix as entity ptr )
declare sub transposematrix( matrix as entity ptr )
declare sub multranslmatrix4x4( byval m1 as entity ptr , byval m2 as entity ptr , destination as entity ptr )
declare sub renderworld( camera as entity ptr )
declare sub clearworld()
declare sub MoveRotateCam( camera as entity ptr )
declare function new_entity() as entity ptr
declare sub convertMarray( dest as double ptr , byval source as entity ptr )
declare sub delete_entity( object as entity ptr )
Declare Sub FeedPixels( Byval X As double , ByVal Y As double , ByVal Z As double , ByVal Col As Integer )
Declare Sub InitializeParallax()
Declare Sub UpdateStars()
Declare Function Randd( ByVal lower as double , ByVal upper as double ) As double
declare function setVsync( byval inte as integer )
Const MAXSTARS=2000
dim shared as double Psin(0 to 360) , Pcos(0 to 360)
dim shared as double XRES = 800
dim shared as double YRES = 600
dim shared as entity ptr object0 , object1 , camera
Dim shared pglPointParameterfvEXT as PFNGLPOINTPARAMETERFVEXTPROC
Dim Shared StarX( MAXSTARS ) , StarY( MAXSTARS ) , StarZ( MAXSTARS ) , StarC( MAXSTARS ) , StarS( MAXSTARS )
dim x as integer
for x = 1 to 360
Psin( x ) = sin( x * 3.1415 / 180.0 )
Pcos( x ) = cos( x * 3.1415 / 180.0 )
next
object0 = new_entity()
object1 = new_entity()
camera = new_entity()
loadentityidentity( object0 )
loadentityidentity( object1 )
positionentity( camera , 1 , 0 , 0 )
InitializeParallax()
setVsync(1)
glClearAccum(0,0,0,1)
glClear(GL_ACCUM_BUFFER_BIT)
glReadBuffer(GL_BACK)
Dim Key As String
While Key<>Chr(27)
UpdateStars()
glAccum(GL_MULT, 0.75f)
glAccum(GL_ACCUM, 0.25f)
glAccum(GL_RETURN, 1.0f)
renderworld( camera )
clearworld()
camera->rotation->y_rot -= 1
camera->rotation->z_rot -= 1
Key=Inkey()
Wend
delete_entity( camera )
Sub FeedPixels( Byval x As double , Byval y As double , Byval z As double , Byval col As Integer)
dim as integer r = col shr 16 and 255
dim as integer g = col shr 8 and 255
dim as integer b = col and 255
glColor3ub( r , g , b )
glEnable(GL_BLEND)
glPointSize(12.5)
glBegin(GL_POINTS)
glVertex3f( x / ( XRES / 4 ) , y / ( YRES / 4 ) , Z/12 )
glEnd()
glDisable(GL_BLEND)
End Sub
Sub InitializeParallax()
screen 19 , 32 , , 3
glViewport 0 , 0 , xres , yres
glMatrixMode GL_PROJECTION
glLoadIdentity
gluPerspective( 45 , xres / yres , 1 , 100 )
glMatrixMode GL_MODELVIEW
glLoadIdentity
glShadeModel GL_SMOOTH
glClearColor 0.0, 0.0, 0.0, 1.0
glClearDepth 1.0
glEnable GL_DEPTH_TEST
glDepthFunc GL_LEQUAL
glHint GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST
glEnable(GL_POINT_SMOOTH)
glEnable(GL_BLEND)
glHint(GL_POINT_SMOOTH, GL_NICEST)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
pglPointParameterfvEXT = cast( PFNGLPOINTPARAMETERFVEXTPROC , wglGetProcAddress("glPointParameterfvEXT") )
dim as single attenuation(3) = { 0.0, 0.5, 0.0 }
pglPointParameterfvEXT( GL_DISTANCE_ATTENUATION_EXT , @attenuation(0) )
Dim Setup
For Setup=0 To MAXSTARS-1
StarX( Setup ) = Randd( -XRES , XRES - 1 )
StarY( Setup ) = Randd( -YRES , YRES - 1 )
StarZ( Setup ) = Randd( -65 , 65 )
StarS( Setup ) = Randd( 1 , 6 )
StarC( Setup ) = Randd(&H646464,&HFFFFFF)
Next
End Sub
function new_entity() as entity ptr
dim tmp_entity as entity ptr
tmp_entity = callocate( len(entity) )
tmp_entity->position = callocate(len(entity_pos))
tmp_entity->rotation = callocate(len(entity_rot))
tmp_entity->matrix = callocate(len(mat))
return(tmp_entity)
end function
sub clearworld()
glClear GL_COLOR_BUFFER_BIT OR GL_DEPTH_BUFFER_BIT
end sub
sub delete_entity( object as entity ptr )
deallocate(object->rotation)
deallocate(object->position)
deallocate(object->matrix)
deallocate(object)
end sub
sub renderworld( camera as entity ptr )
dim as double cam(0 to 3,0 to 3)
glloadidentity
loadentityidentity( camera )
moveentity( camera , camera->position->x_pos , camera->position->y_pos , camera->position->z_pos )
rotateentity( camera , 0 , camera->rotation->y_rot , 0 )
rotateentity( camera , camera->rotation->x_rot , 0 , 0 )
rotateentity( camera , 0 , 0 , camera->rotation->z_rot )
transposematrix( camera )
convertMarray( @cam(0,0) , camera )
glloadmatrixd( @cam(0,0) )
flip
end sub
sub convertMarray( dest as double ptr , byval source as entity ptr )
dest[0] = source->matrix->m0
dest[1] = source->matrix->m1
dest[2] = source->matrix->m2
dest[3] = source->matrix->m3
dest[4] = source->matrix->m4
dest[5] = source->matrix->m5
dest[6] = source->matrix->m6
dest[7] = source->matrix->m7
dest[8] = source->matrix->m8
dest[9] = source->matrix->m9
dest[10] = source->matrix->m10
dest[11] = source->matrix->m11
dest[12] = source->matrix->m12
dest[13] = source->matrix->m13
dest[14] = source->matrix->m14
dest[15] = source->matrix->m15
end sub
sub loadentityidentity( object as entity ptr )
object->matrix->m0 = 1
object->matrix->m1 = 0
object->matrix->m2 = 0
object->matrix->m3 = 0
object->matrix->m4 = 0
object->matrix->m5 = 1
object->matrix->m6 = 0
object->matrix->m7 = 0
object->matrix->m8 = 0
object->matrix->m9 = 0
object->matrix->m10 = 1
object->matrix->m11 = 0
object->matrix->m12 = 0
object->matrix->m13 = 0
object->matrix->m14 = 0
object->matrix->m15 = 1
end sub
sub positionentity( object as entity ptr , byval xpos as double , byval ypos as double , byval zpos as double )
object->position->x_pos = xpos
object->position->y_pos = ypos
object->position->z_pos = zpos
end sub
sub moveentity( object as entity ptr , byval xpos as double , byval ypos as double , byval zpos as double )
dim as entity ptr Tmp1 , Tmp2
Tmp1 = new_entity()
Tmp2 = new_entity()
loadentityidentity( Tmp1 )
Tmp1->matrix->m12 = xpos
Tmp1->matrix->m13 = ypos
Tmp1->matrix->m14 = zpos
mulmatrix4x4( Tmp1 , object , Tmp2 )
copymatrix4x4( object , Tmp2 )
delete_entity(Tmp1)
delete_entity(Tmp2)
end sub
sub moveentityW( object as entity ptr , byval xpos as double , byval ypos as double , byval zpos as double )
object->matrix->m12 += xpos
object->matrix->m13 += ypos
object->matrix->m14 += zpos
end sub
sub rotateentity( object as entity ptr , xpos as double , ypos as double , zpos as double )
dim as entity ptr Tmp1 , Tmp2
Tmp1 = new_entity()
Tmp2 = new_entity()
if xpos > 360 then xpos = 0
if xpos < 0 then xpos = 360
if ypos > 360 then ypos = 0
if ypos < 0 then ypos = 360
if zpos > 360 then zpos = 0
if zpos < 0 then zpos = 360
'rotate on xaxis
if xpos then
loadentityidentity( Tmp1 )
Tmp1->matrix->m5 = Pcos( xpos )
Tmp1->matrix->m6 = -Psin( xpos )
Tmp1->matrix->m9 = Psin( xpos )
Tmp1->matrix->m10 = Pcos( xpos )
mulmatrix4x4( Tmp1 , object , Tmp2 )
copymatrix4x4( object , Tmp2 )
endif
'rotate on yaxis
if ypos then
loadentityidentity( Tmp1 )
Tmp1->matrix->m0 = Pcos( ypos )
Tmp1->matrix->m2 = Psin( ypos )
Tmp1->matrix->m8 = -Psin( ypos )
Tmp1->matrix->m10 = Pcos( ypos )
mulmatrix4x4( Tmp1 , object , Tmp2 )
copymatrix4x4( object , Tmp2 )
endif
'rotate on zaxis
if zpos then
loadentityidentity( Tmp1 )
Tmp1->matrix->m0 = Pcos( zpos )
Tmp1->matrix->m1 = -Psin( zpos )
Tmp1->matrix->m4 = Psin( zpos )
Tmp1->matrix->m5 = Pcos( zpos )
mulmatrix4x4( Tmp1 , object , Tmp2 )
copymatrix4x4( object , Tmp2 )
endif
delete_entity(Tmp1)
delete_entity(Tmp2)
end sub
sub copymatrix4x4( destination as entity ptr , byval source as entity ptr )
destination->matrix->m0 = source->matrix->m0
destination->matrix->m1 = source->matrix->m1
destination->matrix->m2 = source->matrix->m2
destination->matrix->m3 = source->matrix->m3
destination->matrix->m4 = source->matrix->m4
destination->matrix->m5 = source->matrix->m5
destination->matrix->m6 = source->matrix->m6
destination->matrix->m7 = source->matrix->m7
destination->matrix->m8 = source->matrix->m8
destination->matrix->m9 = source->matrix->m9
destination->matrix->m10 = source->matrix->m10
destination->matrix->m11 = source->matrix->m11
destination->matrix->m12 = source->matrix->m12
destination->matrix->m13 = source->matrix->m13
destination->matrix->m14 = source->matrix->m14
destination->matrix->m15 = source->matrix->m15
end sub
sub transposematrix( object as entity ptr )
dim as entity ptr Tmp1 , Tmp2
Tmp1 = new_entity()
Tmp2 = new_entity()
copymatrix4x4( Tmp1 , object )
Tmp1->matrix->m0 = object->matrix->m0
Tmp1->matrix->m1 = object->matrix->m4
Tmp1->matrix->m2 = object->matrix->m8
Tmp1->matrix->m4 = object->matrix->m1
Tmp1->matrix->m5 = object->matrix->m5
Tmp1->matrix->m6 = object->matrix->m9
Tmp1->matrix->m8 = object->matrix->m2
Tmp1->matrix->m9 = object->matrix->m6
Tmp1->matrix->m10 = object->matrix->m10
multranslmatrix4x4( object , Tmp1 , Tmp2 )
copymatrix4x4( object , Tmp2 )
delete_entity(Tmp1)
delete_entity(Tmp2)
end sub
sub multranslmatrix4x4( byval m1 as entity ptr , byval m2 as entity ptr , destination as entity ptr )
dim as double Tx , Ty , Tz
Tx = m1->matrix->m0 * m2->matrix->m12 + m1->matrix->m1 * m2->matrix->m13 + m1->matrix->m2 * m2->matrix->m14
Ty = m1->matrix->m4 * m2->matrix->m12 + m1->matrix->m5 * m2->matrix->m13 + m1->matrix->m6 * m2->matrix->m14
Tz = m1->matrix->m8 * m2->matrix->m12 + m1->matrix->m9 * m2->matrix->m13 + m1->matrix->m10 * m2->matrix->m14
copymatrix4x4( destination , m2 )
Tx += m2->matrix->m8
Ty += m2->matrix->m9
Tz += m2->matrix->m10
destination->matrix->m12 = Tx
destination->matrix->m13 = Ty
destination->matrix->m14 = Tz
end sub
sub mulmatrix4x4( byval matrix1 as entity ptr , byval matrix2 as entity ptr , resultmatrix as entity ptr )
resultmatrix->matrix->m0 = matrix1->matrix->m0 * matrix2->matrix->m0 + matrix1->matrix->m1 * matrix2->matrix->m4 + matrix1->matrix->m2 * matrix2->matrix->m8 + matrix1->matrix->m3 * matrix2->matrix->m12
resultmatrix->matrix->m1 = matrix1->matrix->m0 * matrix2->matrix->m1 + matrix1->matrix->m1 * matrix2->matrix->m5 + matrix1->matrix->m2 * matrix2->matrix->m9 + matrix1->matrix->m3 * matrix2->matrix->m13
resultmatrix->matrix->m2 = matrix1->matrix->m0 * matrix2->matrix->m2 + matrix1->matrix->m1 * matrix2->matrix->m6 + matrix1->matrix->m2 * matrix2->matrix->m10 + matrix1->matrix->m3 * matrix2->matrix->m14
resultmatrix->matrix->m3 = matrix1->matrix->m0 * matrix2->matrix->m3 + matrix1->matrix->m1 * matrix2->matrix->m7 + matrix1->matrix->m2 * matrix2->matrix->m11 + matrix1->matrix->m3 * matrix2->matrix->m15
resultmatrix->matrix->m4 = matrix1->matrix->m4 * matrix2->matrix->m0 + matrix1->matrix->m5 * matrix2->matrix->m4 + matrix1->matrix->m6 * matrix2->matrix->m8 + matrix1->matrix->m7 * matrix2->matrix->m12
resultmatrix->matrix->m5 = matrix1->matrix->m4 * matrix2->matrix->m1 + matrix1->matrix->m5 * matrix2->matrix->m5 + matrix1->matrix->m6 * matrix2->matrix->m9 + matrix1->matrix->m7 * matrix2->matrix->m13
resultmatrix->matrix->m6 = matrix1->matrix->m4 * matrix2->matrix->m2 + matrix1->matrix->m5 * matrix2->matrix->m6 + matrix1->matrix->m6 * matrix2->matrix->m10 + matrix1->matrix->m7 * matrix2->matrix->m14
resultmatrix->matrix->m7 = matrix1->matrix->m4 * matrix2->matrix->m3 + matrix1->matrix->m5 * matrix2->matrix->m7 + matrix1->matrix->m6 * matrix2->matrix->m11 + matrix1->matrix->m7 * matrix2->matrix->m15
resultmatrix->matrix->m8 = matrix1->matrix->m8 * matrix2->matrix->m0 + matrix1->matrix->m9 * matrix2->matrix->m4 + matrix1->matrix->m10 * matrix2->matrix->m8 + matrix1->matrix->m11 * matrix2->matrix->m12
resultmatrix->matrix->m9 = matrix1->matrix->m8 * matrix2->matrix->m1 + matrix1->matrix->m9 * matrix2->matrix->m5 + matrix1->matrix->m10 * matrix2->matrix->m9 + matrix1->matrix->m11 * matrix2->matrix->m13
resultmatrix->matrix->m10 = matrix1->matrix->m8 * matrix2->matrix->m2 + matrix1->matrix->m9 * matrix2->matrix->m6 + matrix1->matrix->m10 * matrix2->matrix->m10 + matrix1->matrix->m11 * matrix2->matrix->m14
resultmatrix->matrix->m11 = matrix1->matrix->m8 * matrix2->matrix->m3 + matrix1->matrix->m9 * matrix2->matrix->m7 + matrix1->matrix->m10 * matrix2->matrix->m11 + matrix1->matrix->m11 * matrix2->matrix->m15
resultmatrix->matrix->m12 = matrix1->matrix->m12 * matrix2->matrix->m0 + matrix1->matrix->m13 * matrix2->matrix->m4 + matrix1->matrix->m14 * matrix2->matrix->m8 + matrix1->matrix->m15 * matrix2->matrix->m12
resultmatrix->matrix->m13 = matrix1->matrix->m12 * matrix2->matrix->m1 + matrix1->matrix->m13 * matrix2->matrix->m5 + matrix1->matrix->m14 * matrix2->matrix->m9 + matrix1->matrix->m15 * matrix2->matrix->m13
resultmatrix->matrix->m14 = matrix1->matrix->m12 * matrix2->matrix->m2 + matrix1->matrix->m13 * matrix2->matrix->m6 + matrix1->matrix->m14 * matrix2->matrix->m10 + matrix1->matrix->m15 * matrix2->matrix->m14
resultmatrix->matrix->m15 = matrix1->matrix->m12 * matrix2->matrix->m3 + matrix1->matrix->m13 * matrix2->matrix->m7 + matrix1->matrix->m14 * matrix2->matrix->m11 + matrix1->matrix->m15 * matrix2->matrix->m15
end sub
Sub UpdateStars()
Dim Update
For Update=0 To MAXSTARS-1
StarX( Update )=StarX( Update )+StarS( Update )
If StarX( Update )>XRES-1 Then
StarX( Update ) = - xres
StarY( Update ) = Randd( -YRES , YRES )
StarZ( Update ) = Randd( -65 , 65 )
StarC( Update ) = Randd( &H646464 , &HFFFFFF )
End If
FeedPixels( StarX( Update ) , StarY( Update ) , StarZ( Update ) , StarC( Update ) )
Next
End Sub
Function Randd(ByVal lower As double, ByVal upper As double) As double
Dim As double temp, value, dist
If upper < lower Then
temp=upper
upper=lower
lower=temp
End If
value=lower
dist = abs(lower-upper)
Return ( value + ( Rnd(1)*dist ) )
End Function
type PFNW as sub ( byval my_var as integer )
function setVsync(byval inte as integer)
dim wglSwapInterval as sub ( byval my_var as integer )
wglSwapInterval = cast( sub ( byval my_var as integer ) , wglGetProcAddress("wglSwapIntervalEXT") )
wglSwapInterval(inte)
return 0
end function
-
Works pretty well here, radeon 1650 but as was discussed before, performance does seem to vary quite a bit from card to card. I did have to set the screen flag &h20 (GFX_ACCUMULATION_BUFFER)to enable the accum buffer to work for me though.
and in the wiki it says it's flag &h20000.
-
Well, the feature request has been accepted, and has already been implemented! :o
Heh, last time I checked, GLFW also didn't support multisample for fullscreen antialiasing, what gfxlib does already :)
Anyway, I've added pixel format customization capabilities in the form of additional parameters accepted by ScreenControl; these are the new #defines accepted:
#define SET_GL_COLOR_BITS 105
#define SET_GL_COLOR_RED_BITS 106
#define SET_GL_COLOR_GREEN_BITS 107
#define SET_GL_COLOR_BLUE_BITS 108
#define SET_GL_COLOR_ALPHA_BITS 109
#define SET_GL_DEPTH_BITS 110
#define SET_GL_STENCIL_BITS 111
#define SET_GL_ACCUM_BITS 112
#define SET_GL_ACCUM_RED_BITS 113
#define SET_GL_ACCUM_GREEN_BITS 114
#define SET_GL_ACCUM_BLUE_BITS 115
#define SET_GL_ACCUM_ALPHA_BITS 116
#define SET_GL_NUM_SAMPLES
GL_COLOR_BITS if set overrides the "depth" parameter to Screen(Res), otherwise it is equal to it. If not specified, other values by default are: no accumulation buffer (but if you OR GFX_ACCUMULATION_BUFFER to the Screen flags, you get a 32bit one), no stencil buffer (but if GFX_STENCIL_BUFFER is set, you get an 8bit one), and a 16bit depth buffer. Also, if GFX_MULTISAMPLE is set and no number of samples are specified, by default 4 samples are requested, otherwise 0.