Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / does this function look ok?

Author
Message
Lover of games
19
Years of Service
User Offline
Joined: 17th Apr 2005
Location:
Posted: 4th May 2008 11:42
I get some weird errors and to the best of my ability it seems fine (the function) i did notice that when you put an "}" after return is just stays there, it doesn't go to the beging of the line. Any ideas woulkd be helpful.



"Originally I was going to have a BS on it but you know how that would be. I can't walk around with the letters BS on me." More or less a qoute by Syndrome from Jack, Jack, attack
Sephnroth
21
Years of Service
User Offline
Joined: 10th Oct 2002
Location: United Kingdom
Posted: 4th May 2008 14:13
memcpy(Temp, Box, sizeof{VERTEX});

should be:

memcpy(Temp, Box, sizeof(VERTEX));



Lover of games
19
Years of Service
User Offline
Joined: 17th Apr 2005
Location:
Posted: 4th May 2008 17:38
Ok,. i fixed it but when i run the program i get access violations and then it goes to memcpy.asm Any idea what it could be? it goes to this line in memcpy.asm:



Any idea what the heck it could be?

"Originally I was going to have a BS on it but you know how that would be. I can't walk around with the letters BS on me." More or less a qoute by Syndrome from Jack, Jack, attack
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 4th May 2008 19:42
I think I answered this for you before. Violations are caused by one thing: You're trying to read or write an area of memory that is not belonging to your applicatin (Your applications data area or Shared Data Area in the Windows OS)

(I like OS's that allow you to write self modifying code blocks.. not for making virii... More like Superior copyright protection but I digress)

Once again.. your issue is Temp isn't Pointing anywhere... it seems to point to a random location in memory. Allocate some ram first... Make sure you have Temp pointing to that al;located ram.. then try it.

Lover of games
19
Years of Service
User Offline
Joined: 17th Apr 2005
Location:
Posted: 4th May 2008 21:41
you mean like Temp = new void?

"Originally I was going to have a BS on it but you know how that would be. I can't walk around with the letters BS on me." More or less a qoute by Syndrome from Jack, Jack, attack
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 4th May 2008 21:57
Um.. not exactly - but you do have the right idea.... Just I'm not sure you understand what void is in C++.

int i; <- Integer (Compiler always knows its an int)

&i <---- Address of where Integer is store in memory. (Compiler always knows its the Address of an int.. but that doesn't mean where you pass this "address" will know its an int... (so it would seem like a void to the compiler if its just a memory address to some unknwon thing)

Static Buffer? Hmm...
char CHAR1K[1024]; This is a Fixed Buffer.. No need to "new" it or "delete" it... Static

void *Temp= &CHAR1K; I THINK is the right syntax to make your VOID POINTER actually point to that 1k of char's above.

I THINK you can do: void *Temp=new char[1024]; and delete it when you're done also.. but I may have the syntax wrong.

These void pointers actually point to a chunk a ram, albeit not huge, but.. if your function you're calling was to "write data" into this area, and not write "out of bounds" (meaning... you stay inside the allocated ram you declared or whatever) You won't trash other things in memory.. like other things your program RELIES ON... also.. there is the chance that (when you're LUCKY) that writing outside the bounds actually means your program is writing outside its "allowed ram" ... thats a blessing because you might not otherwise have known you were crushing your variables if it wasn't for the ACCESS VIOLATION error!

Nothing is worse then chasing a bug that is from some errant code changing some value on you your MIND would not have even considered a possibility at first... (at least for me).... I usually only find those kind of errors after hours and/or days of beating up some strange issue.. to find out I had a +1 where I should of had a -1 one or something.

Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 4th May 2008 22:40 Edited at: 4th May 2008 22:41
Essentially a void pointer is undimensioned. It doesn't point to any particular type of data so you can't increment the pointer. Incrementing a pointer to, say, type int gives back a new address that is 4 bytes larger than what it started out if an int is 4 bytes wide. A pointer to a float may return a different raw address because floats take up a different number of byte (possibly) and double even more. A pointer to a structure will increment to an address that reflects the size of the structure.

void pointers don't point to any particular type of data so they don't have an increment size. Usually you have to cast them to another type or depend on auto promotion to make them work in the context you intend.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Lover of games
19
Years of Service
User Offline
Joined: 17th Apr 2005
Location:
Posted: 5th May 2008 19:25
well, i managed to get rid of the access violation but it's telling me the trianlge isn't right and it spits out Direct3D9(ERROR) even if the exe runs and works right. so i don't know. i want to create my own custom boxes using DirectX vertexbuffers and stuff, but that doesn't seem to be going so good.

"Originally I was going to have a BS on it but you know how that would be. I can't walk around with the letters BS on me." More or less a qoute by Syndrome from Jack, Jack, attack
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 5th May 2008 19:44
Have you tried using DarkGDK methods for playing hardball with meshes, vertex buffers, and uv levels and FVF formats and such?

Its ok for most things.. just Real time Mesh deformation and LOD I think might be to slow for it... depending on the mesh of course... more complex you go ... ugh..

But I've had a lot of fun painting vertices and setting multiple textures to a mesh and tossing a shader on it etc.

Oh... and you have to take the directx errors with a grain of salt because DarkGDK throws out a number of its own "d3d errors" etc.. especially during shutdown! (yikes).....

LOL Good luck man!

Lover of games
19
Years of Service
User Offline
Joined: 17th Apr 2005
Location:
Posted: 5th May 2008 19:51
thanks, the thing is a managed to do it once. in a pure DirectX app
might have to find that and see what i did that it worked. Really need to learn some basics first i guess.

"Originally I was going to have a BS on it but you know how that would be. I can't walk around with the letters BS on me." More or less a qoute by Syndrome from Jack, Jack, attack
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 5th May 2008 20:02
Don't forget ... we don't have the source to GDK so its anyones guess how sctructures you're making are being handled inside the GDK.

Lover of games
19
Years of Service
User Offline
Joined: 17th Apr 2005
Location:
Posted: 5th May 2008 20:53
yea, wish we had the srouce.damn TGC...don't mean it guys!

"Originally I was going to have a BS on it but you know how that would be. I can't walk around with the letters BS on me." More or less a qoute by Syndrome from Jack, Jack, attack
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 6th May 2008 06:39
@Lover of games

Might I start a dialog with you? I see by your use of dbGetDirect3DDevice()->CreateVertexBuffer that you're a lot more familiar with Direct X than I am, though I'm coming along slowly.

I'm trying to get a pointer to the actual block of memory that holds the image data. To this end I'm looking at the dbGetImageData () function, which is fairly straight forward except for one parameter. The one I'm looking at is a pointer, called pData, to an LPSTR. It's obviously pointing to a string, or at least it's supposed to but I have no idea what the significance of the data that pData is supposed to be. In my debug session it points to a string "MMM".

It would appear that the real data I'm looking for, the beginning of the image data block is derived from the dbGetImagePointer () function which returns a LDIRECT3DTEXTURE9. Since this really isn't a pointer to, I would suspect, DWORDS I'm thinking that this is really a pointer to a structure that has the address of the image buried in it.

So, would you have be able to tell me how to extract this information?

Please??

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Lover of games
19
Years of Service
User Offline
Joined: 17th Apr 2005
Location:
Posted: 6th May 2008 16:52
Well, i really don't know...Let me do a few tests and see what i can find for you. it might be that you have to put the filename of the image you want to extract it to.not sure. Anyways, best of luck and i'll see if I can fing out for you.

"Originally I was going to have a BS on it but you know how that would be. I can't walk around with the letters BS on me." More or less a qoute by Syndrome from Jack, Jack, attack
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 7th May 2008 00:53
I think I'm closing in on it. I can call the function dbGetImagePointer() to return a pointer to an IDIRECT3DSURFACE9. From there I lock a rectangle (in most of my instances I'd lock the entire surface.) One of the items I pass to the lockrect () function is a pointer to a D3DLOCKED_RECT structure where the locking function will place information regarding the pitch of the image and a void * to the byte data.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Lover of games
19
Years of Service
User Offline
Joined: 17th Apr 2005
Location:
Posted: 7th May 2008 11:56
what are you trying to do, anyways?

"Originally I was going to have a BS on it but you know how that would be. I can't walk around with the letters BS on me." More or less a qoute by Syndrome from Jack, Jack, attack
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 7th May 2008 17:24
Jason and I are of the opinion that the need to do modifications to an image by swapping it in and out with memblocks or bitmaps affects the potential performance of an application adversely. It may not do so for any one given game but it has the potential. Even then, if it affects the time available to other processes, it's a plus to keep our apps from taking up any more time than necessary.

I discovered a function, dbWriteImage (), that lets you place one dot at a time on an image at a time. I tried this experimentally yesterday and didn't get the results I was expecting. I suspect that this function would have to lock/unlock the image each time it's used. Previous experience with bitmaps has shown me that this slows down the process. Also, placing data one pixel at a time is inefficient if using a pointer is appropriate to the function being performed.

Sure there are drawbacks in that I'll have to deal with clipping and, in some functionality that I'm going to have to open up to any other programmer who wants to take the risk of using my classes, having to track the locked status of the image. I'll also have to deal with formats other than A8R8G8B8, which takes up more CPU time.

AAR, it's a matter of speed and, IMO, efficiency.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 7th May 2008 18:45
Agreed... (Though I still need to optimize some of my (should-be pointer math) pixel blitting) LOL

Lover of games
19
Years of Service
User Offline
Joined: 17th Apr 2005
Location:
Posted: 10th May 2008 19:22
Ok, can anyone see what the box is not showing up? I've tried everything i can think of to make it show up. It just not showing up....here is the code.



this is the same code as this one that i have in another program and it works.



As you can see, it's the same, well except that one ioos part of a class and one is not

"Originally I was going to have a BS on it but you know how that would be. I can't walk around with the letters BS on me." More or less a qoute by Syndrome from Jack, Jack, attack

Login to post a reply

Server time is: 2024-09-29 19:13:27
Your offset time is: 2024-09-29 19:13:27