Hello Guest

Vertex array not initialized (New Problem, OpenGL)

  • 26 Replies
  • 13444 Views
Re: JVM Error (OpenGL)
« Reply #15 on: June 07, 2018, 19:30:15 »
Would I create the thread in the main class instead then?

*

Offline KaiHH

  • ****
  • 334
Re: JVM Error (OpenGL)
« Reply #16 on: June 07, 2018, 19:32:07 »
Would I create the thread in the main class instead then?
No, you would not create ANY thread manually. The thread has already been created by the operating system, which like I said three times now is executing your Java program just fine. It IS ALREADY a thread and you should not do anything like creating yet another useless thread.

Regarding the pastebin: You have A WHOLE LOT of OpenGL errors in your application. You MUST resolve those before continuing. Basically almost all of your calls generate OpenGL errors because you either feed them invalid arguments or they are being executed at a wrong time.

Re: JVM Error (OpenGL)
« Reply #17 on: June 07, 2018, 19:40:24 »
** removed by Spasi **
« Last Edit: June 07, 2018, 20:23:43 by spasi »

*

Offline spasi

  • *****
  • 2261
    • WebHotelier
Re: JVM Error (OpenGL)
« Reply #18 on: June 07, 2018, 20:22:57 »
User bananajoe banned for the above reply.

Re: Vertex array not initialized (New Problem, OpenGL)
« Reply #19 on: June 10, 2018, 18:20:49 »
So I managed to fix most of the errors by redoing the whole code but now I have a new issue:
Code: [Select]
[error][1] Vertex array [0] enabled but not initialized
  Stacktrace: Engine.Renderer.render(Renderer.java:37)
              Game.gameLoop.loop(gameLoop.java:63)
              Game.gameLoop.main(gameLoop.java:19)
How do you initialize a vertex array?

*

Offline KaiHH

  • ****
  • 334
Re: Vertex array not initialized (New Problem, OpenGL)
« Reply #20 on: June 10, 2018, 19:02:40 »
How do you initialize a vertex array?
By calling glVertexAttribPointer(...) (or one of its fixed-function pipeline equivalents) while having the VBO bound to GL_ARRAY_BUFFER via glBindBuffer(...).

EDIT: Also please re-download the LWJGLX/debug Addon from https://www.lwjgl.org/customize. There have been changes to improve the error logging.
« Last Edit: June 10, 2018, 19:09:11 by KaiHH »

Re: Vertex array not initialized (New Problem, OpenGL)
« Reply #21 on: June 10, 2018, 19:06:38 »
I do have the pointer, but I changed the GL_ARRAY_BUFFER to GL_ELEMENT_ARRAY_BUFFER because I'm using glDrawElements(), do I have to only use gl array buffer for initializing?

*

Offline KaiHH

  • ****
  • 334
Re: Vertex array not initialized (New Problem, OpenGL)
« Reply #22 on: June 10, 2018, 19:08:46 »
If you do indexed rendering with glDrawElements(), then you need both. You need the actual vertex data (which is stored in the vertex attributes that you enable via glEnableVertexArray() and initialize via glVertexAttribPointer()) and you need the element/index buffer, which you bind via glBindBuffer() and GL_ELEMENT_ARRAY_BUFFER.

Re: Vertex array not initialized (New Problem, OpenGL)
« Reply #23 on: June 10, 2018, 19:50:52 »
I'm a little confused on what you mean, here is the part that was in question:
Code: [Select]
GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, vboID);
GL15.glBufferData(GL15.GL_ELEMENT_ARRAY_BUFFER, flipByteBuffer(indice.indices), GL15.GL_DYNAMIC_DRAW);
GL20.glVertexAttribPointer(attributeNumber, 3, GL11.GL_FLOAT, false, 0, 0);
GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0);


*

Offline KaiHH

  • ****
  • 334
Re: Vertex array not initialized (New Problem, OpenGL)
« Reply #24 on: June 10, 2018, 20:02:10 »
The element/index array buffer, bound to GL_ELEMENT_ARRAY_BUFFER, is not a vertex attribute. You can only enable and initialize vertex attributes.
Before you continue, please go ahead and search for "OpenGL VBO" tutorials and examples and read them.

Re: Vertex array not initialized (New Problem, OpenGL)
« Reply #25 on: June 21, 2018, 21:09:29 »
Thanks for the suggestion, it managed to fix that problem, however I am still getting the 'not responding' problem. When running with the lwjgl debug, I don't get any errors except for a stack trace. Would you happen to know what it means/is it an error? Almost all of the opengl lwjgl tutorials are for lwjgl 2 or are outdated.
Code: [Select]
[LWJGL] Version: 3.1.6 build 14
[LWJGL] OS: Windows 7 v6.1
[LWJGL] JRE: 10.0.1 amd64
[LWJGL] JVM: Java HotSpot(TM) 64-Bit Server VM v10.0.1+10 by "Oracle Corporation"
[LWJGL] Loading library (system): lwjgl
[LWJGL] Using SharedLibraryLoader...
[LWJGL] Found at: C:\Users\johnson\AppData\Local\Temp\lwjgljohnson\3.1.6-build-14\lwjgl.dll
[LWJGL] Loaded from org.lwjgl.librarypath: C:\Users\johnson\AppData\Local\Temp\lwjgljohnson\3.1.6-build-14\lwjgl.dll
[LWJGL] MemoryUtil accessor: MemoryAccessorUnsafe
[LWJGL] MemoryUtil allocator: DebugAllocator
[LWJGL] Loading library: glfw
[LWJGL] Using SharedLibraryLoader...
[LWJGL] Found at: C:\Users\johnson\AppData\Local\Temp\lwjgljohnson\3.1.6-build-14\glfw.dll
[LWJGL] Loaded from org.lwjgl.librarypath: C:\Users\johnson\AppData\Local\Temp\lwjgljohnson\3.1.6-build-14\glfw.dll
[LWJGL] Loading library (system): lwjgl_opengl
[LWJGL] Using SharedLibraryLoader...
[LWJGL] Found at: C:\Users\johnson\AppData\Local\Temp\lwjgljohnson\3.1.6-build-14\lwjgl_opengl.dll
[LWJGL] Loaded from org.lwjgl.librarypath: C:\Users\johnson\AppData\Local\Temp\lwjgljohnson\3.1.6-build-14\lwjgl_opengl.dll
[LWJGL] Loading library: opengl32
[LWJGL] opengl32.dll not found in org.lwjgl.librarypath=C:\Users\johnson\AppData\Local\Temp\lwjgljohnson\3.1.6-build-14
[LWJGL] Loaded from system paths
[LWJGL] [GL] Using OpenGL 4.3 for error logging.
[info ][1] Initialized OpenGL context for window[1]
  Effective OpenGL version: 4.5
  OpenGL version string   : 4.6.0 NVIDIA 391.35
  OpenGL vendor           : NVIDIA Corporation
  OpenGL renderer         : GeForce GTX 1050 Ti/PCIe/SSE2
  GL_MAX_VERTEX_ATTRIBS   : 16
  Capabilities:
        1      GL_AMD_seamless_cubemap_per_texture GL_AMD_vertex_shader_layer
        2      GL_AMD_vertex_shader_viewport_index GL_ARB_arrays_of_arrays
        3      GL_ARB_base_instance GL_ARB_bindless_texture GL_ARB_blend_func_extended
        4      GL_ARB_buffer_storage GL_ARB_clear_buffer_object GL_ARB_clear_texture
        5      GL_ARB_clip_control GL_ARB_color_buffer_float GL_ARB_compatibility
        6      GL_ARB_compressed_texture_pixel_storage GL_ARB_compute_shader
        7      GL_ARB_compute_variable_group_size GL_ARB_conditional_render_inverted
        8      GL_ARB_conservative_depth GL_ARB_copy_buffer GL_ARB_copy_image
        9      GL_ARB_cull_distance GL_ARB_debug_output GL_ARB_depth_buffer_float
       10      GL_ARB_depth_clamp GL_ARB_depth_texture GL_ARB_derivative_control
       11      GL_ARB_direct_state_access GL_ARB_draw_buffers GL_ARB_draw_buffers_blend
       12      GL_ARB_draw_elements_base_vertex GL_ARB_draw_indirect GL_ARB_draw_instanced
       13      GL_ARB_enhanced_layouts GL_ARB_ES2_compatibility GL_ARB_ES3_1_compatibility
       14      GL_ARB_ES3_2_compatibility GL_ARB_ES3_compatibility
       15      GL_ARB_explicit_attrib_location GL_ARB_explicit_uniform_location
       16      GL_ARB_fragment_coord_conventions GL_ARB_fragment_layer_viewport
       17      GL_ARB_fragment_program GL_ARB_fragment_program_shadow GL_ARB_fragment_shader
       18      GL_ARB_fragment_shader_interlock GL_ARB_framebuffer_no_attachments
       19      GL_ARB_framebuffer_object GL_ARB_framebuffer_sRGB GL_ARB_geometry_shader4
       20      GL_ARB_get_program_binary GL_ARB_get_texture_sub_image GL_ARB_gl_spirv
       21      GL_ARB_gpu_shader5 GL_ARB_gpu_shader_fp64 GL_ARB_gpu_shader_int64
       22      GL_ARB_half_float_pixel GL_ARB_half_float_vertex GL_ARB_imaging
       23      GL_ARB_indirect_parameters GL_ARB_instanced_arrays GL_ARB_internalformat_query
       24      GL_ARB_internalformat_query2 GL_ARB_invalidate_subdata
       25      GL_ARB_map_buffer_alignment GL_ARB_map_buffer_range GL_ARB_multi_bind
       26      GL_ARB_multi_draw_indirect GL_ARB_multisample GL_ARB_multitexture
       27      GL_ARB_occlusion_query GL_ARB_occlusion_query2 GL_ARB_parallel_shader_compile
       28      GL_ARB_pipeline_statistics_query GL_ARB_pixel_buffer_object
       29      GL_ARB_point_parameters GL_ARB_point_sprite GL_ARB_polygon_offset_clamp
       30      GL_ARB_post_depth_coverage GL_ARB_program_interface_query
       31      GL_ARB_provoking_vertex GL_ARB_query_buffer_object
       32      GL_ARB_robust_buffer_access_behavior GL_ARB_robustness GL_ARB_sample_locations
       33      GL_ARB_sample_shading GL_ARB_sampler_objects GL_ARB_seamless_cube_map
       34      GL_ARB_seamless_cubemap_per_texture GL_ARB_separate_shader_objects
       35      GL_ARB_shader_atomic_counter_ops GL_ARB_shader_atomic_counters
       36      GL_ARB_shader_ballot GL_ARB_shader_bit_encoding GL_ARB_shader_clock
       37      GL_ARB_shader_draw_parameters GL_ARB_shader_group_vote
       38      GL_ARB_shader_image_load_store GL_ARB_shader_image_size GL_ARB_shader_objects
       39      GL_ARB_shader_precision GL_ARB_shader_storage_buffer_object
       40      GL_ARB_shader_subroutine GL_ARB_shader_texture_image_samples
       41      GL_ARB_shader_texture_lod GL_ARB_shader_viewport_layer_array
       42      GL_ARB_shading_language_100 GL_ARB_shading_language_420pack
       43      GL_ARB_shading_language_include GL_ARB_shading_language_packing GL_ARB_shadow
       44      GL_ARB_sparse_buffer GL_ARB_sparse_texture GL_ARB_sparse_texture2
       45      GL_ARB_sparse_texture_clamp GL_ARB_spirv_extensions GL_ARB_stencil_texturing
       46      GL_ARB_sync GL_ARB_tessellation_shader GL_ARB_texture_barrier
       47      GL_ARB_texture_border_clamp GL_ARB_texture_buffer_object
       48      GL_ARB_texture_buffer_object_rgb32 GL_ARB_texture_buffer_range
       49      GL_ARB_texture_compression GL_ARB_texture_compression_bptc
       50      GL_ARB_texture_compression_rgtc GL_ARB_texture_cube_map
       51      GL_ARB_texture_cube_map_array GL_ARB_texture_env_add GL_ARB_texture_env_combine
       52      GL_ARB_texture_env_crossbar GL_ARB_texture_env_dot3
       53      GL_ARB_texture_filter_anisotropic GL_ARB_texture_filter_minmax
       54      GL_ARB_texture_float GL_ARB_texture_gather GL_ARB_texture_mirror_clamp_to_edge
       55      GL_ARB_texture_mirrored_repeat GL_ARB_texture_multisample
       56      GL_ARB_texture_non_power_of_two GL_ARB_texture_query_levels
       57      GL_ARB_texture_query_lod GL_ARB_texture_rectangle GL_ARB_texture_rg
       58      GL_ARB_texture_rgb10_a2ui GL_ARB_texture_stencil8 GL_ARB_texture_storage
       59      GL_ARB_texture_storage_multisample GL_ARB_texture_swizzle GL_ARB_texture_view
       60      GL_ARB_timer_query GL_ARB_transform_feedback2 GL_ARB_transform_feedback3
       61      GL_ARB_transform_feedback_instanced GL_ARB_transform_feedback_overflow_query
       62      GL_ARB_transpose_matrix GL_ARB_uniform_buffer_object GL_ARB_vertex_array_bgra
       63      GL_ARB_vertex_array_object GL_ARB_vertex_attrib_64bit
       64      GL_ARB_vertex_attrib_binding GL_ARB_vertex_buffer_object GL_ARB_vertex_program
       65      GL_ARB_vertex_shader GL_ARB_vertex_type_10f_11f_11f_rev
       66      GL_ARB_vertex_type_2_10_10_10_rev GL_ARB_viewport_array GL_ARB_window_pos
       67      GL_EXT_abgr GL_EXT_bgra GL_EXT_bindable_uniform GL_EXT_blend_color
       68      GL_EXT_blend_equation_separate GL_EXT_blend_func_separate GL_EXT_blend_minmax
       69      GL_EXT_blend_subtract GL_EXT_compiled_vertex_array GL_EXT_depth_bounds_test
       70      GL_EXT_direct_state_access GL_EXT_draw_buffers2 GL_EXT_draw_instanced
       71      GL_EXT_framebuffer_blit GL_EXT_framebuffer_multisample
       72      GL_EXT_framebuffer_multisample_blit_scaled GL_EXT_framebuffer_object
       73      GL_EXT_framebuffer_sRGB GL_EXT_geometry_shader4 GL_EXT_gpu_program_parameters
       74      GL_EXT_gpu_shader4 GL_EXT_memory_object GL_EXT_memory_object_win32
       75      GL_EXT_packed_depth_stencil GL_EXT_packed_float GL_EXT_pixel_buffer_object
       76      GL_EXT_point_parameters GL_EXT_polygon_offset_clamp GL_EXT_post_depth_coverage
       77      GL_EXT_provoking_vertex GL_EXT_raster_multisample GL_EXT_secondary_color
       78      GL_EXT_semaphore GL_EXT_semaphore_win32 GL_EXT_separate_shader_objects
       79      GL_EXT_shader_image_load_formatted GL_EXT_shader_image_load_store
       80      GL_EXT_shader_integer_mix GL_EXT_shadow_funcs GL_EXT_sparse_texture2
       81      GL_EXT_stencil_two_side GL_EXT_stencil_wrap GL_EXT_texture_array
       82      GL_EXT_texture_buffer_object GL_EXT_texture_compression_latc
       83      GL_EXT_texture_compression_rgtc GL_EXT_texture_compression_s3tc
       84      GL_EXT_texture_filter_anisotropic GL_EXT_texture_filter_minmax
       85      GL_EXT_texture_integer GL_EXT_texture_mirror_clamp
       86      GL_EXT_texture_shared_exponent GL_EXT_texture_sRGB GL_EXT_texture_sRGB_decode
       87      GL_EXT_texture_swizzle GL_EXT_timer_query GL_EXT_vertex_array_bgra
       88      GL_EXT_vertex_attrib_64bit GL_EXT_win32_keyed_mutex GL_EXT_window_rectangles
       89      GL_KHR_blend_equation_advanced GL_KHR_blend_equation_advanced_coherent
       90      GL_KHR_context_flush_control GL_KHR_debug GL_KHR_no_error
       91      GL_KHR_parallel_shader_compile GL_KHR_robust_buffer_access_behavior
       92      GL_KHR_robustness GL_NV_alpha_to_coverage_dither_control
       93      GL_NV_bindless_multi_draw_indirect GL_NV_bindless_multi_draw_indirect_count
       94      GL_NV_bindless_texture GL_NV_blend_equation_advanced
       95      GL_NV_blend_equation_advanced_coherent GL_NV_blend_minmax_factor
       96      GL_NV_blend_square GL_NV_clip_space_w_scaling GL_NV_command_list
       97      GL_NV_conditional_render GL_NV_conservative_raster
       98      GL_NV_conservative_raster_dilate GL_NV_conservative_raster_pre_snap_triangles
       99      GL_NV_copy_depth_to_color GL_NV_copy_image GL_NV_depth_buffer_float
      100      GL_NV_depth_clamp GL_NV_draw_texture GL_NV_draw_vulkan_image
      101      GL_NV_ES3_1_compatibility GL_NV_explicit_multisample GL_NV_fence
      102      GL_NV_fill_rectangle GL_NV_float_buffer GL_NV_fog_distance
      103      GL_NV_fragment_coverage_to_color GL_NV_fragment_program_option
      104      GL_NV_fragment_shader_interlock GL_NV_framebuffer_mixed_samples
      105      GL_NV_framebuffer_multisample_coverage GL_NV_geometry_shader4
      106      GL_NV_geometry_shader_passthrough GL_NV_gpu_shader5 GL_NV_half_float
      107      GL_NV_internalformat_sample_query GL_NV_light_max_exponent
      108      GL_NV_multisample_coverage GL_NV_multisample_filter_hint
      109      GL_NV_packed_depth_stencil GL_NV_path_rendering
      110      GL_NV_path_rendering_shared_edge GL_NV_pixel_data_range GL_NV_point_sprite
      111      GL_NV_primitive_restart GL_NV_query_resource GL_NV_query_resource_tag
      112      GL_NV_sample_locations GL_NV_sample_mask_override_coverage
      113      GL_NV_shader_atomic_float GL_NV_shader_atomic_float64
      114      GL_NV_shader_atomic_fp16_vector GL_NV_shader_atomic_int64
      115      GL_NV_shader_buffer_load GL_NV_shader_thread_group GL_NV_shader_thread_shuffle
      116      GL_NV_stereo_view_rendering GL_NV_texgen_reflection GL_NV_texture_barrier
      117      GL_NV_texture_compression_vtc GL_NV_texture_multisample
      118      GL_NV_texture_rectangle_compressed GL_NV_transform_feedback
      119      GL_NV_transform_feedback2 GL_NV_uniform_buffer_unified_memory
      120      GL_NV_vertex_array_range GL_NV_vertex_array_range2
      121      GL_NV_vertex_attrib_integer_64bit GL_NV_vertex_buffer_unified_memory
      122      GL_NV_viewport_array2 GL_NV_viewport_swizzle
      123      GL_NVX_blend_equation_advanced_multi_draw_buffers GL_NVX_conditional_render
      124      GL_NVX_gpu_memory_info
[info ][1] OpenGL debug message
  ID: 0x20071
  Source: API
  Type: OTHER
  Severity: NOTIFICATION
  Message: Buffer detailed info: Buffer object 1 (bound to GL_ARRAY_BUFFER_ARB, usage hint is GL_STATIC_DRAW) will use VIDEO memory as the source for buffer object operations.
  Stacktrace: Engine.Load.storeDataInAttributeList(Load.java:65)
              Engine.Load.loadToVAO(Load.java:35)
              Game.gameLoop.loop(gameLoop.java:50)
              Game.gameLoop.main(gameLoop.java:19)


*

Offline KaiHH

  • ****
  • 334
Re: Vertex array not initialized (New Problem, OpenGL)
« Reply #26 on: June 22, 2018, 07:54:14 »
This:
Code: [Select]
[info ][1] OpenGL debug message
  ID: 0x20071
  Source: API
  Type: OTHER
  Severity: NOTIFICATION
  Message: Buffer detailed info: Buffer object 1 (bound to GL_ARRAY_BUFFER_ARB, usage hint is GL_STATIC_DRAW) will use VIDEO memory as the source for buffer object operations.
  Stacktrace: Engine.Load.storeDataInAttributeList(Load.java:65)
              Engine.Load.loadToVAO(Load.java:35)
              Game.gameLoop.loop(gameLoop.java:50)
              Game.gameLoop.main(gameLoop.java:19)
Is just a notification from the graphics driver about the residency of the buffer object (in video memory). It is not an error or a warning.

Regarding the "not responding" behaviour: Are you sure that you are calling glfwPollEvents() in a loop continuously? This method needs to be called in order for your application/process to handle window events that the operating system sends to your application. When your application does not poll those events and react accordingly by calling glfwPollEvents() then the operating system assumes the process has frozen up and will show that to the user by overlaying the processe's window.