Click to See Complete Forum and Search --> : Drawing 3D rectangular box on screen
visharad
January 4th, 2007, 04:57 AM
I want to write a code in C# to draw 3D rectangular boxes on screen. As input the user will give coordinates and the software should draw the box accordingly. There should also be provision to resize and rotate the box.
Could you point me to some sample code or at least some hint? Even if the sample is not present in C#, but in VB.Net or VC++, then also fine.
Thanks
visharad
January 4th, 2007, 05:00 AM
Many products in market, e.g., soap, toothpaste etc. come packed in rectangular thick paper boxes. I want to write code to design such boxes. Please suggest me how to do that using VB 6.0 or VC++ 6.0 or C# or VB.Net.
Thanks
HanneSThEGreaT
January 4th, 2007, 05:53 AM
Here are some VB 6 tutorials / samples :
3D in VB 6 (http://www.codeguru.com/vb/gen/vb_graphics/animation/article.php/c5331/)
Rotate 3D Visual Basic 6 (http://www.tutorialized.com/tutorials/Visual-Basic/4)
Included is an attachment I found on the net some time ago - don't remember where, about 3D in VB 6
visharad
January 4th, 2007, 09:22 AM
Thanks!
That .zip is really very helpful. Now I am finding out how to put some text on one face of the box. Of course, when the box is rotated, the text should also rotate accordingly.
HanneSThEGreaT
January 5th, 2007, 02:35 AM
Well, I've been thinking about this..
You can use the DrawText and DrawTextEx Api functions to "write" the text on the different sides of the Rotated rectangle, once rotated.
Here's info on the DrawText (http://www.allapi.net/apilist/DrawText.shtml) and DrawTextEx (http://www.allapi.net/apilist/DrawTextEx.shtml) API's
The TextOut API can also be an option :
3D Text (http://www.builderau.com.au/program/windows/soa/VB_Tip_Display_3_D_text_in_your_program/0,339024644,339130341,00.htm)
visharad
January 5th, 2007, 03:27 AM
Thanks. I have used DrawText. But, the main problem is rotation. When the box is rotated, then the text should also rotate. It is possible that for some rotation angle, only a part of the text will be visible. Not only that, it is also possible that only a part of a character will be visible. Moreover, after rotation the text may not be horizontal or vertical even if it was in the beginning.
HanneSThEGreaT
January 5th, 2007, 04:37 AM
Hmm, then I think using DirectX is going to be your best bet at the end of the day.
I have a 3d snooker sample (which I've downbloaded sometime ago on PlanetSourceCode), where the numbers of the billiard balls were actually images. if the balls were rolling the text (the number on the ball) also roated alongwith with the ball; showing either part of the text, or the text at a skewed angle etc.
Does it sound like something you can use ¿
visharad
January 5th, 2007, 04:41 AM
Even if that sample is not exactly what I am looking for, I think I can get some clue from that. Thanks.
HanneSThEGreaT
January 5th, 2007, 04:53 AM
OK, here it is - it should at the very least give you a better / more broader idea of what you're supposed to do
I sincerely hope it helps! :)
Zaccheus
January 5th, 2007, 06:41 PM
You could also have a look at XNA:
http://msdn.microsoft.com/directx/xna/default.aspx
Looking at the FAQ (http://msdn.microsoft.com/directx/xna/faq/), it seems Managed DirectX is being phased out.
HanneSThEGreaT
January 6th, 2007, 03:12 AM
Just remember one thing about XNA. Only C# is supported at this stage. Different language support for VB.NET may be added in future
Zaccheus
January 6th, 2007, 06:19 AM
See my reply here:
http://www.codeguru.com/forum/showthread.php?p=1513313#post1513313
HanneSThEGreaT
January 6th, 2007, 01:15 PM
Well, initially XNA was only supported with C# Express. That posted link just shows that XNA is supported with the full C# 2005.
VB.NET is still not 100% supported yet, you can't make XBOX games with it.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.