Click here to Skip to main content
Click here to Skip to main content

A CStatic derived class using Direct3D Retained Mode

By , 2 Apr 2001
 

Overview

The C3DPortal class is a CStatic derived class that I wrote to allow a programmer to drop it into a project and have the ability to load and display 3D objects using Direct3D Retained Mode. I also started toying with manual construction of an object as illustrated in the Test() function. Just be aware if you want to try this function out, that you must first load a valid object. I could have worked on it and enhanced it, etc, but I'm moving onto Immediate Mode stuff and don't want to get any more involved in RM.

C3DPortal Class Outline

Public Methods

The functions typically used by the host application are documented below.

void BrowseForTexture()

Prompts user to browse for a bitmap for use as a texture (which will subsequently be applied to the loaded object)

bool LoadMesh(LPTSTR lpszMeshName=    "")

If lpszMeshName is empty, then the user will be prompted to browse for a X file to be displayed in the control. returns true if load was successful.

void SetColourBackground(COLORREF cr)

Sets the background colour according to the COLORREF parameter supplied.

Example use of C3DPortal

In your header file:

#include "3DPortal.h"
...

class CPortalDemoDlg : public CDialog
{
// Construction
public:
    C3DPortal m_stcPortal; // This member variable is <BR>                           // associated with a CStatic
                            // resource whose ID is IDC_STATIC_PORTAL
    ...

In your implementation file:

BOOL CPortalDemoDlg::OnInitDialog()
{
    CDialog::OnInitDialog();
    
    m_stcPortal.Create("", WS_VISIBLE|SS_NOTIFY|SS_SUNKEN, 
                C3DPortal::GetRect(IDC_STATIC_PORTAL, this),(CWnd*)this);
    m_stcPortal.LoadMesh();

    return TRUE;  // return TRUE  unless you set the focus to a control
}

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Jason Troitsky
United Kingdom United Kingdom
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
Generalcant find d3drm.libmemberkob-kob20 Dec '06 - 23:51 
can any one please send me "d3drm.lib" Frown | :(
please , please , please .....
if any one have this file
please send it to kob_kob@walla.co.il
 
thanks Big Grin | :-D

Generalx filesmemberdagan_os25 Jan '05 - 21:50 
Hi
 
I need to display a 3D head how can I get x file for that or create it?
I also need to be able to draw on it and display it.
 
Thanks
General3D Test functionmemberGeorgi Petrov16 Jan '05 - 23:33 
Hello,
 
I'm working on image histogram analisys over time series, and need to dral 3D histogram. I found how to use your Test button and function, but I need to remove the rotating cherry from the dialog.
 
Can yo please provide me some help, or some links to see how to crete 3D surface from 2D array with values.
 
Thank in advance,
Georgi
Questionhow to load other .x files, the one that are not attached with sample???memberEjaz28 Dec '03 - 21:59 
I'm having the same problem, the .x files with the sample works well, but I can't load any other .x file.
 
meshbuilder->Load((LPTSTR)LPCTSTR(strObjectPath), NULL, D3DRMLOAD_FROMFILE, NULL, NULL );
 
is getting failed with any other file and returning false from LoadMesh(LPTSTR lpszMeshName);
 
Smile | :)
AnswerRe: how to load other .x files, the one that are not attached with sample???memberHughJampton11 Feb '05 - 6:30 
I used conv3ds.exe with the -m option to convert .3ds files to .x. Works fine.
 
Conv3ds.exe used to ship with the directx sdk but I can't find it to download from MS. The version I have shipped with MS Train Simulator, d/l it from here:
http://sfy1.com/3dtools
 

 
Hugh
GeneralRe: how to load other .x files, the one that are not attached with sample???memberZhelezov16 Apr '05 - 9:00 
Unfortunately link http//sfy1.com/3dtools no longer exists.
If you search conv3ds.exe in Microsoft Download Center, you will not find it, because it is not available alone. You have to download all self extract archive file DX81SDK_Extras.exe from address
 
http://www.microsoft.com/downloads/details.aspx?FamilyID=1c1a1d73-2c84-4ed5-8136-ece8d39442e7&DisplayLang=en
 
If you start self extract archiver and unzip it, in example in C: , you can find converter conv3ds.exe in sub-directory
 
c:\Extras\Direct3D\Old DXUtilities
 
If your 3DS file (in example file.3DS) include static mesh, you can create DirectX file with the same name (file.x) using command
 
c:\Extras\Direct3D\Old DXUtilities\conv3ds -m file.3ds
 
from Command Prompt (it is assumed, that file.3ds is in current directory. otherwise you can add it path). Obviously it will be good idea to make some .bat file for this long command. You can open and show this .x file using PortalDemo.exe
 
O. Zhelezov
QuestionHow can I collect X files?memberICE_WIZARD27 Jul '03 - 8:47 
Could you tell me some about X file?
I have some x file design by DarkBasic language, and I can not load them. They are not the same with you x file?
 
[IMG]http://sinhvienufa.vietnam-it.com/forums/html/avatars/dethuong/Avatar7A1F.gif[/IMG]

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web01 | 2.6.130516.1 | Last Updated 3 Apr 2001
Article Copyright 2001 by Jason Troitsky
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid