Archived

This topic is now archived and is closed to further replies.

Scheermesje

Strange pointer problem..

Recommended Posts

Scheermesje    169
I have the following: CMesh *Mesh; Mesh = new CMesh(TBox); Render.RenderMesh(Mesh); Mesh->Render(); The Mesh is created correctly and when I write Render.RenderMesh(Mesh) the code goes to the render function. Inside Mesh.Render() is the following code: CD3DRender::Get().RenderMesh(this); The first thing I do in my rendermesh function is this: if( NULL == m_pd3dDevice) { CLog::Get().Write("Error!!"); return; } If I call rendermesh directly via Render.RenderMesh(Mesh) then this check succeeds and my Device is failed. If I call Mesh.Render() the check on my device fails and I get 'Error!' written to my log file. How is this possible? [edited by - Scheermesje on March 27, 2004 10:21:40 AM] [edited by - Scheermesje on March 27, 2004 10:22:06 AM] [edited by - Scheermesje on March 27, 2004 10:22:42 AM]

Share this post


Link to post
Share on other sites
Scheermesje    169
Sorry.. that was just a typo. I wrote -> in my code so that's not the problem

(Has someone tried to edit a file where he uses [ source ] thingies.. they are completely ruined by the editor...?)

[edited by - Scheermesje on March 27, 2004 10:24:23 AM]

Share this post


Link to post
Share on other sites
Scheermesje    169
Thnx for your help

If I changed in my Setup function things like Render.Init to CD3DRender::Get().Init my Mesh.Render() function works(and Render.Rendermesh() does not work)

Is there a way to make sure they work both?

I''m now using the following architecture:

CApp inherits from CRazorFramework, CRazorframework has an instace of CWindow, CD3DRender, CLog.

If I want to write to my logfile I could call CLog::Get().Write("") or I could say CRazorframework::Get().Log.Write("").

Which is a better way to do it? I''m just completely stuck in things like singleton and when to use them I don''t think my design is ''perfect'' because all the modules depend on eachother way to much..

I hope someone gets my problem and could help me out

Share this post


Link to post
Share on other sites