View Single Post
  #5  
Old May 30th 19, 02:45 PM posted to microsoft.public.windowsxp.general,comp.os.ms-windows.programmer.win32
Paul[_32_]
external usenet poster
 
Posts: 11,873
Default Geforce GTX 275 - OpenGL initialisation problem when programis started from the commmand console. Update

R.Wieser wrote:
(x-posted/continued from microsoft.public.windowsxp.general)

After mulling over what you wrote I realized I forgot to mention something
thats (most likely) important : My "command prompt" window is full-screen
(80x25 char). So when a GUI program is started the OS first has to
switch from text to graphics mode.


I think I've narrowed the problem down to the ChoosePixelFormat function
(might be a red herring though ...). When I start the program from a full
screen console window the returned result is 0x4, but when I start it from
within the GUI the result is 0x7. (no idea what those numbers mean, as MS
doesn't seem willing to part with that kind of info - not described with the
above function, SetPixelFormat or the involved structure).

I also just spend an hour or two trying to re-initialize the OpenGL DC, but
was twarthed by not being able to choose a new pixel format for it (which I
only noticed/read *after* having spend all that time. :-\ )

I guess the new question is: Other than delaying the calling of the
ChoosePixelFormat function (and with it the whole OpenGL context
initialisation - which causes its own problems), how to I get the
ChoosePixelFormat function to return a result in reference to a GUI DC ?

Regards,
Rudy Wieser


But based on your knowledge of the zillion ways to design
"error numbers", you know 0x4 and 0x7 are not errors. And you
also know that Microsoft loves GDI and hates OpenGL.

https://www.khronos.org/opengl/wiki/...OpenGL_Context

A returned value of 0x0 means it could not find a matching
pixel format. You got a pixel format value of 0x4 in one case
and 0x7 in the other case. These values are then passed
to SetPixelFormat.

In the order of things, you open a graphics window first.
That's what this seems to suggest. Even if opened from the Command
Prompt, you probably open one of these, just so you have
an actual window in the picture.

"The Window Itself

When you create your HWND, you need to make sure that
it has the CS_OWNDC set for its style."

"PFD_DRAW_TO_WINDOW ===" [suggests a window needs to be in the picture]

And there are articles on doing it the hard way.
In this example, a fake window is used to build a context,
then the program switches over to the prepared OpenGL context
and releases the fake window.

https://mariuszbartosik.com/opengl-4...t-a-framework/

Also, I tried tossing in "GDI" in a pixelformat search for
Windows in Google, and these might well be the enumerations
you seek. Perhaps if you toss enough of those into Google,
you'll eventually find a gdi.h or something.

https://docs.microsoft.com/en-us/win...rmat-constants

PixelFormat1bppIndexed
PixelFormat4bppIndexed
PixelFormat8bppIndexed
PixelFormat16bppARGB1555
PixelFormat16bppGrayScale
PixelFormat16bppRGB555
PixelFormat16bppRGB565
PixelFormat24bppRGB === 0x7 ???
PixelFormat32bppARGB
PixelFormat32bppPARGB
PixelFormat32bppRGB
PixelFormat48bppRGB
PixelFormat64bppARGB
PixelFormat64bppPARGB

Paul (who is obviously not a programmer)
Ads