Micropro's picture

error when draw enything without vga driver

i have a problem when draw anything like quads without vga driver on windows xp

the quads shows include line in quads center

please help me.................

Inline Images


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

You mean when using the "Microsoft GDI" renderer? AFAIK, that one has graphical glitches that are not possible to fix. Try using the Mesa3d renderer instead - it's faster, has higher quality and supports GL2.1 (i.e. shaders, VBOs, etc).

Micropro's picture

no the code that i used is opentk code to draw quads

                GL.Vertex2(-(ObjectWidth / 2), -(ObjectDepth / 2));
                GL.Vertex2(+(ObjectWidth / 2), -(ObjectDepth / 2));
                GL.Vertex2(+(ObjectWidth / 2), +(ObjectDepth / 2));
                GL.Vertex2(-(ObjectWidth / 2), +(ObjectDepth / 2));
the Fiddler's picture

Your code looks correct. OpenTK sends your commands directly to the OpenGL driver, which handles all drawing. OpenTK doesn't draw anything itself - the artifacts you are seeing are caused by the driver.

Check what GL.GetString(StringName.Vendor) returns. If it says "Microsoft" or "Microsoft GDI" then you won't be able to avoid artifacts, unless you install a different OpenGL driver. (Check the website of your computer vendor or use Mesa3d from my previous post).

Micropro's picture


Micropro's picture

i used this code in Module when i working in visual basic and the program working without any error

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)
    Dim hRC As System.IntPtr
    Public Sub EnableOpenGL(ByVal ghDC As System.IntPtr)
        Dim PixelFormat As Integer
        ZeroMemory(pfd, Len(pfd))
        pfd.Size = Len(pfd)
        pfd.Version = 1
        pfd.PixelType = Gdi.PFD_TYPE_RGBA
        pfd.ColorBits = 32
        pfd.DepthBits = 32
        pfd.StencilBits = 32
        pfd.LayerType = 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 DisableOpenGL()
        Wgl.wglMakeCurrent(IntPtr.Zero, IntPtr.Zero)
    End Sub
End Module

but i have a problem to convert this code to c# code

the Fiddler's picture

Can you please try the latest version from trunk? There is a slight chance that this issue might be visible only on specific pixel formats.

Micropro's picture

please any one help me my program is Collapse

i was work on my graphic program about 2 years

this problem make my program Collapse

this problem does not esist when i work on vb.net and tao

when i work on c# and tao and opentk this problem is show

please any one tell me the solution..............

c2woody's picture

Could be a bug in your program.

the Fiddler's picture

Three solutions:

  • Try selecting a different GraphicsMode.
  • Use the superior Mesa3d software renderer (it's free!).
  • Use a hardware accelerated OpenGL driver.

This is a well-known issue with Microsoft's OpenGL emulator. There's nothing OpenTK can do about it, but selecting a different GraphicsMode may help (it's possible that Tao was selecting a different mode than OpenTK).