LWJGL Initializing the stencil buffer after initializing the display

StackOverflow https://stackoverflow.com/questions/23093375

  •  04-07-2023
  •  | 
  •  

سؤال

So I am trying to make a mod for a java game (Minecraft :P). Problem is I need the the stencil buffer.

Now I have checked to see if it is initialized at the display.Create() call. But the game doesn't require a stencil buffer and therefore it is not initialized. So my question is: Is it possible to initialize the stencil buffer after initializing the display? If not is there a good alternative?

Thanks in advance!

هل كانت مفيدة؟

المحلول

Forge for Minecraft initialize the display with stencil buffer:

in minecraft.java (version 1.6.4) you can find these line of code:

try
    {
        ForgeHooksClient.createDisplay();
    }

that calls this method:

static int stencilBits = 0;
public static void createDisplay() throws LWJGLException
{
    ImageIO.setUseCache(false); //Disable on-disc stream cache should speed up texture pack reloading.
    PixelFormat format = new PixelFormat().withDepthBits(24);
    try
    {
        //TODO: Figure out how to determine the max bits.
        Display.create(format.withStencilBits(8));
        stencilBits = 8;
    }
    catch(LWJGLException e)
    {
        Display.create(format);
        stencilBits = 0;
    }
}

So i think this is enough.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top