Page 1 of 2
Surfaces not loading when using vector?

Posted:
Mar 5, 2004 @ 7:06pm
by Volte6

Posted:
Mar 5, 2004 @ 7:26pm
by Volte6

Posted:
Mar 5, 2004 @ 10:00pm
by ppcStudios

Posted:
Mar 5, 2004 @ 10:29pm
by Volte6

Posted:
Mar 5, 2004 @ 10:43pm
by ppcStudios
You'll want to verify the path information for your image file. Based on what you have listed, the image is located in the root directory.

Posted:
Mar 5, 2004 @ 10:56pm
by Volte6
Yeah, everythign runs from the root.
Plus, I load at least 3 other surfaces, with no problem.
It has somethign to do with the way i'm doing it... i'm sure of it. But I can't possibly guess WHAT i'm doing wrong.
I may end up instantiating the object with "new" and just passing a pointer into the vector container. I have a feeling that will work, for some reason. I hate to do it. And i'm gonna have to worry about deleting them too. Le argh.
Anybody ever try to do something like this, pushing an object with a surface into a vector? Problems? No problems?
Thanks

Posted:
Mar 5, 2004 @ 11:01pm
by ppcStudios
I've not used vector, but have used arrays of surfaces with no problem. Using a vector shouldn't be an issue. Without seeing the actual code, I can only guess at what the problem may be. I would first check those return codes...

Posted:
Mar 5, 2004 @ 11:13pm
by Volte6
That's pretty much the code, actually...
I mean, you can use that same code to do whatever is needed...
I'll check the return codes when I can though. thanks.

Posted:
Mar 5, 2004 @ 11:15pm
by Pejo Software - Per
When you add you Object to the vector you are making a copy and since CGapiSurface doesn't have a copy constructor that copies the image data the Object in the vector will not contain the image data.

Posted:
Mar 5, 2004 @ 11:49pm
by Volte6

Posted:
Mar 6, 2004 @ 12:55am
by fzammetti

Posted:
Mar 6, 2004 @ 4:53am
by Volte6
Still not working.
I dunno what format to specify that an HRESULT is, so I'm using %0u for _stprintf to display the value.
That gives me: 3362128032
How do I find out what that sort of thing means?

Posted:
Mar 6, 2004 @ 5:03am
by fzammetti
Compare the result to the constants in GD. For instance, you can generally do:
HRESULT hr;
hr = graphic.CreateSurface(GDSURFACE_SYSTEMMEMORY, pImageFile);
if (hr != GD_OK) {
// Do some sort of error handling
}
You could do something as simple as:
if (hr == GDERR_BITMAPNOTFOUND) { // Pop error message }
if (hr == GDERR_INCOMPATIBLEPRIMARY { // Pop error message }
if (hr == GDERR_INVALIDBITMAP { // Pop error message }
if (hr == GDERR_INVALIDPARAMS { // Pop error message }
if (hr == GDERR_INVALIDSURFACETYPE { // Pop error message }
if (hr == GDERR_LOCKEDSURFACES { // Pop error message }
if (hr == GDERR_OUTOFMEMORY { // Pop error message }
if (hr == GDERR_SURFACELOST { // Pop error message }
Those are all the errors defined for this function to return.
Personally, I have a simple wrapper function that I call in place of CreateSurface that handles this so I don't have a bunch of repeated code. I suspect everyone does a very similar thing too.

Posted:
Mar 6, 2004 @ 6:05am
by Volte6
Okay, it's this:
GDERR_INCOMPATIBLEPRIMARY
What does it mean, and how do I fix it?


Posted:
Mar 6, 2004 @ 6:13am
by Volte6
And finally, where can I find a list describing these error messages? Thanks!