C++ Help Needed - Direct X Rendering FVF Vertex Buffers Shaders External Texture Managment

Joe Ellis

Member
Hi, I'm currently working on a project to do with replacing some of the d3d rendering functions, such as vertex_submit, using shaders, and external texture management through a dll

If anyone wants to help it would be much appreciated, I can even pay you (around £200) to complete what I've already got, and will share the full source code with you

So far I can render 1 piece of geometry through a dll, with 1 texture, but I need to be able to render as many as I want, I dont have much experience in C++ thats why I need some help
so far I only have Pos_3d and Tex_coord as the attributes and I need to be able to render with other FVF formats, such as Colors and Normals
And also make my functions compatible with using shaders

ps. using directx9 sdk

Things I have so far in the dll:

External texture loader which loads a texture from file

Functions:

d3dx_create_vertex_buffer

d3dx_set_anisotropy

d3dx_texture_load

d3dx_texture_set

d3dx_draw()

With these functions you can only make 1 vertex buffer and 1 texture at a time and I need help coding it so you can assign any buffer or texture to any GM variable/pointer and then use d3dx_draw(vbuff,tex)

If you cant do everything, any advice or help will be appreciated!
 
Last edited:

Joe Ellis

Member
*Bump* does anyone know anything about this that could point me in the right direction?

I basically need to be able to load a texture from a file, get its memory address and use this address/pointer when using vertex_submit(vbuff,prim,Texture address pointer)

I know Gm can do it anyway using file_find and sprite_get_texture but something goes wrong when these external textures have anisotropic filtering applied to them, the filtering just doesnt work, but it does when you load them through an extension

so I need a thing that replaces sprite_add
and sprite_get_ texture

I already have it working with 1 texture at a time, but I need to be able to load as many as I want
 

Joe Ellis

Member
Aw cheers, I bought that a while ago and might have overlooked vertex and texture fetching cus it wasnt a problem I was aware of then, I'll have another look and see if it fixes the problem, even if it doesnt hopefully I can learn how to do it from the source code, Thanks

Have you managed to tackle this problem?
 
Last edited:

Joe Ellis

Member
Hmm, it still doesnt solve the problem but I think if I merged the code I've got into it it might work

Do you mind if you have a look at the code I've got?
 

Mike

nobody important
GMC Elder
Im curious why you need to? vertex buffers (when frozen) will be as quick as anyone else can do it, and when combined with a shader, you can do pretty much anything - at speed. so why move into a language your not good with to do something GMS will do just as well.?

You can also use external texture management and still use the built in prim stuff, especially if you use 2nd texture slots etc.
 

Joe Ellis

Member
I'm moving into a language I'm not good with to do something that GMS can't do, never mind just as well, it can't do it. End of story.

Why don't you know that? Have you ever tried to use a texture from file with anisotropic filtering?

Either way, I don't understand what your struggling with, I've already fully explained everything that goes wrong on other threads that you've read.

If you set something's texture with an image created after compile, anisotropic filtering doesn't work on it.

It still works with any images in the resource tree but surfaces and externally loaded textures, as they are created after compile, it doesn't.

I'm fully aware of how fast shaders & vertex buffers are. Thats why I use them all the time. It's Fun!

Are you saying a shader can do anisotropic filtering?

I'm curious as to how you would achieve this?

Normally its calculated on the graphics card itself which has built in processors specifically designed for it.

So if it was possible to program a similar process in a shader I would first have to learn about all the algorithms and texture probing involved in anisotropic filtering, then learn how to implement them into a shader, whilst being restricted in the fact that I can only use 8 textures for the mip maps and then be left with none for multitexturing, while wasting the graphics card's built in processors which I could be making good use of and saving memory for other tasks that are not automatic graphics card processes. It seems more logical to pay someone to make a dll that loads the textures in a way that doesnt mess up the filtering. Don't you think?
 

Mike

nobody important
GMC Elder
No, I'm saying that if you use a DLL to load a texture and set whatever filtering you want for it, you can then set this as a second texture and use this in a shader instead of the 1st (normal) texture. GMS does not set/clear the second (or 3rd...4th..whatever) textures. So your extension could set this and GMS could use it.

This means all you have to write is texture load/set/free in an extension, then use GMS for everything else.

Also... take a look at this... https://marketplace.yoyogames.com/assets/1424/advanced-3d-texture-filtering

It may help.
 

Joe Ellis

Member
Oh right, so your saying the gm_basetexture thing will want it to be a normal texture not an externally loaded one? And if I set it as a second texture the filtering will work? Otherwise what do you mean by loading it as a second texture? What difference will it make?

Yeah I bought that extension in the first place thats how I found out the filtering doesn't work on external texures, its a notorious problem with that extension that loads of people have asked about.

And with writing the texture load/set/free, this is what I was planning on doing, I didn't want to change any of the actual rendering functions. The guy who did the extension for me so far did all that. Then he quit for some reason.

I've got someone else doing it now so I'll tell him what you've said and it might help him.
 

Joe Ellis

Member
No, I'm saying that if you use a DLL to load a texture and set whatever filtering you want for it, you can then set this as a second texture and use this in a shader instead of the 1st (normal) texture. GMS does not set/clear the second (or 3rd...4th..whatever) textures. So your extension could set this and GMS could use it.

This means all you have to write is texture load/set/free in an extension, then use GMS for everything else.

Also... take a look at this... https://marketplace.yoyogames.com/assets/1424/advanced-3d-texture-filtering

It may help.
Thanks Mike, the guy got it working for me, and used your advice about setting other textures in the shader woooo!
 
Top