Hi!

I've got a simple task to perform but the window goes blank on a try to render. Everything is OK if I use the software renderer, but both GL and GL1 lead to the black picture. It happens probably the moment CL_GraphicContext::set_projection has been called.
ClanLib 2.3, the code follows:

Code:
// clSample.h
class clSample :public CL_GUIComponent {
  public:
    clSample (const CL_Rect &position, CL_GUIManager *gui_manager, CL_Rectf &viewport);
    ~clSample();

    CL_Callback_v0 func_exit;

  protected:
  private:
    CL_Slot m_hotkeys;
    CL_Image m_back;
    CL_Font m_font;
    float m_time;

    CL_FrameBuffer m_fb_paper;
    CL_Image m_paper;
    CL_Texture m_tex;

    CL_Rectf m_viewport;

    CL_Mat4f m_mx_proj;
    CL_Mat4f m_mx_modelview;
    CL_Mat4f m_mx_object;

    float m_angle_x;
    float m_dx;

    bool m_card_open;
    bool m_card_opening;

    void on_render (CL_GraphicContext &gc, const CL_Rect &cliprect);
    void on_filter_message(CL_GUIMessage &msg);

    void ShowAction(void);
    void CalculateCamera (CL_GraphicContext &gc);
    void CalculateTranslation(void);
};

// clSample.cpp
#include "clSample.h"
#include "precomp.h"
#include "defines.h"

#define PRESS_X_MESSAGE "Press X to show action"

#define PAPER_WIDTH 301
#define PAPER_HEIGHT 410

//******************************************
clSample::clSample (const CL_Rect &position, CL_GUIManager* gui_manager, CL_Rectf &viewport)
  : CL_GUIComponent (gui_manager, CL_GUITopLevelDescription (position, false)), m_viewport (viewport) {

  func_render().set (this, &clSample::on_render);
  m_hotkeys = gui_manager->sig_filter_message().connect(this, &clSample::on_filter_message);

  CL_GraphicContext gc = get_gc();
  CL_ResourceManager resources = gui_manager->get_theme().get_resources();
  m_back = CL_Image (gc, "Background", &resources);
  m_font = CL_Font (gc, "Tahoma", 20);

  // Prepare texture:
  m_tex = CL_Texture (gc, "BackgroundPaper", &resources);
  m_fb_paper = CL_FrameBuffer (gc);
  m_fb_paper.attach_color_buffer(0, m_tex);
  gc.set_frame_buffer (m_fb_paper);
  m_font.draw_text (gc, 20, 50, "Folder", CL_Colorf::black);
  gc.reset_frame_buffer();

  m_card_open = false;
  m_card_opening = false;

  CalculateCamera(gc);
}


//******************************************
clSample::~clSample() {
}


//******************************************
void clSample::on_render (CL_GraphicContext &gc, const CL_Rect &cliprect) {
  gc.set_map_mode(cl_map_2d_upper_left);
  gc.set_projection(CL_Mat4f::identity());
  gc.set_modelview(CL_Mat4f::identity());
  gc.set_cliprect(cliprect);
  gc.set_viewport(m_viewport);

  m_back.draw(gc, 0, 0);
  if (!m_card_opening) {
    int x = (gc.get_width() - m_font.get_text_size(gc, PRESS_X_MESSAGE).width) >> 1;
    m_font.draw_text (gc, x, 15, PRESS_X_MESSAGE, CL_Colorf::gray);
  }

  gc.set_map_mode(cl_user_projection);
  gc.set_projection(m_mx_proj);
  gc.push_modelview();
  gc.set_modelview(m_mx_modelview);

  CalculateTranslation();

  gc.mult_modelview(m_mx_object);
  gc.mult_scale(2.0f/gc.get_width(), -2.0f/gc.get_height());

  CL_Rectf texture_unit1_coords(0, 0, CL_Sizef (PAPER_WIDTH, PAPER_HEIGHT));

  CL_Size paper_size (PAPER_WIDTH, PAPER_HEIGHT);
  CL_Rectf rect(-paper_size.width/2.0f, - (float) paper_size.height, CL_Sizef(paper_size));

  CL_Vec2f positions[6] =
  {
    CL_Vec2f(rect.left, rect.top),
    CL_Vec2f(rect.right, rect.top),
    CL_Vec2f(rect.left, rect.bottom),
    CL_Vec2f(rect.right, rect.top),
    CL_Vec2f(rect.left, rect.bottom),
    CL_Vec2f(rect.right, rect.bottom)
  };

  float texture_width = (float) m_tex.get_width();
  float texture_height = (float) m_tex.get_height();

  float texel_centre = 0.375f;

  float src_left = (texture_unit1_coords.left + texel_centre) / texture_width;
  float src_right = (texture_unit1_coords.right + texel_centre) / texture_width;
  float src_top = (texture_unit1_coords.top + texel_centre) / texture_height;
  float src_bottom = (texture_unit1_coords.bottom + texel_centre) / texture_height;

  CL_Vec2f tex1_coords[6] =
  {
    CL_Vec2f(src_left, src_top),
    CL_Vec2f(src_right, src_top),
    CL_Vec2f(src_left, src_bottom),
    CL_Vec2f(src_right, src_top),
    CL_Vec2f(src_left, src_bottom),
    CL_Vec2f(src_right, src_bottom)
  };

  gc.set_texture(0, m_tex);
  CL_PrimitivesArray prim_array(gc);
  prim_array.set_attributes(0, positions);
  prim_array.set_attribute(1, CL_Colorf::white);
  prim_array.set_attributes(2, tex1_coords);
  gc.set_program_object(cl_program_single_texture);
  gc.draw_primitives(cl_triangles, 6, prim_array);
  gc.reset_program_object();
  gc.reset_texture(0);
  gc.pop_modelview();

  if (m_card_open) {
    if (m_angle_x >= 90.0f) {
      m_card_opening = false;
      m_card_open = false;
      request_repaint();
    }
  } else {
    if (m_angle_x <= 0.0f) {
      m_card_opening = false;
      m_card_open = true;
      request_repaint();
    }
  }
}


//******************************************
void clSample::CalculateCamera (CL_GraphicContext &gc) {
  m_mx_proj = CL_Mat4f::perspective (90.0f, 1.0f, 0.1f, 10000.0f);

  m_mx_modelview = CL_Mat4f::identity();
  m_mx_modelview.translate_self(-400.0f, -500.0f, 0.0f);
}


//******************************************
void clSample::on_filter_message(CL_GUIMessage &msg) {
  if (msg.is_type(CL_GUIMessage_Input::get_type_name())) {
    CL_GUIMessage_Input input_msg = msg;
    CL_InputEvent e = input_msg.get_event();
    if (e.type == CL_InputEvent::released) {
      switch (e.id) {
      case CL_KEY_ESCAPE:
        if (!func_exit.is_null()) func_exit.invoke();
        msg.set_consumed();
        break;
      case CL_KEY_X:
        ShowAction();
        msg.set_consumed();
        break;
      }
    }
  }
}


//******************************************
void clSample::ShowAction(void) {
  if (m_card_opening) return;
  if (m_card_open) {
    m_angle_x = 0.0f;
    m_dx = 0.1f;
  } else {
    m_angle_x = 90.0f;
    m_dx = -0.1f;
  }
  m_time = (float) CL_System::get_time();
  m_card_opening = true;
  set_constant_repaint(true);
}


//******************************************
void clSample::CalculateTranslation(void) {
  if (m_card_opening) {
    float l_time = (float) CL_System::get_time();
    float dt = l_time - m_time;
    m_time = l_time;
    m_angle_x += dt * m_dx;
  } else {
    if (m_card_open) {
      m_angle_x = 0.0f;
    } else {
      m_angle_x = 90.0f;
    }
    set_constant_repaint(false);
  }

  m_mx_object = CL_Mat4f::identity();
  m_mx_object.multiply (CL_Mat4f::rotate (CL_Angle (m_angle_x, cl_degrees), 1.0f, 0.0f, 0.0f));
}
Maybe I forgot to put on the light? Anyway I'm not in a state to study OpenGL right now - all 3D stuff has been stripped from the exapmles
Please, give me a hint, I can't tackle the problem myself.