# OpenGL how to steal texture from directdraw application?

## Recommended Posts

just as GLIntercept steal texture from opengl application. thanks your attention.

##### Share on other sites
Write a proxy ddraw.dll file that intercepts all DirectDraw calls, then passes them off to the real ddraw.dll.
Or hook an application as it starts up.

Nitpick: There's no such thing as a texture in a DirectDraw application, just surfaces. A texture is a collection of surfaces, and only exists in D3D.

##### Share on other sites
Oor just use PrintScr.

##### Share on other sites
thanks Evil Steve .
do as you tell me ,i can capture screen.
but can i get the image resource?

##### Share on other sites
Quote:
 Original post by zzz822163thanks Evil Steve .do as you tell me ,i can capture screen.but can i get the image resource?
Well, you'll be able to accept all calls to DDraw, so when you get a surface unlock call you can just read the contents of the surface.

However, remember that there's about 5 different DirectDraw versions; you'll need to support all of them if you want your DLL to work for all apps that use DirectDraw.

##### Share on other sites
to Evil Steve
read the contents of the surface after surface unlock call,i can get screen,
but i cannot get the image resource.
i want to get the bitmap the application load.

##### Share on other sites
Quote:
 Original post by zzz822163i want to get the bitmap the application load.
Long answer: How do you know it's a bitmap that the application is loading and not a code-generated resource, or some other file format?
Assuming it is actually an image in a file of some sort, the code will load the file, decompress / decrypt it, then create a DirectDraw surface and copy the bits in. That means that there doesn't have to be a source file for the image.

##### Share on other sites
This sort of code is very low level, and you will have no knowledge of where the image came from. It could come from a local file, over the web or be noise generated from a microphone.

If you're wanting to intercept calls to DirectDraw and work it back to which bitmap the game/application originally loaded the data from you're out of luck.

However, if you're wanting to save the data to a disk so that you can load it up in a graphics program you follow Steve's advice and simply write the data to a file yourself. The bitmap format is easy enough to follow and documented in numerous places online. Try wotsit.org.

hth
Jack

EDIT: Too slow!

##### Share on other sites
I am appreciated for your Enthusiastic help .
In fact,i want to replace the picture in the game.
Is this an impossible mission?

##### Share on other sites
Quote:
 Original post by zzz822163I am appreciated for your Enthusiastic help .In fact,i want to replace the picture in the game.Is this an impossible mission?
If you want to replace it, then you don't need to know where it came from. When the application locks the surface and puts data into it, you can just put your own data in. The application presumably creates the resources in the same order each time it runs, and if it doesn't you can always check the bit data going in to see if it's the one you want to replace.

##### Share on other sites
When the application locks the surface and puts data into it, you can just put your own data in.

Well,I just don't know how to check the bit data if it's the one i want to replace on the surface ,because there is lots of bit data .
I only want to replace some content of the surface,not all content.

##### Share on other sites
Should I use Image Recognition?
But I am worried it waste too much time.

##### Share on other sites
Quote:
 Original post by zzz822163Well,I just don't know how to check the bit data if it's the one i want to replace on the surface ,because there is lots of bit data .I only want to replace some content of the surface,not all content.
There's two steps:
1. Recognise that this is the surface you're interested in
2. Replace the data you need

First, you'll want to save the surface to a BMP file every time it's Unlock()ed, and then you can see what surface you need, and what it looks like after it's been unlocked.

You now know the dimensions and the bit data of the surface you're interested in, so your code can ignore any surfaces that aren't the correct dimensions (At Lock() to save you buffering the data to check in Unlock()).
Then, each time a surface of the correct size is Unlock()ed, you can check the surface bit data to see if it's what you're looking for. You can probably get away with only checking some parts of the surface, I doubt you'll have to check the whole thing.

Once you've identified that this is the surface you want to update, you can update it in your proxy Unlock() function and then call the real DDraw surface Unlock() function.

##### Share on other sites
Yes,you give me a good advice.
I will try it next week.
Thanks.

## Create an account

Register a new account

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627675
• Total Posts
2978570
• ### Similar Content

• Both functions are available since 3.0, and I'm currently using glMapBuffer(), which works fine.
But, I was wondering if anyone has experienced advantage in using glMapBufferRange(), which allows to specify the range of the mapped buffer. Could this be only a safety measure or does it improve performance?
Note: I'm not asking about glBufferSubData()/glBufferData. Those two are irrelevant in this case.
• By xhcao
Before using void glBindImageTexture(    GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format), does need to make sure that texture is completeness.
• By cebugdev
hi guys,
are there any books, link online or any other resources that discusses on how to build special effects such as magic, lightning, etc. in OpenGL? i mean, yeah most of them are using particles but im looking for resources specifically on how to manipulate the particles to look like an effect that can be use for games,. i did fire particle before, and I want to learn how to do the other 'magic' as well.
Like are there one book or link(cant find in google) that atleast featured how to make different particle effects in OpenGL (or DirectX)? If there is no one stop shop for it, maybe ill just look for some tips on how to make a particle engine that is flexible enough to enable me to design different effects/magic
let me know if you guys have recommendations.
• By dud3
How do we rotate the camera around x axis 360 degrees, without having the strange effect as in my video below?
Mine behaves exactly the same way spherical coordinates would, I'm using euler angles.
Tried googling, but couldn't find a proper answer, guessing I don't know what exactly to google for, googled 'rotate 360 around x axis', got no proper answers.

References:
Code: https://pastebin.com/Hcshj3FQ
The video shows the difference between blender and my rotation:

• By Defend
I've had a Google around for this but haven't yet found some solid advice. There is a lot of "it depends", but I'm not sure on what.
My question is what's a good rule of thumb to follow when it comes to creating/using VBOs & VAOs? As in, when should I use multiple or when should I not? My understanding so far is that if I need a new VBO, then I need a new VAO. So when it comes to rendering multiple objects I can either:
* make lots of VAO/VBO pairs and flip through them to render different objects, or
* make one big VBO and jump around its memory to render different objects.
I also understand that if I need to render objects with different vertex attributes, then a new VAO is necessary in this case.
If that "it depends" really is quite variable, what's best for a beginner with OpenGL, assuming that better approaches can be learnt later with better understanding?

• 11
• 11
• 10
• 12
• 22