Hi,

First I am using clutter 0.8.4 on win32 with an RADEON 9800 PRO.

I join to this mail a very basic sample (50 code lines) that compare :

- cogl_texture_new_from_foreign   and   CGL_TEXTURE_RECTANGLE_ARB
with
- cogl_texture_new_from_foreign   and   CGL_TEXTURE_2D

This is the output debug I get with CLUTTER_DEBUG=all:

As you see "cogl_texture_new_from_foreign" fails if I am using
CGL_TEXTURE_RECTANGLE_ARB.
Moreover I get same result on Ubuntu 9.04.

-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Clutter-Message: [BACKEND] clutter-stage.c:705: Creating stage from the
default backend
ClutterWin32-Message: [BACKEND] clutter-backend-win32.c:317: Creating stage
of type `ClutterStageWin32'
ClutterWin32-Message: [MISC] clutter-stage-win32.c:471: Realizing main stage
ClutterWin32-Message: [BACKEND] clutter-stage-win32.c:561: Marking stage as
realized
Clutter-Message: [MULTISTAGE] clutter-backend.c:206: Setting the new stage
[01BC5018]
ClutterWin32-Message: [MULTISTAGE] clutter-backend-win32.c:253: Setting
context for stage of type ClutterStageWin32 [01BC6088]
ClutterWin32-Message: [BACKEND] clutter-backend-win32.c:278: MakeCurrent
window 00400250 (native), context 00010000
ClutterWin32-Message: [EVENT] clutter-backend-win32.c:65: initialising the
event loop
Clutter-Message: [MISC] clutter-feature.c:84: checking features
Clutter-Message: [MISC] clutter-feature.c:88: allocating features data
ClutterWin32-Message: [BACKEND] clutter-backend-win32.c:187: Checking
features
GL_VENDOR: ATI Technologies Inc.
GL_RENDERER: RADEON 9800 PRO
GL_VERSION: 2.1.8543 Release
GL_EXTENSIONS: GL_AMD_performance_monitor GL_ARB_depth_texture
GL_ARB_draw_buffers GL_ARB_fragment_program GL_ARB_fragment_program_shadow
GL_ARB_fragment_shader GL_ARB_framebuffer_object GL_ARB_half_f
loat_pixel GL_ARB_half_float_vertex GL_ARB_map_buffer_range
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_
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_non_power_of_two GL_ARB_texture_rectangle
GL_ARB_transpose_matrix GL_ARB_
vertex_array_object 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_sepa
rate_stencil GL_ATI_texture_env_combine3 GL_ATI_texture_float 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_subt
ract GL_EXT_compiled_vertex_array GL_EXT_copy_texture
GL_EXT_draw_range_elements GL_EXT_fog_coord GL_EXT_framebuffer_blit
GL_EXT_framebuffer_multisample GL_EXT_framebuffer_object
GL_EXT_gpu_program_pa
rameters 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_fun
cs GL_EXT_stencil_wrap GL_EXT_subtexture GL_EXT_texgen_reflection
GL_EXT_texture3D GL_EXT_texture_compression_s3tc GL_EXT_texture_cube_map
GL_EXT_texture_edge_clamp GL_EXT_texture_env_add GL_EXT_textu
re_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_texture_sRGB GL_EXT_t
exture_swizzle 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_WIN_swap_hint WGL_EXT_swap_
control

ClutterWin32-Message: [BACKEND] clutter-backend-win32.c:219: vblank sync:
wglSwapIntervalEXT vblank setup success
Clutter-Message: [MISC] clutter-feature.c:103: features checked
clutter version: 0.8.4
has texture rectangle ? 1
valid cogl handle for CGL_TEXTURE_RECTANGLE_ARB ? 0
valid cogl handle for GL_TEXTURE_2D ? 1
-----------------------------------------------------------------------------------------------------------------------------------------------------------------


Could you explain why cogl handle is invalid when using
CGL_TEXTURE_RECTANGLE_ARB  ? Can someone test it on clutte 0.9.2 ?

(I looked at the clutter code but it was not 0.8.4, it was 0.9.2. I could
not figure out where clutter return COGL_INVALID_HANDLE in the
"cogl_texture_new_from_foreign" implementation.
I mean there is a lot of checks, I have checked too by myself, and every
thing seems to be just fine)


Sincerely

Julien
#include <GL/glew.h>
#include <GL/gl.h>
#include <clutter/clutter.h>

int
main (int argc, char *argv[])
{
  GLuint tex = 0;
	GLsizei w = 320;
	GLsizei h = 240;
	CoglHandle cogl_texture = 0;


	/* initialization */

  clutter_init (&argc, &argv);

  g_print ("clutter version: %s\n", CLUTTER_VERSION_S);
  g_print ("has texture rectangle ? %d\n", CGL_TEXTURE_RECTANGLE_ARB == GL_TEXTURE_RECTANGLE_ARB);


  /* from foreign and GL_TEXTURE_RECTANGLE_ARB */

  glGenTextures (1, &tex);
  glEnable (GL_TEXTURE_RECTANGLE_ARB);
  glBindTexture (GL_TEXTURE_RECTANGLE_ARB, tex);
  glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);

  cogl_texture = cogl_texture_new_from_foreign (tex,
      CGL_TEXTURE_RECTANGLE_ARB, w, h, 0, 0, COGL_PIXEL_FORMAT_RGBA_8888);

	g_print ("valid cogl handle for CGL_TEXTURE_RECTANGLE_ARB ? %d\n", cogl_texture != COGL_INVALID_HANDLE);

	cogl_texture_unref (cogl_texture);
	glDeleteTextures (1, &tex);


	/* from foreign and GL_TEXTURE_RECTANGLE_ARB */

  glGenTextures (1, &tex);
  glEnable (CGL_TEXTURE_2D);
  glBindTexture (GL_TEXTURE_2D, tex);
  glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);

  cogl_texture = cogl_texture_new_from_foreign (tex,
      GL_TEXTURE_2D, w, h, 0, 0, COGL_PIXEL_FORMAT_RGBA_8888);

	g_print ("valid cogl handle for GL_TEXTURE_2D ? %d\n", cogl_texture != COGL_INVALID_HANDLE);

	cogl_texture_unref (cogl_texture);
	glDeleteTextures (1, &tex);

  return 0;
}

Reply via email to