Jump to content

Requesting OGL context with stencil buffer from within a mod


Umpani

Recommended Posts

Hi there!

 

I'm quite new to MC modding and not familiar with all of Forge's features. I'm experimenting with some alternative GUI rendering at the moment for which my code requires an 8bit stencil buffer to be available within Minecraft's OpenGL rendering context. By default, Minecraft seems to initialize the context without stencil buffer, which leads me to my question:

 

Is there any way for a Forge mod to signal that it requires a stencil buffer?

 

or will i have to modify the startGame() method of the net.minecraft.client.Minecraft class as I'm doing right now? (changed the Display initialization to Display.create((new PixelFormat()).withDepthBits(24).withStencilBits(8)); )

As far as i understand it, this would require users of my mod to modify their minecraft.jar instead of just copying the mod file to the mods folder. It might also lead to incompatibilities with other modifications (i could imagine that OptiFine for example also replaces some OpenGL initialization code).

 

Cheers,

Umpani

Link to comment
Share on other sites

Hello,

 

From what I can tell, there is no way to request a stencil buffer without editing the Minecraft class. That shouldn't be to much a problem. I don't know of any popular mods that edit that class unless it's some noob who can't use reflections. Also, Optifine doesn't edit it.

 

So, you have tow options. Edit the class or change your code so it doesn't require a stencil buffer. Either work would work.

Link to comment
Share on other sites

Thanks for the input, i think i will modify the Minecraft class for now and implement the third option later on: render my stuff to a FBO with an attatched depth/stencil buffer before rendering it to the default frame buffer. I prefer to avoid fiddling with major MC classes unless its absolutely necessary.

 

Thanks,

Umpani

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.