Sign in to follow this  

Simple Drawing Function, Not Working...

This topic is 4383 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[i]->GetRenderInformation();
		Obj = Scene_Objects[i]->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
Are you sure Scene_Objects[i]->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

This topic is 4383 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this