|
||||||||||||||||||
Add Forum to Favorites | Send Topic To a Friend | View Forum FAQ | Track this topic Page: 1 2 »» |
Last Thread Next Thread ![]() |
| Creating 3D Tools with MFC |
|
![]() v71 Banned Member since: 9/11/2000 From: reggio calabria, Italy |
||||
|
||||
| the code is good anyway i noticed with the microsoft debbugger that a lof of first-chance exceptions are generated in the gdi kernel i think this may be caused by a try to access resource not yet loaded as getting a dc of an unhandled window ( could that be ) , this in first time cannot be a problem bu i noticed that as the project grows the debbugger gets unstable and crashes window so i decided to write a win32 lean and mean app to develop tools but no memory leaks check!!!!!! i hate micro$oft |
||||
|
||||
![]() NickB Member since: 11/26/2000 From: Great Britain |
||||
|
|
||||
| I'd love to see a logical way to handle the camera in a 3d view (ie, I can't really think of a way to convert user input into a logical camera/target movement), I've been trying something along these lines as a "model editor" for a simple stress analysis program I've written (with the added interest that I've written the 3d render myself - ultimately the code came to less than Ogl setup code, although it's pretty basic - and I also learnt alot about how 3d transformations worked! an invaluable exercise ) and I am trying to find a way to allow the camera to rotate in space around the model from 2d inputs - an ideas would be appreciated. But for this kind of think I have to admit to liking MFC...comming from an assembly background! |
||||
|
||||
![]() Anonymous Poster |
||||
|
||||
| Atutorial about painting textures directly onto the model would be nice.... |
||||
|
||||
![]() TipplerP Member since: 6/25/2000 From: Germany |
||||
|
|
||||
| Yeah! Great article but ...I have a problem..I know..NERV! But I´m not a profi like ya. I´m new in MFC and I want only 4 views instead of 5. What have I to do?! Is this possible?! Thx anyway |
||||
|
||||
![]() Anonymous Poster |
||||
|
||||
| Nice tutorial. MFC and its document/view model intimidated the hell out of me until I read this. I agree with the above poster, a tutorial showing texture painting in 3d space would be interesting. It would demonstrate how to setup some controls (eg a list box with various texture thumbnails) and also demonstrate converting 2d GDI coord's into 3d OGL coord's. Thanks Joe! Buncen Burner |
||||
|
||||
![]() Jo Member since: 9/30/2000 From: USA |
||||
|
|
||||
| I'd like to thank everybody for the great feedback, I was surprised at the amount of email I received about the article and I appreciate all the suggestions. It seems like converting 2D coords (mouse clicks) into 3D coords is a popular topic. Nehe's most recent article covers a popular OpenGL method for detecting object hits, which is a great in-game method for doing a hassle free check on objects. It has limited usefulness in 3D tools as it is limited on the object level to the selection stack, and it won't give you 3D coords. A similar way to do that kind of detection would be to render each object in a different color in an off screen buffer and do a 2D check. I think the next article will be on the mathematical method to selecting objects (or verts, or edges, or faces) in 3D space. Thanks again, Joe |
||||
|
||||
![]() Anonymous Poster |
||||
|
||||
| Nice article, thanks. It would help me if you included a simple .md3 file. Say, a cube. I've had trouble finding good small md3 files on the web. Bill |
||||
|
||||
![]() Oluseyi Staff Member since: 5/14/2001 From: New York, NY, United States |
||||
|
|
||||
(WARNING! I haven't read through all the code or the entire article; I just saw some comments that I felt I could be helpful with...) TipplerP: To reduce the number of views, you need to eliminate one of your splitter windows. From the introductory portions of the article, the view was split into controls and perspective areas, ie into two. The perspective are was then split into 4 using another CSplitterWnd. To reduce the number of views in a logical manner, you need to eliminate the first splitter (be warned that by doing this you'll lose you controls area, but if that's what you need...). So just look for the code that separates the child window into two and comment it out. For all those interested in the 2D-input-to-3D-coords problem, consider: reducing the number of dimensions is fairly easy, simply requiring a projection (same from 2D to 1D, or 4D to 3D; see 'hypercube' or 'tesseract'). Doing the inverse, however, requires the creation of a coordinate "from thin air". One suggestion is to obtain the z-coordinate as the intersection of a vector perpendicular to the camera and the object surface. ie, project a vector in object space (prior to transformation, which warps coords) from the x,y point on the camera's surface until it intersects the polygon in fron of the camera. That point of intersection will be the input z-coord. Of course, that approach is only useful when you already have an object and are simply seeking to manipulate it. For interactively creating or editing an object, the z-coord must be obtained in an object-independent manner. I suggest maintaining the z-coord and allowing vertical mouse motion to alter it only when a key, such as Ctrl, is held down. The complexities involved in this problem are the chief reason why 3D design is carried out in 3 projective views and composited to form a perspective view. How do you precisely locate a point while editing in 3D? Use a 3D grid? at what density does the grid begin to obscure the work at hand? Can a proximity algorithm be used to fade distant parts of the mesh? In any case, MFC provides a robust messaging structure for obtaining mouse input in any class, though it's usually done in the C[YourProject]View (drawing programs do it in C[YP]Doc). And now my question: is MFC efficient enough to not ignificantly impact high performance game programming? I've created simple DirectX apps using MFC without a Document/View architecture, but am hesitant to proceed because of the generally negative views on MFC in games. --- Those who can do nothing criticize; those who can, critique. |
||||
|
||||
![]() Anonymous Poster |
||||
|
||||
| I thought this was a great tutorial, however ive been looking around trying to work out how to do the same thing with DX8. I think each vieport might need a d3d device to render to it or something.. If anyone could give me an idea of how to set up something like this using dx it would be appreciated. Thanks -Mike |
||||
|
||||
![]() Anonymous Poster |
||||
|
||||
Yeah, hi- Glancing at the feedback and forums, I'm obviously a minority, and I'm probably going to sound like a stupid newbie, and kinda am, but... anyway. Ok... splitters. "...If you execute your program at this point you should see the splitters in place..." Eh? I compile it after using all the code, and doing EVERYTHING it says, and I get the error that my COscarView class isn't defined. I can MAKE it compile by adding in #include's for headers all over the place, but when it DOES compile, there CERTAINLY aren't any splitters... So... -NaT. |
||||
|
||||
![]() Anonymous Poster |
||||
|
||||
| MFC is a mystery to me, but this tutorial looks like it will help me get a better handle on it. i had the same problem as NaT. i downloaded the source (right sidebar for anyone having the same problem, put the following between the two "if ( !m_mainSplitter..." code blocks. ((CInfoPannel*)(m_mainSplitter.GetPane( 0, 1 )))->m_viewports = &m_viewportSplitter; regards NCD |
||||
|
||||
![]() Anonymous Poster |
||||
|
||||
| DOH!!!! err sorry, damn, maybe that didn't work. VC must've switched the active project over to the source i DLed. if i find out how to fix it i'll post again NCD |
||||
|
||||
![]() dchavez Member since: 5/22/2001 From: Australia |
||||
|
|
||||
| Hi, I agree that it was a great tutorial, however, I'm confused as to how to test the viewports by calling your draw cube function. In the tutorial, you suggest testing the code by adding a drawing function to the CPerspective::RenderScene function. Firstly, the CPerpective class does not have a RenderScene() function in the code I downloaded. If I make one, doesn't it override the RenderScene function in the OpenGL class? Secondly, Assuming I can create a local renderscene function, how can I call the Global Draw cube function? It accepts as a parameter a pointer to the Document class (CViewerDoc *doc). I am new to MFC. Please help!! Regards. |
||||
|
||||
![]() Anonymous Poster |
||||
|
||||
quote: Hi Mike, I agree with you (and everybody else), this is a great tutorial. I currently doing this kind of viewer with DX8. You are right when you say that each viewport needs a different device. So, for each viewport, I call the my InitDirect3D. This function contains the call to the following functions: Direct3DCreate8 GetAdapterDisplayMode CreateDevice SetRenderState I currently use a different vertex buffer for each view, but i'm sure that I could share it between the view. (If I instanciate it in my Doc). Right now, almost every work fine except that I have some difficulty to set my ViewMatrix for my perspective view. I'm trying to use the D3DXMatrixLookAtLH function, but I think that the parameters that I'm passing are wrong. Anybody can give me a hint about the setup of the LookAt and Up vectors that I have to pass to this function? Thanks a lot! |
||||
|
||||
![]() michiwalter Member since: 9/5/2000 |
||||
|
|
||||
| Hi, why have you to use different devices? Can't you just set a different D3DVIEWPORT8 for each Viewport? To your problem: Just look at the MS DX8 SDK Documentation + Sample Codes. There are lots of examples, and in each one you can find a call to the D3DXMatrixLookAtLH(). A quick explanation: D3DXMatrixLookAtLH( Matrix, Pos, To, Up ) Pos is your position. To is the position you're looking at. Up is the Up Vector. Example: You are at 0|0|-5 You look at 0|0|0 Your Up Vector is 0|1|0
D3DXMatrixLookAtLH( &Mat, &D3DXVECTOR( 0.0F, 0.0F, -5.0F ),
&D3DXVECTOR( 0.0F, 0.0F, 0.0F ),
&D3DXVECTOR( 0.0F, 1.0F, 0.0f ) );
You got it ??? Bye, Michael |
||||
|
||||
![]() Arsenic Member since: 6/16/2001 From: Montreal, Canada |
||||
|
|
||||
quote: quote: The render target that the doc refers to is the device created with CreateDevice. You can not have a device device between many window. To do what you want, i guess you could your multi viewport device in the frame window and manage the different viewport by yourself. In this case you loose the power of the splitter. quote: Yes, I got this, but this (and all other DirectX Demos & Tutorials) use a camera looking at (0,0,0) with a Up vector = (0,1,0) . I want my camera moving anywhere in the world. So, i want to build those vector from my camera location & rotation. -Arsenic Edited by - Arsenic on June 19, 2001 8:50:01 PM |
||||
|
||||
![]() Arsenic Member since: 6/16/2001 From: Montreal, Canada |
||||
|
|
||||
| Hey Mike, I had a chat with some D3D guru and they suggest me to use the following D3D function quote: -Arsenic |
||||
|
||||
![]() ToastedSoul Member since: 7/5/2001 From: Switzerland |
||||
|
|
||||
| Hi I really liked the article, please write some more articles about creating / enhancing the tool with MFC. Since there are a lot of people (all over the gamedev-forum) that have problems understanding how CAMERA operations (moving, rotating) works, I'm currently working on a camera-class that uses some basic directx matrix/vector functions (so there should not be any problem to use it in opengl too). It's not complete yet, a few functions and some comments are missing. I will try and put up some examples to show how it works. Cheers ToastedSoul Edited by - ToastedSoul on July 5, 2001 4:51:25 PM |
||||
|
||||
![]() Anonymous Poster |
||||
|
||||
| errrr. Hi I am new to MFC There is alot of coverage of how to do menus but what there isn'tis how to do toolbars im very confused can some1 help plz? This would help me alot as I dont have a clue what to do to get my toolbar responding its probably very simple and I will kick my self but all the same any answers? |
||||
|
||||
![]() trysil Member since: 3/1/2001 From: Sweden |
||||
|
|
||||
| Hi! I get compile rrors for this one. The compiler complains that in the commandline: if (!m_mainSplitter.CreateView(0,1, RUNTIME_CLASS(CYourProjectNameview)... The compiler complains that the class name is undefined (I've replaced the CYourProjectName with my class by the way :-). Plus that it complains that the INFOBAR_SIZE is undefined. I'm not fluent enough in MFC to trace down the problem. Someone out there who feel like a good samaritan? "A witty and slightly sarcastic quote from an unkown source" -- The generic SIG /trysil |
||||
|
||||
![]() pacrugby Member since: 9/14/2001 |
||||
|
|
||||
| trysil: add #define INFOBAR_SIZE 150 at the top of MainFrm.h and change the name to CView which is the public name. That fixed my errors but when it runs its says the splitters could not be made?? because of: Error: Trying to create object which is not DECLARE_DYNCREATE or DECLARE_SERIAL: CView. Out of memory creating a splitter pane. First-chance exception in rootopengl.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception. Edited by - pacrugby on October 2, 2001 4:29:07 PM |
||||
|
||||
![]() EPHERE Member since: 4/18/2002 |
||||
|
|
||||
| Note: In the overriden function CMainFrame::OnSize(...), you are resizing the viewport splitters by relating to the INFOBAR_SIZE constant. In the following code (cx - INFOBAR_SIZE) / 2 is used to set the new y parameter for the columns: m_viewportSplitter.SetColumnInfo( 0, ( cx - INFOBAR_SIZE ) / 2, 0 ); m_viewportSplitter.SetColumnInfo( 1, ( cx - INFOBAR_SIZE ) / 2, 0 ); However, when the cx variable becomes less than INFOBAR_SIZE (or 150 by default), the ::SetColumnInfo receives a negative parameter and causes the program to crash. (Try decreasing the size of the app horizontally and you'll see what I mean) In order to fix this we'll need to add one more condition before resizing the splitters. Instead of: if ( m_initSplitters && nType != SIZE_MINIMIZED) {...} simply put: if ( m_initSplitters && nType != SIZE_MINIMIZED && cx >= INFOBAR_SIZE) {...} Cheers, EPHERE ----------------------- }EPHERE{ ----------------------- [edited by - EPHERE on April 18, 2002 11:05:25 AM] |
||||
|
||||
![]() SpecialKs Member since: 5/4/2002 From: USA |
||||
|
|
||||
| Has anyone received a DEBUG ASSERTION FAILED! error when trying to call CSplitterWnd::CreateStatic( ... )? I followed this tutorial and simply added the CSplitterWnd members to CMainFrame as specified and the CreateStatic( ... ) CreateView( ... ) stuff in CMainFrame::OnCreateClient. The author indicates that at this point we should be able to run and that the panes will be visible. However, if I return TRUE, as opposed to CFrameW::OnCreateClient( blah .. ), and run, I get a debug assertion failed. This happens because memory leakage is detected. It happens when CreateStatic( ) is called. I can't figure this out. I have duplicated the author's code up to this point. SPks |
||||
|
||||
![]() Pjotr Svetachov Member since: 11/4/2001 From: Netherlands |
||||
|
|
||||
| Hi. i have a little problem with the tutorial. I use Visial C++. net beta 2. I never worked with MDI. And i finnaly found how to add messages(somewere in the propeties window of the class). But i can't find the onclientcreate. Am i looking in the right place? |
||||
|
||||
|
Page: 1 2 »» All times are ET (US) ![]() |
Last Thread Next Thread ![]() |
|