Jump to content
  • Advertisement
Sign in to follow this  

OpenGL Full Screen Trouble!

This topic is 3971 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm using vb.net 2003 I can't seem to get may app to go fullscreen I don't know whats up here,the nehe code in C# works I don't know why I'm having this problem. (zeromemory and kernal both work if you notice them commented out) Here is the code, it is a little bit messy because I've been farting around with it all day.
Imports Tao.OpenGl
Imports Tao.Platform.Windows
Module OpenGl
    Private Declare Sub ZeroMemory Lib "kernel32.dll" Alias "RtlZeroMemory" (ByVal Destination As Gdi.PIXELFORMATDESCRIPTOR, ByVal Length As Integer)
    Private Declare Sub ZeroMemoryfull Lib "kernel32.dll" Alias "RtlZeroMemory" (ByVal Destination As Gdi.DEVMODE, ByVal Length As Integer)
    Dim hRC As System.IntPtr

    Public Sub EnableOpenGL(ByVal ghDC As System.IntPtr)
        Kernel.SetProcessWorkingSetSize(Process.GetCurrentProcess().Handle, -1, -1)
        Dim PixelFormat As Integer
        Dim fsc As New Gdi.DEVMODE
        Dim fscreen As Screen

        If fullscreen Then
            'ZeroMemoryfull(fsc, Len(fsc))
            fsc.dmSize = Len(fsc)
            fsc.dmPelsWidth = 800
            fsc.dmPelsHeight = 600
            fsc.dmBitsPerPel = 32
            fsc.dmFields = Gdi.DM_BITSPERPEL Or Gdi.DM_PELSWIDTH Or Gdi.DM_PELSHEIGHT

            'If User.ChangeDisplaySettings(fsc, User.CDS_FULLSCREEN) <> User.DISP_CHANGE_SUCCESSFUL Then
            ' If The Mode Fails, Offer Two Options.  Quit Or Use Windowed Mode.
            ''If M''essageBox.Show("The Requested Fullscreen Mode Is Not Supported By" & Constants.vbLf & "Your Video Card.  Use Windowed Mode Instead?", "NeHe GL", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) = DialogResult.Yes Then
            ''fullscreen = False ' Windowed Mode Selected. Fullscreen = false
            ' Pop up A Message Box Lessing User Know The Program Is Closing.
            ''MessageBox.Show("Program Will Now Close.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Stop)
            ''fullscreen = False ' Return false
            ''End If
        End If

        ''End If
        'ZeroMemory(pfd, Len(pfd))
        pfd.nSize = Len(pfd)
        pfd.nVersion = 1
        pfd.iPixelType = Gdi.PFD_TYPE_RGBA
        pfd.cColorBits = 32
        pfd.cDepthBits = 32
        pfd.cStencilBits = 32
        pfd.iLayerType = Gdi.PFD_MAIN_PLANE

        PixelFormat = Gdi.ChoosePixelFormat(ghDC, pfd)
        If PixelFormat = 0 Then
            MessageBox.Show("Unable to retrieve pixel format")
        End If
        If Not (Gdi.SetPixelFormat(ghDC, PixelFormat, pfd)) Then
            MessageBox.Show("Unable to set pixel format")
        End If
        hRC = Wgl.wglCreateContext(ghDC)
        If hRC.ToInt32 = 0 Then
            MessageBox.Show("Unable to get rendering context")
        End If
        If Not (Wgl.wglMakeCurrent(ghDC, hRC)) Then
            MessageBox.Show("Unable to make rendering context current")
        End If

    End Sub
    Sub KillFullScreen()
        User.ChangeDisplaySettings(IntPtr.Zero, 0)
    End Sub
    Sub DisableOpenGL()
        Wgl.wglMakeCurrent(IntPtr.Zero, IntPtr.Zero)
    End Sub
End Module

Thanks Steve

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!