Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: RenderImage not displaying anything  (Read 2884 times)

0 Members and 1 Guest are viewing this topic.

Kalith

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
RenderImage not displaying anything
« on: June 04, 2011, 05:37:01 pm »
Hi,

I've been using SFML for some time on my Windows computer, and everything worked perfectly. Now, I'm testing my code on Ubuntu 10.10 with my laptop, and that's a whole other story.

I have an integrated Intel graphics chip, that I know is always crappy, but I don't really have much choice here. I'm using the latest (may 31) svn snapshot, and compile with G++ 4.4.5.

Anyway, SFML seems to be working fine as far as I can tell, except when I try to use RenderImages.
For example, the code provided in this thread shows nothing but a black window (as in this thread).
I know that my graphics card can handle render targets, as I can run Ogre and its RenderTargets correctly.
When I close the program, I get the following messages in the console :
Quote
DRM_IOCTL_GEM_CLOSE 6 failed (region): Bad file descriptor
DRM_IOCTL_GEM_CLOSE 5 failed (region): Bad file descriptor


I've read that you are doing some changes to the RenderImage class. Can I expect this behavior to be fixed somehow ?

If you need any additional detail that can help you figure out the issue, please let me know.
Kal.

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
RenderImage not displaying anything
« Reply #1 on: June 04, 2011, 05:42:09 pm »
Erhm SVN snapshot? SFML moved to Github long time ago, sure you got the latest version? :P
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Kalith

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
RenderImage not displaying anything
« Reply #2 on: June 04, 2011, 05:48:09 pm »
Quote from: "Groogy"
Erhm SVN snapshot? SFML moved to Github long time ago, sure you got the latest version? :P

Yeah, SVN, Git, whatever :) Actually, I wrote that my version is dated may 31, so it is indeed the latest one.
Kal.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
RenderImage not displaying anything
« Reply #3 on: June 04, 2011, 08:41:13 pm »
Are you having the same problems as people in the threads you're referring to? Or does even the simplest code involving render images fail?

Can you be more specific about your problem please?
Laurent Gomila - SFML developer

Kalith

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
RenderImage not displaying anything
« Reply #4 on: June 05, 2011, 01:52:30 am »
Actually, I can't get anything to render on a RenderImage (or I can't get the RenderImage to be drawn on the screen, can't say).
Would it be a Clear() color or a sprite, the RenderImage remains empty.

The simplest example I can think of :
Code: [Select]
#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(800,600), "SFML window");

    sf::RenderImage renderImage;
    if (!renderImage.Create(256, 256))
        return -1;

    sf::Sprite sprite(renderImage.GetImage());

    while (window.IsOpened())
    {
        sf::Event Event;
        while (window.PollEvent(Event))
        {
            if ((Event.Type == sf::Event::Closed) ||
                ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape)))
                window.Close();
        }

        renderImage.Clear(sf::Color::Red);

        renderImage.Display();

        window.Clear();

        window.Draw(sprite);

        window.Display();
    }

    return 0;
}


... should, correct me if I'm wrong, display a 256x256 red square at the top left corner of the window, with a black background.
On my laptop, it only renders the black background.

Though, I experience some very strange artifacts... For example while testing this code sample, the console window from which the code was executed suddenly had red borders around it.
Next time I ran it, it was the RenderWindow which got partially red... but on its "title", not in the render area.
I ran it another time, then saw nothing but the black background again.

To be sure, I disactivated completely the window effects of Ubuntu, but that didn't change a thing.

I hope I've been clearer than in my previous post.
Kal.

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
RenderImage not displaying anything
« Reply #5 on: June 05, 2011, 02:19:11 am »
Hmmm.... I didn't test my Ruby bindings for sf::RenderImage as I just assumed they worked as a lot of code was adapted from the RenderTarget module. But I did get a lot of GEM error messages on my test laptop which also had an intel integrated card. That card's drivers were so bad that they even freaked out Ruby's garbage collector. If I wrote code exactly in one way I could get intended behaviour, add a "print" somewhere and everything crashed by giving me already free'd memory... Moving the same code to another computer solved it all ^^

I think you'll have a tough one here Laurent to fix :P

Just tried your code on my machine, works like a charm. Asus Laptop with Nvidia Graphics CARD
Never going back to integrated graphics piece of... hypocrisy.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Kalith

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
RenderImage not displaying anything
« Reply #6 on: June 05, 2011, 11:57:57 am »
Quote from: "Groogy"
Just tried your code on my machine, works like a charm. Asus Laptop with Nvidia Graphics CARD


That's what I'd expect. I don't think this is an error in SFML, because everything works fine when I use a real graphics card. But somehow there must be a hack to get Intel chips to work correctly, because Ogre (1.6.4) with its OpenGL renderer works perfectly here.

Here is is content of the Ogre log file, there is plenty of information about my graphics card here, maybe it'll be of some use :

Code: [Select]
18:51:03: GL_VERSION = 2.1 Mesa 7.9-devel
18:51:03: GL_VENDOR = Tungsten Graphics, Inc
18:51:03: GL_RENDERER = Mesa DRI Intel(R) Ironlake Mobile GEM 20100330 DEVELOPMENT x86/MMX/SSE2
18:51:03: GL_EXTENSIONS = GL_ARB_copy_buffer GL_ARB_depth_clamp GL_ARB_depth_texture GL_ARB_draw_buffers GL_ARB_draw_elements_base_vertex GL_ARB_fragment_coord_conventions GL_ARB_fragment_program GL_ARB_fragment_program_shadow GL_ARB_fragment_shader GL_ARB_framebuffer_object GL_ARB_half_float_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_provoking_vertex GL_ARB_seamless_cube_map GL_ARB_shader_objects GL_ARB_shading_language_100 GL_ARB_shadow GL_ARB_sync 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_mirrored_repeat GL_ARB_texture_non_power_of_two GL_ARB_texture_rectangle GL_ARB_texture_swizzle GL_ARB_transpose_matrix GL_ARB_vertex_array_bgra GL_ARB_vertex_array_object GL_ARB_vertex_buffer_object GL_ARB_vertex_program GL_ARB_vertex_shader GL_ARB_window_pos GL_EXT_abgr GL_EXT_bgra GL_EXT_blend_color GL_EXT_blend_equation_separate GL_EXT_blend_func_separate GL_EXT_blend_logic_op GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_cull_vertex GL_EXT_compiled_vertex_array GL_EXT_copy_texture GL_EXT_draw_buffers2 GL_EXT_draw_range_elements GL_EXT_framebuffer_blit GL_EXT_framebuffer_multisample GL_EXT_framebuffer_object GL_EXT_fog_coord GL_EXT_gpu_program_parameters 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_polygon_offset GL_EXT_provoking_vertex 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_subtexture GL_EXT_texture GL_EXT_texture3D 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_object GL_EXT_texture_rectangle GL_EXT_texture_sRGB GL_EXT_texture_swizzle GL_EXT_timer_query GL_EXT_vertex_array GL_EXT_vertex_array_bgra GL_3DFX_texture_compression_FXT1 GL_APPLE_client_storage GL_APPLE_packed_pixels GL_APPLE_vertex_array_object GL_APPLE_object_purgeable GL_ATI_blend_equation_separate GL_ATI_envmap_bumpmap GL_ATI_texture_env_combine3 GL_ATI_separate_stencil GL_IBM_multimode_draw_arrays GL_IBM_rasterpos_clip GL_IBM_texture_mirrored_repeat GL_INGR_blend_func_separate GL_MESA_pack_invert GL_MESA_texture_signed_rgba GL_MESA_ycbcr_texture GL_MESA_window_pos GL_NV_blend_square GL_NV_depth_clamp GL_NV_light_max_exponent GL_NV_packed_depth_stencil GL_NV_texgen_reflection GL_NV_texture_env_combine4 GL_NV_texture_rectangle GL_NV_vertex_program GL_NV_vertex_program1_1 GL_OES_read_format GL_SGIS_generate_mipmap GL_SGIS_texture_border_clamp GL_SGIS_texture_edge_clamp GL_SGIS_texture_lod GL_SUN_multi_draw_arrays GL_OES_EGL_image
18:51:03: Supported GLX extensions: GLX_ARB_get_proc_address GLX_ARB_multisample GLX_EXT_import_context GLX_EXT_visual_info GLX_EXT_visual_rating GLX_MESA_copy_sub_buffer GLX_MESA_swap_control GLX_OML_swap_method GLX_OML_sync_control GLX_SGI_make_current_read GLX_SGI_swap_control GLX_SGI_video_sync GLX_SGIS_multisample GLX_SGIX_fbconfig GLX_SGIX_pbuffer GLX_SGIX_visual_select_group GLX_EXT_texture_from_pixmap GLX_INTEL_swap_event
18:51:03: ***************************
18:51:03: *** GL Renderer Started ***
18:51:03: ***************************
18:51:03: Registering ResourceManager for type GpuProgram
18:51:03: GLSL support detected
18:51:03: GL: Using GL_EXT_framebuffer_object for rendering to textures (best)
18:51:03: FBO PF_UNKNOWN depth/stencil support: D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
18:51:03: FBO PF_A8 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
18:51:03: FBO PF_R5G6B5 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
18:51:03: FBO PF_B5G6R5 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
18:51:03: FBO PF_A4R4G4B4 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
18:51:03: FBO PF_A1R5G5B5 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
18:51:03: FBO PF_R8G8B8 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
18:51:03: FBO PF_B8G8R8 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
18:51:03: FBO PF_A8R8G8B8 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
18:51:03: FBO PF_B8G8R8A8 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
18:51:03: FBO PF_A2R10G10B10 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
18:51:03: FBO PF_A2B10G10R10 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
18:51:03: FBO PF_X8R8G8B8 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
18:51:03: FBO PF_X8B8G8R8 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
18:51:03: FBO PF_SHORT_RGBA depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
18:51:03: FBO PF_R3G3B2 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
18:51:03: FBO PF_SHORT_RGB depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
18:51:03: [GL] : Valid FBO targets PF_UNKNOWN PF_A8 PF_R5G6B5 PF_B5G6R5 PF_A4R4G4B4 PF_A1R5G5B5 PF_R8G8B8 PF_B8G8R8 PF_A8R8G8B8 PF_B8G8R8A8 PF_A2R10G10B10 PF_A2B10G10R10 PF_X8R8G8B8 PF_X8B8G8R8 PF_SHORT_RGBA PF_R3G3B2 PF_SHORT_RGB
18:51:03: RenderSystem capabilities
18:51:03: -------------------------
18:51:03: RenderSystem Name: OpenGL Rendering Subsystem
18:51:03: GPU Vendor: unknown
18:51:03: Device Name: Mesa DRI Intel(R) Ironlake Mobile GEM 20100330 DEVELOPMENT x86/MMX/SSE2
18:51:03: Driver Version: 2.1.0.0
18:51:03:  * Fixed function pipeline: yes
18:51:03:  * Hardware generation of mipmaps: yes
18:51:03:  * Texture blending: yes
18:51:03:  * Anisotropic texture filtering: yes
18:51:03:  * Dot product texture operation: yes
18:51:03:  * Cube mapping: yes
18:51:03:  * Hardware stencil buffer: yes
18:51:03:    - Stencil depth: 8
18:51:03:    - Two sided stencil support: yes
18:51:03:    - Wrap stencil values: yes
18:51:03:  * Hardware vertex / index buffers: yes
18:51:03:  * Vertex programs: yes
18:51:03:  * Fragment programs: yes
18:51:03:  * Geometry programs: no
18:51:03:  * Supported Shader Profiles: arbfp1 arbvp1 glsl
18:51:03:  * Texture Compression: yes
18:51:03:    - DXT: no
18:51:03:    - VTC: no
18:51:03:  * Scissor Rectangle: yes
18:51:03:  * Hardware Occlusion Query: yes
18:51:03:  * User clip planes: yes
18:51:03:  * VET_UBYTE4 vertex element type: yes
18:51:03:  * Infinite far plane projection: yes
18:51:03:  * Hardware render-to-texture: yes
18:51:03:  * Floating point textures: no
18:51:03:  * Non-power-of-two textures: yes
18:51:03:  * Volume textures: yes
18:51:03:  * Multiple Render Targets: 8
18:51:03:    - With different bit depths: yes
18:51:03:  * Point Sprites: yes
18:51:03:  * Extended point parameters: yes
18:51:03:  * Max Point Size: 255
18:51:03:  * Vertex texture fetch: no
18:51:03:  * Render to Vertex Buffer : no
18:51:03:  * GL 1.5 without VBO workaround: no
18:51:03:  * Frame Buffer objects: yes
18:51:03:  * Frame Buffer objects (ARB extension): no
18:51:03:  * Frame Buffer objects (ATI extension): no
18:51:03:  * PBuffer suppport: no
18:51:03:  * GL 1.5 without HW-occlusion workaround: no
Kal.

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
RenderImage not displaying anything
« Reply #7 on: June 05, 2011, 12:01:21 pm »
Hmm they could have a backup software renderer? If I remember crystalspace has so OGRE should have that too. Also do OGRE ever use several contexts in one application? Because with your try you will have two contextes, one for each render target.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
RenderImage not displaying anything
« Reply #8 on: June 05, 2011, 12:36:03 pm »
Quote
Hmm they could have a backup software renderer?

No, they use the same thing as in SFML:
Quote
18:51:03: GL: Using GL_EXT_framebuffer_object for rendering to textures (best)

So it's probably something in my implementation.
Laurent Gomila - SFML developer