News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

d3d9 examples

Started by gabor, September 06, 2007, 11:26:05 PM

Previous topic - Next topic

gabor

Hello friends!

About 3 month ago I turned to DDraw (DirectX 7 :red) and 2 weeks ago I decided to get familiar with a bit mor e uptodate DX version. Thus I arriced at DX9 and D3D...

Studying the D3D sections of the DX9 SDK and getting some tutorials, samples from the Internet resulted in the attached zipped package.
The zip contains the subdirs:
  data - holds bitmaps used by examples
  include - include files and the d3dmatrix project files

  EmptyProject - 1st step, creating the d3d device
  Rectangle - 2nd step, creating 2 triangles to compose a rectangle
  Textured - 3rd step, creating and applying a bitmap as a texture
  Rotation - 4th step, using matrices for 3D transformations,creating a 3D cube
Added
  Lights - 5th step, adding lights (ambient, diffuse, point) to the scene
  Sprites - creating many sprites using the d3dsprites.lib I created.
  Camera and Sprites - setting up a quaternion based camera and using a sprite as mouse pointer

Every project has a small feature list at the very beginning of the main asm file.
I plan to extend these examples later in 2 directions:
- 2D sprite handling
   - drawing sprites on other sprites (changable renderTarget feature)
   - collision detection
   - timeline based animation
- world of 3D
   - improvement of the d3dmath lib
   - transparent objects
   - importing models
   - creating and moving many 3D objects
   - landscape
   and many more...

Please feel free to look, criticize or use these sources. And also please report bugs, problems or any questions you might get.

2007.10.12: You can get the new version here: members.chello.hu/nemeth.gabor1/directx. It won't fit here gue to the 256 kB size limit (it is quite small  I have to add) :(


Greets, Gábor

hutch--

Compliments Gabor, the demos run well and look fine.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Mark Jones

Indeed, congratulations! Nice work. :U
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

Vortex

Hi Gabor,

Very nice work :U

gabor

Hi!

I updated the projects and uploaded them onto a server: http://members.chello.hu/nemeth.gabor1/directx.
I'm still constructing the site, but the sources are already available.
I also updated the thread starting post so that it shows the last state of my directx experiment-development.

Greets, Gábor

ToutEnMasm

Hello,
Good job,yes,but ...... :dazzled: :(
for lights,rotation crash
sprites do nothing
I haven't search which libraries you load,but,"invoke winmain" isn't the good way to used libcmt.
Libcmt need to recognize the name WinMain,or other one,and it's proper call.Msvcrt works in the same manner for the call.
modify this,it seem needed



gabor

Hi ToutEnMasm!

Please help me to identify the reasons for the crashes!
Did you extract all the files, the data directory as well?
These examples need the images stored in that directory. I didn't code a proper error handling, that could cause the crash.
What kind of hardware are you trying to run the examples?
My last question: Did you recompile them or the executables included in the zip are causing the problems?

To others I' like to say, please test the apps and help me to find bugs!

Greets, Gábor

GregL

Gabor,

Nothing crashes. I did not re-assemble them.

1. EmptyProject - matches your screen shot.
2. Rectangle - matches your screen shot.
3. Textured - screen is black.
4. Rotation - matches your screen shot.
5. Lights - matches your screen shot.
6. Sprites - screen is black.
7. Camera and Sprite - matches your screen shot.

Pentium D 940, Intel GMA 3000 video, Windows Vista Home Premium.

ToutEnMasm


Tried to run after unpack,no crash but nothing to view,size 10,10,10,10 ? for rotation ?.
I have Read a little,the code.

Bad loop,when using WM_CREATE and others messages,you must return the value needed .
Read winhelp for that.
rc are empty,don't hurt to put a defaut icon in it

ragdog

hi

i learning and create a directx app and uses Siekmanski d3d includes my problem is with
D3DXCreateTextureFromFileExA to load my image file
how can i show the image (png) with this includes


Begin
Draw
End

greets
ragdog

Siekmanski

Hello Ragdog

This is how you can do it:

   invoke   D3DXCreateTextureFromFileExA,g_pD3DDevice,TEXT_("picture.png"),D3DX_DEFAULT,D3DX_DEFAULT,D3DX_DEFAULT,0,D3DFMT_UNKNOWN,D3DPOOL_DEFAULT,D3DX_DEFAULT,D3DX_DEFAULT,0,NULL,NULL,addr g_pTexture1

included an example

Siekmanski

[attachment deleted by admin]

ragdog

thanks for your repley :U
i have this example allready and draw textures proplem hav it solved

I do  have another problem with mine drawtext function I get not into my project

greets
ragdog

Siekmanski

Hello ragdog

Microsoft did change the ID3DXFont interface since version 32 ( don't know about next versions ??? )
You can find it in "d3dx9core.inc"


IF D3D_SDK_VERSION eq 31
IID_ID3DXFont    TEXTEQU <{00b8d1536h,09eech,049b0h,{0a5h,0adh,093h,0cfh,063h,0afh,0b7h,0c6h}}>
ELSE
IID_ID3DXFont    TEXTEQU <{0d79dbb70h,05f21h,04d36h,{0bbh,0c2h,0ffh,052h,05ch,021h,03ch,0dch}}>
ENDIF

_vtID3DXFont MACRO CastName:REQ
_vtIUnknown CastName
&CastName&_GetDevice    comethod2 ?
&CastName&_GetDescA    comethod2 ?
&CastName&_GetDescW    comethod2 ?
IF D3D_SDK_VERSION eq 32
&CastName&_GetTextMetricsA    comethod2 ?
&CastName&_GetTextMetricsW    comethod2 ?
ENDIF
&CastName&_GetDC    comethod1 ?
&CastName&_GetGlyphData    comethod5 ?
&CastName&_PreloadCharacters    comethod3 ?
&CastName&_PreloadGlyphs    comethod3 ?
&CastName&_PreloadTextA    comethod3 ?
&CastName&_PreloadTextW    comethod3 ?
&CastName&_DrawTextA    comethod7 ?
&CastName&_DrawTextW    comethod7 ?
&CastName&_OnLostDevice    comethod1 ?
&CastName&_OnResetDevice    comethod1 ?
&CastName&_GetDesc    comethod2 ?
&CastName&_PreloadText    comethod3 ?
ENDM

ID3DXFont struct
_vtID3DXFont    ID3DXFont
ID3DXFont ends

LPD3DXFONT    typedef PTR DWORD


Greetings Siekmanski

ragdog

I have this includes from you d3d071012.zip

here is my source http://www.masm32.com/board/index.php?topic=8119.msg59305#msg59305

with drawtext problem

thanks

ragdog

gabor

Hey!

I got terrified  :dazzled: seeing how long I haven't touched this topic. I hope to be able to get back and make some significant steps.
To those who were keen on seeing my newer achievements or simply would like to know about my progress I say wait just a few weeks more!

Greets
Gábor