# ClanLib surface problem!

This topic is 4903 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I am currently trying out ClanLib, and seem to have a strange issue I'm hoping someone can help me with (since they haven't responded on the ClanLib mailing list). In my game I have two surfaces being drawn; one which draws for a few seconds and then is destroyed, and the other which isn't drawn until after the first surface has been destroyed. The problem is that even though the second surface is 1024x768, it's being drawn with a size of 350x110, which happens to be the size of the first surface. The actual image is correct and so is the placement on screen, but the size is always 350x110. I can duplicate the problem in the sample code below:
CL_SetupCore::init();
CL_SetupDisplay::init();
CL_SetupGL::init();

CL_DisplayWindow window("test", 1024, 768);

// Connect the Window close event
CL_Slot slot_quit = window.sig_window_close().connect(this, &ExampleBlendFunctions::on_window_close);

// Run until someone presses escape
while (!quit)
{
CL_Display::clear();

{
// logo1 has a size of 350x110 and will be destroyed outside this scope
CL_Surface logo1("clanliblogo.png");
logo1.draw(0, 0, window.get_gc());
}

// logo2 for some reason always displays in 350x110 if logo1 has been destroyed, otherwise it will display fine if logo1 still exists.
CL_Surface logo2("mainscreen.png");
logo2.draw(0, 0, window.get_gc());

CL_Display::flip();
CL_System::keep_alive();
}

CL_SetupGL::deinit();
CL_SetupDisplay::deinit();
CL_SetupCore::deinit();


Does anyone have any clue why my second surface won't display correctly if the first surface is destroyed? If the first surface is NOT destroyed after the draw() call, or I just comment out the draw() function, then the second surface displays correctly. I'm very confused... - Houdini

##### Share on other sites
Does anybody have any ideas?

After doing some more testing, if I put in a CL_Display::clear(); line just before the second surface gets constructed but after the first surface is destructed, then it displays fine. But if I put the clear line just after the second surface gets constructed, but before it draws, it still displays in the 350x110 size.

I'm new to 3D programming so I'm really hoping there is something simple I'm not doing that can fix this issue. As I said, I tried the ClanLib IRC channel and their user mailing list and nobody has responded, so I'm hoping the GameDev community can help me out.

- Houdini

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 15
• 11
• 9
• 9
• 40
• ### Forum Statistics

• Total Topics
634130
• Total Posts
3015704
×