PDA

View Full Version : [D3D] possibilities and techniques concerning 2d



chronozphere
31-03-2006, 06:48 AM
Hi. 8)

I am wondering what the possibilities of Direct3d are concerning 2d. Is it possible to do the following:

A: :?: Load a texture from a stream or memory location??

B: :?: Reading an Writing pixels, from a texture or the whole screen(backbuffer).

C: :?: Using GDI functions like line/rectangle/ellipse, on Textures or the whole screen.

D: :?: Blitting Textures on Textures.

E: :?: Using multiple textures for a single polygon.
I mean that every vertex can contain a texture
and its coordinates, so that they are blended in
the middle of the polygon. (just like what is
done with colors, in those basic d3d tut's).

And... Is it worthwile to program some resource preparing routines. :razz:

For example, when a texture must be able to rotate in the game, is it worthwile to create a routine that copies the texture about 36 times and increase the angle for each of them with 10 degrees.
And when the texture must be drawn, just calculate the image index and draw the appropriate image.

Since Direct3d can transform objects very fast, i am not sure if this is neccesary. Can i gain some extra speed with this method??

Thanx in advance :D

JSoftware
31-03-2006, 07:57 AM
I think the answer is yes to most of your questions.
As far as I know d3d is able to lock the pixels of a texture and have direct access to the texture pixels.

As far as blitting to the texture i don't think it's very much worth it. there are probably better ways as altering textures on the fly generally is very slow.

Multiple textures per polygon is called multitexturing 8)

About rotating textures you are able to alter the texture coordinates so that the texture will be rotated on the polygon itself. This is much faster and better memorywise as you only have to store the texture once

chronozphere
31-03-2006, 11:09 AM
Hi JSoftware..

Thanx for you answer. :razz:
i did some research and i've found some info on MSDN about surface locking and GDI drawing on textures. :lol:



As far as blitting to the texture i don't think it's very much worth it. there are probably better ways as altering textures on the fly generally is very slow.


What is "texture altering"?? :?

I still dont know how multitexturing is done. I need some info about how to assign different textures to a different vertices and e.g make a gradient with a dirt texture and a water texture. :)

I couldn't find any of the above discirbed tutorials or examples so far.
A good expanation of multitexturing would be highly appriciated. ;)

Traveler
31-03-2006, 12:55 PM
I think you misunderstood JSoftware. "texture altering" is not a function or anything.

Is Direct3d a requirement or is Opengl optional for you as well? It tends to be a bit easier and to my knowlegde the availabillity of tutorials and other related information is bigger for opengl.

There are in fact numerous samples available for multitexturing in opengl. here (http://www.delphigl.de/eng_index.html) and here (http://www.delphi3d.net/) for example

chronozphere
31-03-2006, 04:45 PM
I think you misunderstood JSoftware. "texture altering" is not a function or anything.


Okay i looked it up.. and now i understand.

I use Direct3d because i know it a lot better than OpenGL. I've tried GLScene a few months ago but it didn't work well. When i dropped the Camera object on the form, the following error occured:

"Need at least openGL 1.1".

This happens on both of my computers :cry: I have downloaded and installed a version op OGL 1.1 (a small zip with some DLL's and a few C++ headers) but it didn't work. Anyone knows a solution??

Still don't know anything about multitexturing.
If you do.. please let me know.
:P

tux
31-03-2006, 05:45 PM
upgrade your graphics drivers

chronozphere
31-03-2006, 06:40 PM
I tried to reinstall GLScene but the following happened:

File not found 'PlugInIntf.dcu'.

I dont know this file, and couldn't find it.
Can anyone help me?? :cry:

tpascal
31-03-2006, 08:25 PM
I have learn a lot from this tutorials collection:


http://externalweb.exhedra.com/DirectX4VB/TUT_DX8_DG.asp

It is in VB but the directx command/functions and parameters are the same for any lenguage programming. It is focused in directx 8.1, so be sure your videocard supports that.

Tutorial About multi-texturing:

http://externalweb.exhedra.com/DirectX4VB/Tutorials/DirectX8/GR_Lesson12.asp


good luck.

tp.

chronozphere
31-03-2006, 08:46 PM
thank you VERY much. :D :D

This site is full of interesting D3D information.
I've got something to do this weekend. :read: :lol:

I have two PC's. My own only hardware-supports DX7 but i think i can still use most of the info. ;)

Edit: i must realy stop including 'Delphi' in my google searches to new DX info.

cronodragon
13-10-2006, 04:04 AM
I started reading the tutorial about gaining access to texture memory, and they use this function I couldn't find in DX9:

DXCopyMemory

Is there an equivalent in DX9?? :?

jdarling
13-10-2006, 01:10 PM
All 2D stuff went away in DX9. So you have to use meshes and vertext shaders along with other 3D tricks to get a 2D environment. I hate to say it, but you would get more support on GameDev.net in the 2D forums when it comes to DirectX then you will here. Very few people here understand the under the hood aspects of DirectX and what they have changed in 9 and 10 (I'm not one of them).

Your problem with OpenGL 1.1 was not a GLScene issue, its a driver issue on your PC. You have an outdated old version of OpenGL installed. The question has been answered about 1000 times on the GLScene NG and FAQ, as well as many writeups about the "Fix". GLScene requires at least OpenGL 1.1 or above due to shaders and graphics card specific optimizations that Eric has taken the time to put in place. Same as a DirectX 9 application won't run on DirectX 8 (if its developed properly according to M$).

- Jeremy

cronodragon
13-10-2006, 02:31 PM
Thanks! Well, anyway I made workaround for dynamical image processing of textures... I'm using TBitmap and streams, haven't found anyone else using this. It's fun I have a bunch of routines I made last century in Turbo Pascal, and are still valid for image processing in DX9. I have fast line procedures, fast curves, and even filter algorithms using matrices (blur, etc). If someone wants those TP units just ask me, those are my open source contribution.