Jump to content

Recommended Posts

Posted

Hello, I have a problem when create the GUI in full screen. The fact that minecraft scales resolution in gui and etc. I have a question, is it possible to disable it, that the resolution is not scaled? My code:

glMatrixMode(GL_PROJECTION)
        glMatrix {
            glLoadIdentity()
            glViewport(0, 0, mc.displayWidth, mc.displayHeight)
            glOrtho(0.0, 800.0, 600.0, 0.0, 1000.0, 3000.0)

            glMatrixMode(GL_MODELVIEW)
            glMatrix {
                glLoadIdentity()
                glTranslated(0.0, 0.0, -2000.0)
                glClearColor(1.0f, 1.0f, 1.0f, 0.0f)
                glClearDepth(1.0)
                glClear(GL11.GL_COLOR_BUFFER_BIT or GL11.GL_DEPTH_BUFFER_BIT)
                // render something
                glMatrixMode(GL_MODELVIEW)
            }
            glMatrixMode(GL_PROJECTION)
        }

P.s. glMatrix ->

GLStateManager.pushMatrix()

block() <- Kotlin blocks

GLStateManager.popMatrix()

Posted

Well first and foremost stop using GL11 directly. Use GlStateManager.

Why do you need to disable the GUI scaling exactly? You can easily draw anything you want based on width/height and have your fullscreen GUI independent of the scaling factor.

 

3 hours ago, WildHeart said:

glMatrix ->

GLStateManager.pushMatrix()

You don't actually need to be pushing/popping matrix here at all because if you are doing it in the middle of your operations you are screwing them up and once your drawing is done the game will reset the matrix anyway.

 

3 hours ago, WildHeart said:

// render something

glMatrixMode(GL_MODELVIEW)

The matrix mode is already modelview though. You've just set it to modelview 7 lines above and you haven't changed it.

 

3 hours ago, WildHeart said:

glClearColor(1.0f, 1.0f, 1.0f, 0.0f)

glClearDepth(1.0)

glClear(GL11.GL_COLOR_BUFFER_BIT or GL11.GL_DEPTH_BUFFER_BIT)

Any reason you are doing this? The game just did that for you like 6 operations or so ago. You are not using a different framebuffer after all and the one currently in use has just been cleared.

 

3 hours ago, WildHeart said:

glViewport(0, 0, mc.displayWidth, mc.displayHeight)

You don't need to be doing this. The viewport is already set to the game's display width/height. Or to the custom framebuffer's resolution. In fact you could be screwing up someone's framebuffer setup by doing that.

 

Apart from all that looks fine-ish to me. Fix all that and see if you have any more issues.

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.

Announcements



×
×
  • Create New...

Important Information

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