Ken,
Thanks a million for your patient and clear answer - the result: it works! And it shows Swing elements on top of the video. This is truly awesome. Thank you very much.
Now a couple of followup things in case you don’t mind answering…
- With both 1.5.0_05 and 1.6, the following occurs:
1.1. If i put, at the start of my program
System.setProperty(“sun.java2d.opengl”, “True”);
it has zero effect. do you know why it doesn’t work unless in the command line?
1.2. If i put that same line in the command line, the effect is: blank (black) screen. As in, my program shows its UI (no exceptions thrown), but the openGL window is just black and shows nothing. When i remove the -Dsun.java2d.opengl switch, everything shows up fine.
This seems to affect not only the openGL window however… If I click a button that is supposed to bring up a popup menu (with some text in it), the CPU goes to 100%. Are the two things related? Obviously, if I don’t have the opengl switch active, the popup menus display just fine.
1.3. I tried putting
-Dsun.java2d.opengl=True -Djogl.debug.Java2D -Djogl.debug.GLJPanel
in the command line, to see what the problem is (as well as a few other debugging statements). I get:
OpenGL pipeline enabled for config on screen 0
display change supported = false
full screen supported = true
accelerated memory = -1
mainWindow’s buffer strategy: null
New Acceleration Threshold: 0
JOGL version jsr231-1.0-beta1-b01
Checking for Java2D/OpenGL support
Java2D support: default GraphicsConfiguration = sun.java2d.opengl.WGLGraphicsConfig
JOGL/Java2D integration enabled
GLJPanel.addNotify()
GLJPanel.handleReshape: (w,h) = (256,256)
Sending reshape because viewport changed
viewportX (0) ?= oglViewport.x (2)
viewportY (0) ?= oglViewport.y (438)
OpenGL Renderer: GeForce Go 6600/PCI/SSE2
OpenGL Vendor: NVIDIA Corporation
OpenGL Version: 2.0.1
Supported OpenGL Extensions: GL_ARB_color_buffer_float GL_ARB_depth_texture GL_ARB_draw_buffers GL_ARB_fragment_program GL_ARB_fragment_program_shadow GL_ARB_fragment_shader GL_ARB_half_float_pixel GL_ARB_imaging GL_ARB_multisample GL_ARB_multitexture GL_ARB_occlusion_query GL_ARB_pixel_buffer_object GL_ARB_point_parameters GL_ARB_point_sprite GL_ARB_shadow GL_ARB_shader_objects GL_ARB_shading_language_100 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_dot3 GL_ARB_texture_float GL_ARB_texture_mirrored_repeat GL_ARB_texture_non_power_of_two 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_texture_float GL_ATI_texture_mirror_once GL_S3_s3tc GL_EXT_texture_env_add GL_EXT_abgr GL_EXT_bgra GL_EXT_blend_color GL_EXT_blend_equation_separate GL_EXT_blend_func_separate GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_compiled_vertex_array GL_EXT_Cg_shader GL_EXT_depth_bounds_test GL_EXT_draw_range_elements GL_EXT_fog_coord GL_EXT_framebuffer_object GL_EXT_multi_draw_arrays GL_EXT_packed_depth_stencil GL_EXT_packed_pixels GL_EXT_pixel_buffer_object GL_EXT_point_parameters GL_EXT_rescale_normal GL_EXT_secondary_color GL_EXT_separate_specular_color GL_EXT_shadow_funcs GL_EXT_stencil_two_side GL_EXT_stencil_wrap GL_EXT_texture3D GL_EXT_texture_compression_s3tc GL_EXT_texture_cube_map GL_EXT_texture_edge_clamp GL_EXT_texture_env_combine GL_EXT_texture_env_dot3 GL_EXT_texture_filter_anisotropic GL_EXT_texture_lod GL_EXT_texture_lod_bias GL_EXT_texture_mirror_clamp GL_EXT_texture_object GL_EXT_texture_sRGB GL_EXT_timer_query GL_EXT_vertex_array GL_HP_occlusion_test GL_IBM_rasterpos_clip GL_IBM_texture_mirrored_repeat GL_KTX_buffer_region GL_NV_blend_square GL_NV_copy_depth_to_color GL_NV_depth_clamp GL_NV_fence GL_NV_float_buffer GL_NV_fog_distance GL_NV_fragment_program GL_NV_fragment_program_option GL_NV_fragment_program2 GL_NV_half_float GL_NV_light_max_exponent GL_NV_multisample_filter_hint GL_NV_occlusion_query GL_NV_packed_depth_stencil GL_NV_pixel_data_range GL_NV_point_sprite GL_NV_primitive_restart GL_NV_register_combiners GL_NV_register_combiners2 GL_NV_texgen_reflection GL_NV_texture_compression_vtc GL_NV_texture_env_combine4 GL_NV_texture_expand_normal GL_NV_texture_rectangle GL_NV_texture_shader GL_NV_texture_shader2 GL_NV_texture_shader3 GL_NV_vertex_array_range GL_NV_vertex_array_range2 GL_NV_vertex_program GL_NV_vertex_program1_1 GL_NV_vertex_program2 GL_NV_vertex_program2_option GL_NV_vertex_program3 GL_NVX_conditional_render GL_SGIS_generate_mipmap GL_SGIS_texture_lod GL_SGIX_depth_texture GL_SGIX_shadow GL_SUN_slice_accum GL_WIN_swap_hint WGL_EXT_swap_control
glViewport(2, 438, 256, 256)
Does this tell you anything helpful? By the way, I updated my NVidia drivers to the very latest just now. Should I change some of the settings? They are now at the defaults…
-
When i drag the window, it drags very slow as GLJPanel, both on jdk1.5 and jdk1.6 - is it because I’m not using the openGL switch (the one from question #1)?
-
If i resize the size of the GLJPanel, it flashes to white (and then draws properly) for every resize. This happens with both JDK 5 and 6.
-
I know this is unrelated to JSR development, but you said my deleteTexture code was wrong… I suspected as much. But my problem is, I’m not really sure what the best strategy is for what i’m trying to do. What I’m trying to do is to receive frames from QuickTime video, manipulate each frame (twist / turn / etc) and display it. So, each texture for me is just a frame of video that is only displayed once (i.e., i’m not building, say, a game where you’d reuse the same texture over and over), and i need to display them quickly. Given that problem, what would you advice to be the most computationally-efficient strategy? Now for each frame I do:
gl.glBindTexture(GL.GL_TEXTURE_2D, tex.getTextureID());
gl.glPushMatrix();
gl.glColor4f(…) //or some other manipulation
gl.glBegin(GL.GL_QUADS);
gl.glTexCoord2f(tex2DQuad[0], tex2DQuad[1]);
gl.glVertex3f(tex3DQuad[0], tex3DQuad[1], 0.0f);
gl.glTexCoord2f(tex2DQuad[2], tex2DQuad[3]);
gl.glVertex3f(tex3DQuad[2], tex3DQuad[3], 0.0f);
gl.glTexCoord2f(tex2DQuad[4], tex2DQuad[5]);
gl.glVertex3f(tex3DQuad[4], tex3DQuad[5], 0.0f);
gl.glTexCoord2f(tex2DQuad[6], tex2DQuad[7]);
gl.glVertex3f(tex3DQuad[6], tex3DQuad[7], 0.0f);
gl.glEnd();
gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST);
gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST);
gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_REPEAT);
gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_REPEAT);
gl.glTexImage2D(GL.GL_TEXTURE_2D,0, 4, texWidth, texHeight, 0, srcPixelFormat, GL.GL_UNSIGNED_BYTE, currByteBuffer);
currByteBuffer.rewind();
//currByteBuffer is a ByteBuffer into which, at each frame I put the new QuickTime frame…
gl.glPopMatrix();
Now, in here I just reuse the same texture (i think??). Is it better if I delete and generate texture each time? Is there some automatic way to purge textures that are not being used?
Thanks a lot!
-LJ