• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

SOLVED Surface_get_texture or sprite_get_texture() what is its format? Opengl or DirectX or Is it specific to GameMaker?

mbeytekin

Member
I wonder what format the pointer and content we got with surface_get_texture. I think it is in openGL format since we can send it directly to shaders. The reason I'm asking this is that I can't get the result I want when I send it as a pointer to the options to get directx texture or OpenGL texture in the DLLs I use. That's why it's important to me.
 

Binsk

Member
I've been wondering this for a long time and never got an answer. My experience in this area isn't good enough to be able to experiment and find an answer so if you figure it out, I'm anxious to know.

My complete guess is that Windows would use DX while Mac / Linux is OpenGL because, as you said, it would match the shader type for the platform (note: GLSL/ES gets converted for the Windows platform, it doesn't actually use OpenGL).
 

mbeytekin

Member
Thank you for your answer.
I tried to copy textures in all sorts of ways to a C ++ DLL that accepts opengl texture for a whole weekend. As a result, I understood that the pointer that surface get texture gives us is raw data that does not contain information about the image it contains. So I couldn't get any results unless I copied the surface to buffer and processed the buffer's pointer with opengl's texture rendering functions. As a result, I guess these textures are not a texture pointer that opengl can handle directly, even if they are in a format like GLSL / ES as you said.
 

Juju

Member
It's a pointer to a struct that GameMaker uses internally. I don't know the precise details, but the struct will contain e.g. UVs, image width/height, the actual graphics API texture pointer etc.
 
Top