Jump to content
  • Advertisement
Sign in to follow this  
Shamino

Simple Drawing Function, Not Working...

This topic is 4595 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Okay, so I got this drawing function, it reads a vector of objects that can return a pointer to a model Once we return the pointer to the model we set it equal to an Obj pointer, so therefore we can loop through every different model using one name. First let me show you an example of what my Vector will hold
#ifndef OBJECT_H
#define OBJECT_H
#include "MS3D.h"
#include "ObjectFactory.h"
#include "ResourceManager.h"


enum OBJECTS
{
   SHIP_OBJECT
};

class Object
{
public:
	virtual ~Object() {}
	float locx, locy, locz;
	bool MarkedForDeletion;

	virtual MS3DModel *GetRenderInformation() = 0;
	virtual void GetPhysicsInformation() = 0;
	virtual void GetSoundInformation() = 0;
	virtual void Update() = 0;


};

class Ship : public Object
{
public:

	Ship(float x, float y, float z)
	{
		x = locx;
		y = locy;
		z = locz;
	}

	virtual MS3DModel *GetRenderInformation()
	{
		return Model1;
	}

	virtual void GetPhysicsInformation()
	{
	
	}

	virtual void GetSoundInformation()
	{
	
	}

	virtual void Update()
	{
	
	}

protected:

	// Ship specific functions go here

};

#endif


Alright, so the Ship class is an example of an object that would be held in the vector, notice the GetRenderInformation() function? It simply returns a pointer to an MS3DModel already loaded into memory elsewhere. Okay, now I'm going to show you where I try to use that function, remember, I can already go Model1->DrawMS3DModels; but the goal is to bring all my models to a centralized render function and set them to a generic pointer name, Obj. And finally, loop an Obj->DrawMS3DModels..
void GLRenderer::DrawSceneObjects()
{
		MS3DModel * Obj;
	for (int i = 0; i<Scene_Objects.size(); i++)
	{	
		Scene_Objects->GetRenderInformation();
		Obj = Scene_Objects->GetRenderInformation();
		Obj->DrawMS3DModels();
	}
}


I get no errors, but I get no picture on my screen either, whats the deal?

Share this post


Link to post
Share on other sites
Advertisement
Are you sure Scene_Objects->GetRenderInformation(); returns a valid MS3DModel pointer? Is there any extra information in the MS3DModel your could look at using a debugger to determine if it is valid?

Other than that, it's hard to tell why the function would fail. What are you using to draw the images? How are they stored?

Share this post


Link to post
Share on other sites
That would have to be the problem, but why wouldn't it be? I have no debugger atm, so I have no way of figuring out if it is valid or not :\

Share this post


Link to post
Share on other sites
Made it work, I made the pointers, and everything, but I never used the new operator before I tried working with them...

My engine omgwtfpwns now

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!