BlueMonkMN's picture

Vista?

Some Vista users are reporting problems, and I'm not sure if it's related to OpenTK or my own code. So far I know one user has version 6.0.6000.16386 of opengl32.dll, and is reporting the following error:
Error Screenshot

My own version of opengl.dll (5.1.2600.2180) on Windows XP works fine (I assume that's the significant DLL here). Is there possibly a compatibility problem working with different versions of opengl32.dll? Or just an OS problem?

The game in question was the same one linked in my previous post:
http://sgdk2.enigmadream.com/support/TVSGDK2.zip
And the OpenTK code is based off of version 1166 from SubVersion.

(Edit: Also, what in the world is this "@" prefix I see on some of the parameters. I can't find any documentation on that for C#.)


Comments

Comment viewing options

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

occurs when pressing cursor down:

Free Image Hosting at www.ImageShack.us

occurs when pressing left Ctrl:

Free Image Hosting at www.ImageShack.us

And before you ask: Yes, it is Vista. :P

BlueMonkMN's picture

Dang, it looks like I'm going to have to (get some more people to help me) do some heavy testing/debugging on Vista. It's strange that Vista would display simple errors like that XP doesn't when running on the same .NET framework... unless... when you say Vista64, does that mean we're talking about a 64-bit OS where converting an LParam/IntPtr to an Int32 causes that error like that?

What would be the proper way to write this code to work on both 32- and 64-bit OSes?

      switch (m.WParam.ToInt32())
      {
         case 0x10:
            if ((m.LParam.ToInt32() & 0xFF0000) == 0x2A0000)
               return (int)Key.LShift;
            else
               return (int)Key.RShift;
            break;
         case 0x11:
            if ((m.LParam.ToInt32() & 0x1000000) != 0)
               return (int)Key.RControl;
            else
               return (int)Key.LControl;
            break;
         case 0x0d:
            if ((m.LParam.ToInt32() & 0x1000000) != 0)
               return (int)Key.NumPadEnter;
            else
               return (int)Key.Enter;
      }
      return m.WParam.ToInt32();
the Fiddler's picture

Change:

switch (m.WParam.ToInt32())

to:

switch (m.WParam.ToInt64())

Fixed the same issue in OpenTK last night.

Edit:
The ImageFormatException occurs because FMOD is compiled for 32bits and the program is running in 64bit mode. Either distribute a 64bit FMOD binary (and choose the correct one at runtime or during install), or compile your .Net app for 32bits instead of AnyCPU (you'll lose some 64bit optimizations, but at least it will run).

BlueMonkMN's picture

This is the debug log from the system where AccessViolation exceptions are occurring:


DisplayDevice 0 (primary) supports 21 resolutions.
640x480x8@61Hz
640x480x16@61Hz
640x480x32@61Hz
720x480x8@61Hz
720x480x16@61Hz
720x480x32@61Hz
800x600x8@61Hz
800x600x16@61Hz
800x600x32@61Hz
848x480x8@61Hz
848x480x16@61Hz
848x480x32@61Hz
1024x768x8@61Hz
1024x768x16@61Hz
1024x768x32@61Hz
1280x768x8@61Hz
1280x768x16@61Hz
1280x768x32@61Hz
1280x800x8@61Hz
1280x800x16@61Hz
>> 1280x800x32@61Hz <<
Device context: 704713100
Selecting pixel format... Device context: 704713100
Selecting pixel format... Device context: 704713100
Selecting pixel format... Device context: 704713100
Selecting pixel format... Device context: 704713100
Selecting pixel format... Device context: 704713100
Selecting pixel format... Device context: 704713100
Selecting pixel format... Creating GraphicsContext.
GraphicsMode: Index: 2, Color: 32 (8888), Depth: 24, Stencil: False, Samples: 0, Accum: 0 (0000), Buffers: 2, Stereo: False
IWindowInfo: Windows.WindowInfo: Handle 1835978, Parent (null)
Loaded opengl32.dll: 1808859136
OpenGL will be bound to handle: 1835978
Setting pixel format...
2
Creating render context... done! (id: 65536)
Load extensions for OpenTK.Platform.Windows.Wgl... 47 extensions loaded in 25 ms.
Load extensions for OpenTK.Graphics.OpenGL.GL... 912 extensions loaded in 352 ms.
Load extensions for OpenTK.Graphics.OpenGL.Glu... 58 extensions loaded in 16 ms.
Extension "
2.0.6956 Release
gl_arb_depth_texture
gl_arb_draw_buffers
gl_arb_fragment_program
gl_arb_fragment_shader
gl_arb_multisample
gl_arb_multitexture
gl_arb_occlusion_query
gl_arb_point_parameters
gl_arb_point_sprite
gl_arb_shader_objects
gl_arb_shading_language_100
gl_arb_shadow
gl_arb_shadow_ambient
gl_arb_texture_border_clamp
gl_arb_texture_compression
gl_arb_texture_cube_map
gl_arb_texture_env_add
gl_arb_texture_env_combine
gl_arb_texture_env_crossbar
gl_arb_texture_env_dot3
gl_arb_texture_float
gl_arb_texture_mirrored_repeat
gl_arb_texture_rectangle
gl_arb_transpose_matrix
gl_arb_vertex_buffer_object
gl_arb_vertex_program
gl_arb_vertex_shader
gl_arb_window_pos
gl_ati_draw_buffers
gl_ati_envmap_bumpmap
gl_ati_fragment_shader
gl_ati_meminfo
gl_ati_separate_stencil
gl_ati_texture_env_combine3
gl_ati_texture_float
gl_ext_bgra
gl_ext_blend_color
gl_ext_blend_func_separate
gl_ext_blend_minmax
gl_ext_blend_subtract
gl_ext_compiled_vertex_array
gl_ext_copy_texture
gl_ext_draw_range_elements
gl_ext_fog_coord
gl_ext_framebuffer_object
gl_ext_gpu_program_parameters
gl_ext_multi_draw_arrays
gl_ext_packed_depth_stencil
gl_ext_packed_pixels
gl_ext_point_parameters
gl_ext_rescale_normal
gl_ext_secondary_color
gl_ext_separate_specular_color
gl_ext_shadow_funcs
gl_ext_stencil_wrap
gl_ext_subtexture
gl_ext_texgen_reflection
gl_ext_texture_compression_s3tc
gl_ext_texture_cube_map
gl_ext_texture_edge_clamp
gl_ext_texture_env_add
gl_ext_texture_env_combine
gl_ext_texture_env_dot3
gl_ext_texture_filter_anisotropic
gl_ext_texture_lod_bias
gl_ext_texture_mirror_clamp
gl_ext_texture_object
gl_ext_texture_rectangle
gl_ext_texture3d
gl_ext_vertex_array
gl_ktx_buffer_region
gl_nv_blend_square
gl_nv_texgen_reflection
gl_sgis_generate_mipmap
gl_sgis_texture_edge_clamp
gl_sgis_texture_lod
gl_version_1_1
gl_version_1_2
gl_version_1_3
gl_version_1_4
gl_version_1_5
gl_version_2_0
gl_win_swap_hint
wgl_ext_swap_control
Disposing context.

Apparently it's not merely a .NET Framework problem -- it looks like it's getting quite a ways before the error occurs. So what's different about the .NET samples and the Mono samples that could be causing an error only with OpenTK on .NET?

BlueMonkMN's picture

I've posted an updated version at http://sgdk2.enigmadream.com/support/TVSGDK2e.zip
I can't figure out why he's getting an AccessViolation exception, but I'd like to verify that the other problems are fixed if I can. And if anybody has any idea on why someone would be getting an AccessViolation exception on this and all the .NET samples delivered with OpenTK, I'm eager to hear it.

the Fiddler's picture
Selecting pixel format... Device context: 704713100
Selecting pixel format... Device context: 704713100
Selecting pixel format... Device context: 704713100
Selecting pixel format... Device context: 704713100
Selecting pixel format... Device context: 704713100
Selecting pixel format... Device context: 704713100

This doesn't look good, I'll have to investigate a bit.

The app you uploaded fails on an integrated intel 865 chip (no wonder!):

System.ApplicationException: Extension GL_ARB_texture_rectangle must be supported
   at Display.CheckRequirements()
   at Display.DrawFrame(TextureRef texture, Rectangle sourceRect, PointF[] corners, Int32 offsetX, Int32 offsetY)
   at LayerBase.Draw()
   at Menu_Map.Draw()
   at MapBase.DrawAllViews()
   at GameForm.Run()
   at Project.Main()

I'll test more when I get back home.

Mincus's picture

For what it's worth, I've tried all your uploads and not had any issue with them under Vista Ultimate 32-bit on a Geforce 8600M.

BlueMonkMN's picture

I've been told that the program actually does work on systems where GL_ARB_texture_rectangle is not supported, which is surprising to me because I am using ARB_texture_rectangle I think. But you could try taking that requirement out of the source code and see if it works. BTW, this is the error I can't get past on the system in question:

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at OpenTK.Graphics.OpenGL.GL.Imports.Begin(BeginMode mode)
at OpenTK.Graphics.OpenGL.GL.Begin(BeginMode mode)
at Display.DrawFrame(TextureRef texture, Rectangle sourceRect, PointF[] corners, Int32 offsetX, Int32 offsetY)
at LayerBase.Draw()
at Menu_Map.Draw()
at MapBase.DrawAllViews()
at GameForm.Run()
at Project.Main()

the Fiddler's picture

Update: it works fine on my dev PC (X1950Pro, 8.3 drivers), albeit it's running too fast to be playable.

So, the call to glBegin fails. I've seen that occur on two circumstances: invalid OpenGL context and outdated video drivers.

Could there be a problem in OpenTK that causes memory to be corrupted? Possibly, but a) it would have shown up before the call to Begin, and b) it should have shown up on other systems, too. It's interesting that all .Net examples fail on his system. Is he able to run any OpenGL applications at all? (for example the GLFW or NeHe examples)

Inertia's picture

The Exceptions mentioned in my last post still occur in TVSGDK2e.zip. Drawing still works fine.