Advertisement Jump to content
Sign in to follow this  

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.

If you intended to correct an error in the post then please contact us.

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_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)
		// 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());



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 this post

Link to post
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

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!