Dark Bit Factory & Gravity

PROGRAMMING => Freebasic => Topic started by: Stonemonkey on November 19, 2006

Title: 2 sided stencil functions?
Post by: Stonemonkey on November 19, 2006
I'm trying to get the opengl 2 sided stencil function working in FB but can't work it out, it's maybe something like:

Code: [Select]
dim glActiveStencilFaceEXT as PFNGLACTIVESTENCILFACEEXTPROC
glActiveStencilFaceEXT=cptr(PFNGLACTIVESTENCILFACEEXTPROC,glfwGetProcAddress("glActiveStencilFaceEXT"))

but that returns 0

Anyone know how it should be?
Title: Re: 2 sided stencil functions?
Post by: ninogenio on November 19, 2006
might something like this work mate?

sorry untested so im not sure.

Code: [Select]
dim PFNGLACTIVESTENCILFACEEXTPROC as sub()
dim glActiveStencilFaceEXT as PFNGLACTIVESTENCILFACEEXTPROC
glActiveStencilFaceEXT=cast(PFNGLACTIVESTENCILFACEEXTPROC,glfwGetProcAddress("glActiveStencilFaceEXT"))

<edit do you have the code in c?>
Title: Re: 2 sided stencil functions?
Post by: Stonemonkey on November 19, 2006
:( nope, doesn't work and no c code either. Only thing i've found on it is this

http://oss.sgi.com/projects/ogl-sample/registry/EXT/stencil_two_side.txt

Thanks anyway.
Title: Re: 2 sided stencil functions?
Post by: Stonemonkey on November 19, 2006
just tried exactly what i was trying but with some different extensions to do with secondary colour and they worked so it seems like maybe something missing somewhere.
Title: Re: 2 sided stencil functions?
Post by: ninogenio on November 19, 2006
cool!,

so it looks like a glitch in freebasic im always fasanated by the gl extension range there huge.
Title: Re: 2 sided stencil functions?
Post by: Stonemonkey on November 20, 2006
found this in glext but still to find out how to set which face.

glenable(GL_STENCIL_TEST_TWO_SIDE_EXT)
GL_ACTIVE_STENCIL_FACE_EXT(...)
Title: Re: 2 sided stencil functions?
Post by: Stonemonkey on November 20, 2006
nevermind, turns out it's not supported on my machine but there is an ati alternative if i can figure it out.
Title: Re: 2 sided stencil functions?
Post by: Jim on November 20, 2006
I worked on this on MSN with Fryer.  The upshot is that his ATI card/driver don't support that extension.
You need to call

Code: [Select]
char *ext;
ext = glGetString(GL_EXTENSIONS);
printf("%s\n", ext);

to get a list of the supported extensions.
If "GL_EXT_stencil_two_side" is part of the string that gets returns, then it's supported.  Otherwise it isn't and glfwGetProcAddress will likely return NULL.

Turns out ATI have their own version of this extension called "GL_ATI_separate_stencil".  Don't be fooled by the name though.  My nVidia card happily supports a number of ATI extensions.  Sadly not this one though, so Fryer's going to be stuck coding two different versions of the code to cover most drivers.

Jim

Title: Re: 2 sided stencil functions?
Post by: ninogenio on November 20, 2006
wow very handy to know that,

cheers for the info guys here is some karma.