Files |  Tutorials |  Articles |  Links |  Home |  Team |  Forum |  Wiki |  Impressum

Aktuelle Zeit: Do Mär 28, 2024 12:18

Foren-Übersicht » English » English Programming Forum
Unbeantwortete Themen | Aktive Themen



Ein neues Thema erstellen Auf das Thema antworten  [ 6 Beiträge ] 
Autor Nachricht
 Betreff des Beitrags: OpenGL and DirectX?
BeitragVerfasst: Sa Dez 25, 2010 16:11 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jul 21, 2004 22:39
Beiträge: 360
Wohnort: UK, Scotland
Is it possible to use both Direct X and OpenGL on the same window? I have been maintaining a game called Original War since 2005, but Altar (The developers) used Direct X. Id like to put a better menu system in Original War but id like to do it with OpenGL (As thats what im familure with) but moving the whole game over to OpenGL would take too long(Im not getting payed after all).

So im basically wondering if its possible to have DirectX draw on a window and then have OpenGL draw on top of that.

_________________
Free Map Editor - Game Requirements - Stucuk.Net
-Stu


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Re: OpenGL and DirectX?
BeitragVerfasst: Sa Dez 25, 2010 18:17 
Offline
DGL Member
Benutzeravatar

Registriert: Di Jul 01, 2003 18:59
Beiträge: 887
Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
Sounds like a bad idea.
OpenGL and DirectX use a different coordinate system, but that is the least of your problems.
Both use its own hardware accelerated context so you cannot make a few directx calls end mix them with opengl calls in the same window.
So your best guess is a wrapper that translates opengl commands to directx calls.
But ...
There are some wrappers to provide directx calls to opengl but no the other way around.
But there is the webgl project on google bringing an api to use opengles 2.0 calls on directx9:
http://code.google.com/p/angleproject/
Hope that may be of help.

_________________
http://3das.noeska.com - create adventure games without programming


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Re: OpenGL and DirectX?
BeitragVerfasst: Sa Dez 25, 2010 21:08 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jul 21, 2004 22:39
Beiträge: 360
Wohnort: UK, Scotland
I should have proberly been clearer. By window i meant the actual window rather than whats created with CreateWindow/CreateWindowEx. So DirectX "Window" as the parent with an OGL Child "Window".

With my limited research WS_EX_COMPOSITED and WS_EX_TRANSPARENT sound promising but they don't want to work with Original War(WS_EX_COMPOSITED makes Original War's Main CreateWindowEx fail).

Zitat:
Both use its own hardware accelerated context so you cannot make a few directx calls end mix them with opengl calls in the same window.

You can, though one overwrites the other so you get alot of flicker.

_________________
Free Map Editor - Game Requirements - Stucuk.Net
-Stu


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Re: OpenGL and DirectX?
BeitragVerfasst: Sa Dez 25, 2010 21:57 
Offline
DGL Member
Benutzeravatar

Registriert: Do Sep 02, 2004 19:42
Beiträge: 4158
Programmiersprache: FreePascal, C++
Stucuk hat geschrieben:
I should have proberly been clearer. By window i meant the actual window rather than whats created with CreateWindow/CreateWindowEx.

I do not really see a difference.

But you wont have any chance with composited/layered/transparent/whatever windows, they will all flicker above a hardware accelerated window. At least on WinXP they did, not sure whether the new window management in Vista/7 can handle that.

greetings

_________________
If you find any deadlinks, please send me a notification – Wenn du tote Links findest, sende mir eine Benachrichtigung.
current projects: ManiacLab; aioxmpp
zombofant networkmy photostream
„Writing code is like writing poetry“ - source unknown


„Give a man a fish, and you feed him for a day. Teach a man to fish and you feed him for a lifetime. “ ~ A Chinese Proverb


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Re: OpenGL and DirectX?
BeitragVerfasst: So Dez 26, 2010 10:44 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jul 21, 2004 22:39
Beiträge: 360
Wohnort: UK, Scotland
I guess i could just have two windows without any transparency and show/hide only one of the windows based on if the game is in a menu or the actual game section. Only negative is that the actual game bit's GUI couldn't use the OGL system.

_________________
Free Map Editor - Game Requirements - Stucuk.Net
-Stu


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags: Re: OpenGL and DirectX?
BeitragVerfasst: So Jan 09, 2011 10:17 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jul 21, 2004 22:39
Beiträge: 360
Wohnort: UK, Scotland
Is there any way to convert a 16bit buffer to 32bit and visa versa in a fast way? The following (Which i never wrote or understand) is too slow for real-time usage. I assume there is no fast way but im still hopeful.

Code:
procedure Copy16to32(Source,Dest:Pointer;WidthInPixels:Integer);stdcall;
asm
  pushad
  mov    esi,Source
  mov    edi,Dest
  mov    ecx,WidthInPixels
@dalsi:
  mov    ax,[esi]
  mov    bx,ax
  and    ax,$1F
  shl    ax,3
  or     ax,7
  shrd   edx,eax,8
  mov    ax,bx
  and    ax,$7E0
  shr    ax,3
  or     ax,3
  shrd   edx,eax,8
  mov    ax,bx
  and    ax,$F800
  shr    ax,8
  or     ax,7
  shrd   edx,eax,8
  shr    edx,8
  mov    [edi],edx
  add    esi,2
  add    edi,4
  dec    ecx
  jnz    @dalsi
  popad
end;

procedure Copy32to16;assembler;
asm
  pushad
  mov    esi,Source
  mov    edi,Dest
  mov    ecx,WidthInPixels
@dalsi:
  mov    eax,[esi]
  xor    edx,edx
  shrd   edx,eax,8
  shr    eax,2+8
  shrd   edx,eax,6
  shr    eax,3+6
  shrd   edx,eax,5
  shr    edx,16
  mov    [edi],dx
  add    esi,4
  add    edi,2
  dec    ecx
  jnz    @dalsi
  popad
end;

_________________
Free Map Editor - Game Requirements - Stucuk.Net
-Stu


Nach oben
 Profil  
Mit Zitat antworten  
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen Auf das Thema antworten  [ 6 Beiträge ] 
Foren-Übersicht » English » English Programming Forum


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 9 Gäste


Du darfst keine neuen Themen in diesem Forum erstellen.
Du darfst keine Antworten zu Themen in diesem Forum erstellen.
Du darfst deine Beiträge in diesem Forum nicht ändern.
Du darfst deine Beiträge in diesem Forum nicht löschen.
Du darfst keine Dateianhänge in diesem Forum erstellen.

Suche nach:
Gehe zu:  
cron
  Powered by phpBB® Forum Software © phpBB Group
Deutsche Übersetzung durch phpBB.de
[ Time : 0.063s | 17 Queries | GZIP : On ]