OpenTKstart's picture

OpenGL Picking Example Troubles

Hi,

i have troubles with my openGL on my Laptop. In the OpenTK Sample Browser -> OpenGL->Picking , i see this:

I dont know what openGL-version i have and i dont know how to check it.

Anyone got some idea?

thx


Comments

Comment viewing options

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

The example is a bit of a hack, there are 2 clearscreens per frame and 2 passes are drawn: one with triangle id numbers (that pass is which GL.ReadPixels() actually uses to "pick" the triangle from) and a second pass which visualizes the object and highlights the selected triangle (or if none, changes background color)

My guess is, that for some reason your graphics card does not like the second clearscreen, or some GL error occurs at the readpixels operation which causes the rest of the frame to fail rendering. I assume the other examples run fine?

You can find out what OpenGL driver is running using GL.GetString with Vendor/Renderer/Version tokens.

OpenTKstart's picture

After i close the Example i get the Error (Error at Swapbuffers: InvalidEnum) shown in the Example Browser.

Here are my Properties:

GL_VERSION: 3.0.0 - Build 8.15.10.2353
GL_EXTENSION: GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_blend_color GL_EXT_abgr GL_EXT_texture3D GL_EXT_clip_volume_hint GL_EXT_compiled_vertex_array GL_SGIS_texture_edge_clamp GL_SGIS_generate_mipmap GL_EXT_draw_range_elements GL_SGIS_texture_lod GL_EXT_rescale_normal GL_EXT_packed_pixels GL_EXT_texture_edge_clamp GL_EXT_separate_specular_color GL_ARB_multitexture GL_EXT_texture_env_combine GL_EXT_bgra GL_EXT_blend_func_separate GL_EXT_secondary_color GL_EXT_fog_coord GL_EXT_texture_env_add GL_ARB_texture_cube_map GL_ARB_transpose_matrix GL_ARB_texture_env_add GL_IBM_texture_mirrored_repeat GL_EXT_multi_draw_arrays GL_NV_blend_square GL_ARB_texture_compression GL_3DFX_texture_compression_FXT1 GL_EXT_texture_filter_anisotropic GL_ARB_texture_border_clamp GL_ARB_point_parameters GL_ARB_texture_env_combine GL_ARB_texture_env_dot3 GL_ARB_texture_env_crossbar GL_EXT_texture_compression_s3tc GL_ARB_shadow GL_ARB_window_pos GL_EXT_shadow_funcs GL_EXT_stencil_wrap GL_ARB_vertex_program GL_EXT_texture_rectangle GL_ARB_fragment_program GL_EXT_stencil_two_side GL_ATI_separate_stencil GL_ARB_vertex_buffer_object GL_EXT_texture_lod_bias GL_ARB_occlusion_query GL_ARB_fragment_shader GL_ARB_shader_objects GL_ARB_shading_language_100 GL_ARB_texture_non_power_of_two GL_ARB_vertex_shader GL_NV_texgen_reflection GL_ARB_point_sprite GL_EXT_blend_equation_separate GL_ARB_depth_texture GL_ARB_texture_rectangle GL_ARB_draw_buffers GL_ARB_color_buffer_float GL_ARB_half_float_pixel GL_ARB_texture_float GL_ARB_pixel_buffer_object GL_EXT_framebuffer_object GL_ARB_draw_instanced GL_ARB_half_float_vertex GL_EXT_draw_buffers2 GL_WIN_swap_hint GL_EXT_texture_sRGB GL_ARB_multisample GL_EXT_packed_float GL_EXT_texture_shared_exponent GL_ARB_texture_rg GL_ARB_texture_compression_rgtc GL_NV_conditional_render GL_EXT_texture_swizzle GL_ARB_framebuffer_sRGB GL_EXT_packed_depth_stencil GL_ARB_depth_buffer_float GL_EXT_transform_feedback GL_EXT_framebuffer_blit GL_EXT_framebuffer_multisample GL_ARB_framebuffer_object GL_EXT_texture_array GL_EXT_texture_integer GL_ARB_map_buffer_range GL_EXT_texture_snorm GL_INTEL_performance_queries GL_ARB_vertex_array_object
GL_VENDOR: Intel
GL_RENDERER: Intel(R) HD Graphics Family
GL_ShadingLanguageVersion: 1.30 - Intel Build 8.15.10.2353
Inertia's picture

Invalid Enum usually translates to "you used some extension that isn't supported by the driver", but the example was meant to be as simple as possible and isn't even using FBO or shaders. A quick look at the source code makes me put my bet on GL.PolygonMode() that draws the triangle's outlines for a better view, but that is actually a GL 1.1 feature. I'm afraid I'm of no help here, cannot debug a problem that I cannot replicate...

...maybe you can use OpenGL's own Feedback mechanism to achieve your goal. It's not hardware accelerated but should do the job http://www.glprogramming.com/red/chapter13.html

(Another approach is to do raycasting with a physics library, but that is likely overkill)

OpenTKstart's picture
Inertia wrote:

but the example was meant to be as simple as possible and isn't even using FBO or shaders.

That´s a interesting point you have marked! My laptop should support till OpenGL 3.0:
http://www.intel.com/support/graphics/intelhdgraphics3000_2000/sb/CS-032...

If i can prove, that this example dont use methods which exceeds OpenGL 3.0, so i can complain a hardware problem at HP.

mOfl's picture
Quote:

GL_VENDOR: Intel
GL_RENDERER: Intel(R) HD Graphics Family

nailing your ongoing problem down to a hardware problem would be quite interesting however i do not think you can complain for incompatibilities. although the vendors should satisfy the OpenGL specifications, Intel video cards have always been known for having flaws regarding the support of graphic features. are your video drivers up to date? it's always worth a shot to update the drivers.

OpenTKstart's picture

yes, but the specification of the graphic card says that i can use it till OpenGL3.0. I just bought the Laptop for this fact, and so it´s more than a reason to complain it. I dont care that Intel had always problems with graphic features, thats their problem, not mine.
I updated all drivers and bios, yesterday. No effect.

Inertia's picture

Applications need to operate without causing any OpenGL errors, in order to draw correct images. It is possible that neither your Laptop nor the drivers are broken, but that some conditions, which the picking hack relies upon, simply do not work because the framebuffer config requested by the demo is not available or god knows what else. Remember it is a hack exploiting certain conditions - not standard operation.

GL commands cannot be validated at compile time and at runtime it depends on the hardware, driver & context which functions, tokens and extensions are valid to use (assuming no bugs). If commercial games like Quake or the other OpenTK examples run fine (especially if any GLSL examples run at all) you can safely assume that your laptop is ok.

The picking example is generating at very least 1 InvalidEnum error when rendering through your driver, but without even knowing what context was created or direct observation where the error occurs, it's a futile attempt for me to debug it. If you want to find the culprit on your own, you can pinpoint the exact location of the error with a debug build of opentk.dll or by manually checking for errors after each GL call until you find the origin.

Sidenote: If your application's minimum specs are supposed to be "intel laptops" you will have to keep it and work around all problems and issues with it, because if you switch to some AMD/Nvidia renderer this won't change the fact that your users are still using intel laptops ;-)

rathan001's picture

My Error details is also same as this. Trace informations are listed below. Hope it is a graphic issue

A first chance exception of type 'System.DllNotFoundException' occurred in OpenTK.dll
A first chance exception of type 'System.TypeInitializationException' occurred in OpenTK.dll
A first chance exception of type 'System.DllNotFoundException' occurred in OpenTK.dll
Detected configuration: Windows / .Net
DisplayDevice 1 (primary) supports 57 resolutions.
DisplayDevice 2 (secondary) supports 132 resolutions.
Creating default GraphicsMode (32, 16, 0, 0, 0, 2, False).
Creating GraphicsContext.
Creating GraphicsContext.
Device context: 973150895
Selecting pixel format... GraphicsMode: Index: 2, Color: 32 (8888), Depth: 0, Stencil: 0, Samples: 0, Accum: 64 (16161616), Buffers: 2, Stereo: False
IWindowInfo: Windows.WindowInfo: Handle 657110, Parent (Windows.WindowInfo: Handle 3343638, Parent (null))
GraphicsContextFlags: Default
Requested version: 1.0
Loaded opengl32.dll: 1488519168
OpenGL will be bound to handle: 657110
Setting pixel format... 2
Creating temporary context for wgl extensions.
Load extensions for OpenTK.Platform.Windows.Wgl... 44 extensions loaded in 10 ms.
Load extensions for OpenTK.Platform.Windows.Wgl... 44 extensions loaded in 0 ms.
Falling back to GL2... success! (id: 131072)
Selecting pixel format (ARB)... failed (no suitable pixel format).
Disposing context 131072.
Destroying window: Windows.WindowInfo: Handle 3343638, Parent (null)
Device context: 419500557
Selecting pixel format... GraphicsMode: Index: 4, Color: 32 (8888), Depth: 16, Stencil: 0, Samples: 0, Accum: 64 (16161616), Buffers: 2, Stereo: False
IWindowInfo: Windows.WindowInfo: Handle 1968336, Parent (Windows.WindowInfo: Handle 2820272, Parent (null))
GraphicsContextFlags: Default
Requested version: 1.1
OpenGL will be bound to handle: 1968336
Setting pixel format... 4
Falling back to GL2... success! (id: 196608)
Load extensions for OpenTK.Platform.Windows.Wgl... 44 extensions loaded in 0 ms.
Loading extensions for OpenTK.Graphics.OpenGL.GL... 1900 extensions loaded in 222.3988 ms.
Entering main loop.
A first chance exception of type 'OpenTK.Graphics.GraphicsErrorException' occurred in OpenTK.dll
Disposing context 196608.
Destroying window: Windows.WindowInfo: Handle 2820272, Parent (null)
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> OpenTK.Graphics.GraphicsErrorException: InvalidEnum
at OpenTK.Graphics.OpenGL.ErrorHelper.CheckErrors() in C:\OpenTK\1.0\Source\OpenTK\Graphics\OpenGL\ErrorHelper.cs:line 118
at OpenTK.Graphics.OpenGL.ErrorHelper.Dispose() in C:\OpenTK\1.0\Source\OpenTK\Graphics\OpenGL\ErrorHelper.cs:line 129
at OpenTK.Graphics.OpenGL.GL.Enable(EnableCap cap) in C:\OpenTK\1.0\Source\OpenTK\Graphics\OpenGL\GL.cs:line 38768
at Examples.Tutorial.Picking.OnRenderFrame(FrameEventArgs e) in C:\OpenTK\1.0\Source\Examples\OpenGL\1.x\Picking.cs:line 234
at OpenTK.GameWindow.OnRenderFrameInternal(FrameEventArgs e) in C:\OpenTK\1.0\Source\OpenTK\GameWindow.cs:line 1032
at OpenTK.GameWindow.RaiseRenderFrame(Stopwatch render_watch, Double& next_render, FrameEventArgs render_args) in C:\OpenTK\1.0\Source\OpenTK\GameWindow.cs:line 527
at OpenTK.GameWindow.DispatchUpdateAndRenderFrame(Object sender, EventArgs e) in C:\OpenTK\1.0\Source\OpenTK\GameWindow.cs:line 433
at OpenTK.GameWindow.Run(Double updates_per_second, Double frames_per_second) in C:\OpenTK\1.0\Source\OpenTK\GameWindow.cs:line 411
at OpenTK.GameWindow.Run(Double updateRate) in C:\OpenTK\1.0\Source\OpenTK\GameWindow.cs:line 358
at Examples.Tutorial.Picking.Main() in C:\OpenTK\1.0\Source\Examples\OpenGL\1.x\Picking.cs:line 307
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
The thread '' (0x64c) has exited with code 0 (0x0).
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at Examples.ExampleBrowser.<>c__DisplayClass2.b__0() in C:\OpenTK\1.0\Source\Examples\ExampleBrowser.cs:line 378