PDA

View Full Version : wglCreateContext and directdraw



XFire
04-01-2002, 01:51 PM
Hello,

is it valid to obtain a device context handle from a window handle if the window already initialized direct draw and switched to fullscreen mode?
The reason why i ask is because
wglCreateContext always returns an invalid handle error code.
First i thougt it's because i already initialized directdraw and i obtained the device context handle by GetDC(HandleOfDirecDrawWindow); so i tried to initialize opengl before direct draw. (without success - still invalid handle returned). Next thing i thought was maybe i can not obtain a device context from that window so i tried to use CreateDC to obtain a handle to a divice context. But wglCreateContext still complains that the handle is invalid....
The strange thing is, ChoosePixelFormat() and SetPixelFormat() accepted the divce context handle. (regardless how it was obtained)

An other question is, i've read that opengl can not render directly onto a direct draw surface - at least not on every system. Is this still the case? And on what does it depend if it works or not? I just wonder why there's a funktion called GetDC in the DirectDrawSurface class.
Whats the usual way to get direct draw and opengl working in the same program? And how do i get the rendered image onto a direct draw surface - FAST?

Argh...
i'd better RTFM alot - Let me know where if you know any good sources of whisdom.
Thank's in advance for any hints,
XFire

chowe6685
04-01-2002, 05:08 PM
OpenGL and DirectDraw don't work together, the only way to use them in the same program is to destroy one and reintialize the other

XFire
04-02-2002, 08:34 AM
Argh....
****! Is there realy no way to do it?

chowe6685
04-02-2002, 09:03 AM
why do you need to?

XFire
04-02-2002, 12:58 PM
The game (2d only yet) is as good as finish and i thought to enhance it with some opengl effects. I can't use d3d because of the linux version (and i realy dont like to wirte the code two times)
The main part of the game are some highly for speed optimized assembly funktions, that draw directly onto one of the backpuffer! I don't even know if i can port this funktions to opengl. Because i need the following capabilities:
Direct access to one of the backpuffers.
The backpuffer must be equal to the size of the screen resolution - meaning opengl is not allowed to stratch/scale a scene.

C'mon there has to be a way to use opengl and directdraw (not direct3d) on the same programm! Else i can throu away eighter the linux version toghether with my opengl books or the windows version...