Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Feature request (https://forums.graalonline.com/forums/forumdisplay.php?f=194)
-   -   Stencil buffer. (https://forums.graalonline.com/forums/showthread.php?t=134259787)

12171217 07-10-2010 09:35 PM

Stencil buffer.
 
Why can't we touch the stencil buffer in GS2? :(

I wanted to do reflection effects for players in water, among many other things..

Admins 07-11-2010 12:39 AM

This can probably be interesting but could you explain a little bit more what you want to do and how?

12171217 07-11-2010 03:12 AM

You would enable writing to the stencil buffer by doing a generic function, like
graphicsEnable(STENCIL_BUFFER);

then, you would, in most cases, clear the stencil buffer before you start using it.
graphicsClear(STENCIL_BUFFER);

Following, since you're in stencil mode, any showimgs, anything that would normally be drawn to the draw buffer is now drawn to the stencil buffer. You set an operation using
setStencilOp(STENCILOP);
and could choose from the following operations:

NPC Code:
STENCILOP_KEEP
STENCILOP_ZERO
STENCILOP_REPLACE
STENCILOP_INVERT
STENCILOP_INCR
STENCILOP_DECR



Finally, after creating a proper stencil buffer, you could then test against it when drawing images:
stencilTestFunc(STENCILTEST);

NPC Code:
STENCILTEST_NEVER
STENCILTEST_LESS
STENCILTEST_LESSEQUAL
STENCILTEST_EQUAL
STENCILTEST_GREATER
STENCILTEST_GREATEREQUAL
STENCILTEST_NOTEQUAL
STENCILTEST_ALWAYS



Setting a reference value could just be something like
stencilSetReference(int);

Could be used for tons of stuff.. Parallax scrolling backgrounds, reflections of sky images in water, reflections of players in water.. Tons of very interesting uses if it's put to good use.

If you've ever used the stencil buffer in an OpenGL application, you'd be familiar with how to use it and you'd see a bunch of potentional, too :D

12171217 07-13-2010 08:52 PM

Not to mention this could be used to clip images against bounding boxes, for minigames and such.. I really ****ing need that, especially since clipping showpolys is slow compared to taking advantage of the stencil buffer.

12171217 07-26-2010 08:21 AM

Bump. :D

Dnegel 08-03-2010 05:59 PM

This sounds interesting, should do something with it.

Crono 08-07-2010 02:04 AM

1 Attachment(s)
u cud use it to fulfil my dream~

DustyPorViva 08-07-2010 04:25 AM

Quote:

Originally Posted by Crono (Post 1591825)
u cud use it to fulfil my dream~

I've been wanting reflections for so long :(

Graal needs way more special effects. It can add so much atmosphere!

Fulg0reSama 08-07-2010 04:27 AM

Quote:

Originally Posted by Crono (Post 1591825)
u cud use it to fulfil my dream~

I've always wanted a lake and a fence.

12171217 08-07-2010 05:18 AM

Stencil buffer plz <3

Also, render-to-texture support while we're at it! If I'm not mistaken in the technique you use for certain GUIControls, it's nothing more than adapting your GUIDrawingPanel's.

MrOmega 08-13-2010 12:50 PM

I guessing this would be more efficient than having an extra image/NPC, rotating it, and lowering the alpha?

Crow 08-13-2010 12:50 PM

Quote:

Originally Posted by MrOmega (Post 1593403)
I guessing this would be more efficient than having an extra image/NPC, rotating it, and lowering the alpha?

Hell yes!

smirt362 08-13-2010 01:35 PM

Quote:

Parallax scrolling backgrounds
Hell yes

MrOmega 08-13-2010 03:16 PM

So graal will go from basically Zelda 3 with upgrades to to pretty much the four sword adventures? Effects wise. I vote yes.

adam 08-14-2010 01:43 AM

Would be nice if graal could compete with other 1-man team indie games someday.


All times are GMT +2. The time now is 06:17 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.