DGL https://delphigl.com/forum/ |
|
OpenGL and DirectX? https://delphigl.com/forum/viewtopic.php?f=19&t=9663 |
Seite 1 von 1 |
Autor: | Stucuk [ Sa Dez 25, 2010 16:11 ] |
Betreff des Beitrags: | OpenGL and DirectX? |
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. |
Autor: | noeska [ Sa Dez 25, 2010 18:17 ] |
Betreff des Beitrags: | Re: OpenGL and DirectX? |
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. |
Autor: | Stucuk [ Sa Dez 25, 2010 21:08 ] |
Betreff des Beitrags: | Re: OpenGL and DirectX? |
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. |
Autor: | Lord Horazont [ Sa Dez 25, 2010 21:57 ] |
Betreff des Beitrags: | Re: OpenGL and DirectX? |
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 |
Autor: | Stucuk [ So Dez 26, 2010 10:44 ] |
Betreff des Beitrags: | Re: OpenGL and DirectX? |
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. |
Autor: | Stucuk [ So Jan 09, 2011 10:17 ] |
Betreff des Beitrags: | Re: OpenGL and DirectX? |
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; |
Seite 1 von 1 | Alle Zeiten sind UTC + 1 Stunde |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |