Watch, Follow, &
Connect with Us

Welcome, Guest
Guest Settings
Help

Thread: Creating 3D Objects at Run time


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 0 Threads: [ Previous | Next ]
Barry Andrews

Posts: 71
Registered: 9/19/03
Creating 3D Objects at Run time  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 11, 2017 5:32 AM
I am using c++ Builder Tokyo to create a graphics scene using Rectangle3D and Text3D objects.
I am creating these at runtime as follows

		ColorMaterialSource         = new TColorMaterialSource(Owner);
		ColorMaterialSource->Parent = (TFmxObject *)Owner;;
		Text3D = new TText3D(Owner);
		Text3D->Name                = "Text3D_" + IntToStr(ObjectNumber++);
		Text3D->Parent              = (TFmxObject *)Owner;
		Text3D->Visible             = true;
		Text3D->Position->Z         = 0;
		Text3D->Font->Family        = "Arial";
		Text3D->MaterialSource      = ColorMaterialSource;
		Text3D->MaterialBackSource  = NULL;
		Text3D->MaterialShaftSource = NULL;
		Text3D->Projection          = TProjection::Screen;
		Text3D->WordWrap            = false;
		Text3D->Depth               = 0.01;
		Text3D->Projection          = TProjection::Screen;
		Text3D->Width               = Width;
		Text3D->Height              = Height;
		Text3D->Position->Y         = Y;
		Text3D->Position->X         = X;
		Text3D->Font->Size          = Height;
		Text3D->Font->Family        = Family;
		if (MaxLen && TheMsg.Length() > MaxLen)
		{
			TheMsg = TheMsg.SubString(0, MaxLen);
		}
		Text3D->Text                = TheMsg;
		Text3D->WordWrap            = false;
		Text3D->Depth               = 0.1;
		Text3D->HorzTextAlign       = Align;
		Text3D->Position->Z         = Zpos;
		Text3D->Visible             = Visible;

and
		TextureMaterialSource       = new TTextureMaterialSource(Owner);
		TextureMaterialSource->Parent = (TFmxObject *)Owner;;
		Rect3D = new TRectangle3D(Owner);
		Rect3D->Name                = "Rect3D_" + IntToStr(ObjectNumber++);
		Rect3D->Parent              = (TFmxObject *)Owner;
		Rect3D->Visible             = true;
		Rect3D->MaterialSource      = TextureMaterialSource;
		Rect3D->MaterialBackSource  = NULL;
		Rect3D->MaterialShaftSource = NULL;
		Rect3D->Projection          = TProjection::Screen;
		Rect3D->MaterialSource      = TextureMaterialSource;
		Rect3D->MaterialBackSource  = NULL;
		Rect3D->MaterialShaftSource = NULL;
		Rect3D->Projection          = TProjection::Screen;
		Rect3D->Height              = Height;
		Rect3D->Width               = Width;
		Rect3D->Depth               = 0.1;
		Rect3D->Position->Y         = Y;
		Rect3D->Position->X         = X;
		Rect3D->Position->Z         = Zpos;
		Rect3D->Visible             = Visible;


This works fine on 3 of my monitors, but when I use a USB to HDMI adapter, the graphics do not appear.
If I add a Rectangle3D at design time, this does appear.
The only difference I can see between the two is that the design time rectangle has
FRecalcOpacity set to false whereas the design time has this set to true, however I don't seem to be able to modify this.

Is there something I am doing wrong at runtime which is causing this to occur?
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02