Jump to page: 1 2
Thread overview
directx with d
Feb 07, 2008
ElfQT
Feb 07, 2008
Vladimir Panteleev
Feb 07, 2008
ElfQT
Feb 07, 2008
Clay Smith
Feb 07, 2008
Extrawurst
Feb 07, 2008
ElfQT
Feb 07, 2008
ElfQT
Feb 10, 2008
ElfQT
Mar 01, 2008
ElfQT
Mar 01, 2008
torhu
Mar 01, 2008
torhu
Mar 01, 2008
ElfQT
February 07, 2008
I have ported some directx tutorial back in 2005... This time I play around again with directx and also with tango. But I have a problem even with the old directx code of mine - which of course worked on the old dmd compiler. Right now the compiler and tango verisons are: tango-0.99.4-bin-win32-dmd.1.024.zip

Bit of a help would be appreciated, the attached code should display a triangle.

http://tmtinformatika.hu/_Others/Marton/dx_vertices.zip

Contact me at elf_qt@_deletethis_yahoo.com

ElfQT


February 07, 2008
On Thu, 07 Feb 2008 17:16:04 +0200, ElfQT <elf_qt@_deletethis_yahoo.com> wrote:

> I have ported some directx tutorial back in 2005... This time I play around again with directx and also with tango. But I have a problem even with the old directx code of mine - which of course worked on the old dmd compiler. Right now the compiler and tango verisons are: tango-0.99.4-bin-win32-dmd.1.024.zip
>
> Bit of a help would be appreciated, the attached code should display a triangle.
>
> http://tmtinformatika.hu/_Others/Marton/dx_vertices.zip
>
> Contact me at elf_qt@_deletethis_yahoo.com
>
> ElfQT

Have you seen the Win32 API bindings project? They seem to have ported some or all of the DirectX headers: http://www.dsource.org/projects/bindings/wiki/WindowsApi

Also, check out this in-progress 3D game engine written in D: http://www.yage3d.net/

-- 
Best regards,
 Vladimir                          mailto:thecybershadow@gmail.com
February 07, 2008
Vladimir Panteleev Wrote:

> On Thu, 07 Feb 2008 17:16:04 +0200, ElfQT <elf_qt@_deletethis_yahoo.com> wrote:
> 
> > I have ported some directx tutorial back in 2005... This time I play around again with directx and also with tango. But I have a problem even with the old directx code of mine - which of course worked on the old dmd compiler. Right now the compiler and tango verisons are: tango-0.99.4-bin-win32-dmd.1.024.zip
> >
> > Bit of a help would be appreciated, the attached code should display a triangle.
> >
> > http://tmtinformatika.hu/_Others/Marton/dx_vertices.zip
> >
> > Contact me at elf_qt@_deletethis_yahoo.com
> >
> > ElfQT
> 
> Have you seen the Win32 API bindings project? They seem to have ported some or all of the DirectX headers: http://www.dsource.org/projects/bindings/wiki/WindowsApi
> 
> Also, check out this in-progress 3D game engine written in D: http://www.yage3d.net/
> 
> -- 
> Best regards,
>  Vladimir                          mailto:thecybershadow@gmail.com

Yep, I am aware of the bindings, also I use them in newer code - in the attached code I tried to use a minimal version, and also a simple one which worked well with dmd back in 2005.

Thanks for the link to Yage. Unfortunately Yage uses openGL.

ElfQT
February 07, 2008
i tried your attached app and it works for me with dmd2.010 i just changed the depencies to get it working with phobos, cause i dont use tango.


ElfQT schrieb:
> I have ported some directx tutorial back in 2005... This time I play around again with directx and also with tango.
> But I have a problem even with the old directx code of mine - which of course worked on the old dmd compiler.
> Right now the compiler and tango verisons are: tango-0.99.4-bin-win32-dmd.1.024.zip
>
> Bit of a help would be appreciated, the attached code should display a triangle.
>
> http://tmtinformatika.hu/_Others/Marton/dx_vertices.zip
>
> Contact me at elf_qt@_deletethis_yahoo.com
>
> ElfQT
>
>
>   
February 07, 2008
ElfQT wrote:
> Vladimir Panteleev Wrote:
> 
>> On Thu, 07 Feb 2008 17:16:04 +0200, ElfQT <elf_qt@_deletethis_yahoo.com> wrote:
>>
>>> I have ported some directx tutorial back in 2005... This time I play around again with directx and also with tango.
>>> But I have a problem even with the old directx code of mine - which of course worked on the old dmd compiler.
>>> Right now the compiler and tango verisons are: tango-0.99.4-bin-win32-dmd.1.024.zip
>>>
>>> Bit of a help would be appreciated, the attached code should display a triangle.
>>>
>>> http://tmtinformatika.hu/_Others/Marton/dx_vertices.zip
>>>
>>> Contact me at elf_qt@_deletethis_yahoo.com
>>>
>>> ElfQT
>> Have you seen the Win32 API bindings project? They seem to have ported some or all of the DirectX headers:
>> http://www.dsource.org/projects/bindings/wiki/WindowsApi
>>
>> Also, check out this in-progress 3D game engine written in D:
>> http://www.yage3d.net/
>>
>> -- 
>> Best regards,
>>  Vladimir                          mailto:thecybershadow@gmail.com
> 
> Yep, I am aware of the bindings, also I use them in newer code - in the attached code I tried to use a minimal version, and also a simple one which worked well with dmd back in 2005.
> 
> Thanks for the link to Yage. Unfortunately Yage uses openGL.
> 
> ElfQT

He probably meant this link www.dsource.org/projects/nonagon
February 07, 2008
Extrawurst Wrote:

> i tried your attached app and it works for me with dmd2.010 i just changed the depencies to get it working with phobos, cause i dont use tango.
> 
> 
> ElfQT schrieb:
> > I have ported some directx tutorial back in 2005... This time I play around again with directx and also with tango. But I have a problem even with the old directx code of mine - which of course worked on the old dmd compiler. Right now the compiler and tango verisons are: tango-0.99.4-bin-win32-dmd.1.024.zip
> >
> > Bit of a help would be appreciated, the attached code should display a triangle.
> >
> > http://tmtinformatika.hu/_Others/Marton/dx_vertices.zip
> >
> > Contact me at elf_qt@_deletethis_yahoo.com
> >
> > ElfQT
> >
> >
> > 

Well, by working you mean you see the triangle (instead of the simple backgroud)?
I'll try that with phobos, also with dmd2.010, if that difference causes this then there is an interesting bug somewhere...

Thanks,
 ElfQT
February 07, 2008
ElfQT Wrote:

> Extrawurst Wrote:
> 
> > i tried your attached app and it works for me with dmd2.010 i just changed the depencies to get it working with phobos, cause i dont use tango.
> > 
> > 
> > ElfQT schrieb:
> > > I have ported some directx tutorial back in 2005... This time I play around again with directx and also with tango. But I have a problem even with the old directx code of mine - which of course worked on the old dmd compiler. Right now the compiler and tango verisons are: tango-0.99.4-bin-win32-dmd.1.024.zip
> > >
> > > Bit of a help would be appreciated, the attached code should display a triangle.
> > >
> > > http://tmtinformatika.hu/_Others/Marton/dx_vertices.zip
> > >
> > > Contact me at elf_qt@_deletethis_yahoo.com
> > >
> > > ElfQT
> > >
> > >
> > > 
> 
> Well, by working you mean you see the triangle (instead of the simple backgroud)?
> I'll try that with phobos, also with dmd2.010, if that difference causes this then there is an interesting bug somewhere...
> 
> Thanks,
>  ElfQT

Whoa I see this is what happening. It works with dmdv1.026 and phobos. I am investigating this issue, right now I suspect tango - somebody from there please lend me a hand.
February 10, 2008
There is a problem - difference - between dmdc1.0124 AND default phobos versus "tango-0.99.4-bin-win32-dmd.1.024".

See the code below:

// A structure for our custom vertex type
struct CUSTOMVERTEX
{
    FLOAT x, y, z, rhw; // The transformed position for the vertex
    DWORD color;        // The vertex color
};

// Initialize three vertices for rendering a triangle
static CUSTOMVERTEX[3] vertices =
[
	{ 150.0f,  50.0f, 0.5f, 1.0f, 0xffff0000, }, // x, y, z, rhw, color
	{ 250.0f, 250.0f, 0.5f, 1.0f, 0xff00ff00, },
	{  50.0f, 250.0f, 0.5f, 1.0f, 0xff00ffff, },
];

int a = vertices.sizeof;

a is 120 with phobos, 60 with tango.


Some related question: is it possible for tango and phobos to live side by side, also edit and debug side by side? (Something like an automated test that is capable to compare phobos vs tango build?) It isn't simple to find a difference like this one.

Or is this difference intentional to begin with?

ElfQT

February 10, 2008
"ElfQT" <elf_qt@_deletethis_yahoo.com> wrote in message news:fols9e$19u0$1@digitalmars.com...
> There is a problem - difference - between dmdc1.0124 AND default phobos versus "tango-0.99.4-bin-win32-dmd.1.024".
>
> See the code below:
>
> // A structure for our custom vertex type
> struct CUSTOMVERTEX
> {
>    FLOAT x, y, z, rhw; // The transformed position for the vertex
>    DWORD color;        // The vertex color
> };
>
> // Initialize three vertices for rendering a triangle
> static CUSTOMVERTEX[3] vertices =
> [
> { 150.0f,  50.0f, 0.5f, 1.0f, 0xffff0000, }, // x, y, z, rhw, color
> { 250.0f, 250.0f, 0.5f, 1.0f, 0xff00ff00, },
> {  50.0f, 250.0f, 0.5f, 1.0f, 0xff00ffff, },
> ];
>
> int a = vertices.sizeof;
>
> a is 120 with phobos, 60 with tango.

I don't see why the size would differ based on the standard library, that's really odd.  The library should have no effect on this code.  Regardless, you should put align(1) on the CUSTOMVERTEX struct declaration, which SHOULD make it 60 in both.

> Some related question: is it possible for tango and phobos to live side by side, also edit and debug side by side? (Something like an automated test that is capable to compare phobos vs tango build?) It isn't simple to find a difference like this one.
>
> Or is this difference intentional to begin with?

I'm not sure why you'd want to.  There's tangobos which is an implementation of phobos in Tango, but you should really either target one, or if you really must, use "version(Tango) { ... } else { ... }" statements.


March 01, 2008
ElfQT Wrote:

Finally I have found the time to investigate this issue. And the winner is...

Same code will follow with phobos then with tango:

//phobos
import std.c.windows.windows;

struct CUSTOMVERTEX { FLOAT x; };
static CUSTOMVERTEX[3] vertices = [ { 150.0f } ];

void main() { printf ("%d",vertices.sizeof); }

Prints 12.

//tango
import tango.sys.win32.Types;
import tango.stdc.stdio;

struct CUSTOMVERTEX { FLOAT x; };
static CUSTOMVERTEX[3] vertices = [ { 150.0f } ];
void main() { printf ("%d",vertices.sizeof); }

Prints 24.

The difference lies:

Phobos, \dmd\src\phobos\std\c\windows\windows.d:
alias float FLOAT;

Tango, D:\D\import\tango\sys\win32\Types.di:
alias double FLOAT;

(Before you ask, I use type FLOAT - uppercase - because I copy some directx code, which already uses that.) With directx on win32, the phobos approach is working, Tango FLOAT produces errors.

Is this intended in Tango? Is there already code requiring FLOAT to be double?

The problem in the original post is disappears (and the directx triangle appears), if I use float instead of FLOAT (so double in Tango).

ElfQT

> ElfQT Wrote:
> 
> > Extrawurst Wrote:
> > 
> > > i tried your attached app and it works for me with dmd2.010 i just changed the depencies to get it working with phobos, cause i dont use tango.
> > > 
> > > 
> > > ElfQT schrieb:
> > > > I have ported some directx tutorial back in 2005... This time I play around again with directx and also with tango. But I have a problem even with the old directx code of mine - which of course worked on the old dmd compiler. Right now the compiler and tango verisons are: tango-0.99.4-bin-win32-dmd.1.024.zip
> > > >
> > > > Bit of a help would be appreciated, the attached code should display a triangle.
> > > >
> > > > http://tmtinformatika.hu/_Others/Marton/dx_vertices.zip
> > > >
> > > > Contact me at elf_qt@_deletethis_yahoo.com
> > > >
> > > > ElfQT
> > > >
> > > >
> > > > 
> > 
> > Well, by working you mean you see the triangle (instead of the simple backgroud)?
> > I'll try that with phobos, also with dmd2.010, if that difference causes this then there is an interesting bug somewhere...
> > 
> > Thanks,
> >  ElfQT
> 
> Whoa I see this is what happening. It works with dmdv1.026 and phobos. I am investigating this issue, right now I suspect tango - somebody from there please lend me a hand.

« First   ‹ Prev
1 2