Author Topic: 2 sided stencil functions?  (Read 4046 times)

0 Members and 1 Guest are viewing this topic.

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
2 sided stencil functions?
« 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?

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: 2 sided stencil functions?
« Reply #1 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?>
Challenge Trophies Won:

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
Re: 2 sided stencil functions?
« Reply #2 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.

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
Re: 2 sided stencil functions?
« Reply #3 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.

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: 2 sided stencil functions?
« Reply #4 on: November 19, 2006 »
cool!,

so it looks like a glitch in freebasic im always fasanated by the gl extension range there huge.
Challenge Trophies Won:

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
Re: 2 sided stencil functions?
« Reply #5 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(...)

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
Re: 2 sided stencil functions?
« Reply #6 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.

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: 2 sided stencil functions?
« Reply #7 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

Challenge Trophies Won:

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: 2 sided stencil functions?
« Reply #8 on: November 20, 2006 »
wow very handy to know that,

cheers for the info guys here is some karma.
Challenge Trophies Won: