opengl problem underneath vista


i've only started opengl nonetheless i ran uncanny behaviour.



below i posted formula runs good xp nonetheless perspective renders only black screen.



sorry posting unusally (as board) enlarged code.



is there something unequivocally specific open gl vista? thanks.



#include<windows.h>
#include<gl\gl.h>
#include<gl\glu.h>
#pragma comment(lib, "opengl32.lib")
#pragma comment(lib, "glu32.lib")

void initgl(void)
{
glclearcolor(1,0.3f,0.3f,0.3f);
}

void drawglscene(void)
{
/* formula private */
}

hglrc hrc = null;
hdc hdc = null;
hwnd hwnd = null;
hinstance hinstance = null;
lresult callback wndproc(hwnd, uint, wparam, lparam);

bool createglwindow(char* title, int width, int height)
{
gluint pixelformat;
wndclass wc;
rect windowrect;
windowrect.left = (long)0;
windowrect.right = (long)width;
windowrect.top = (long)0;
windowrect.bottom = (long)height;
lpcstr nazwa = text("start");

hinstance = getmodulehandle(null);
wc.style = cs_hredraw | cs_vredraw | cs_owndc;
wc.lpfnwndproc = (wndproc)wndproc;
wc.cbclsextra = 0;
wc.cbwndextra = 0;
wc.hinstance = hinstance;
wc.hicon = loadicon(null, idi_winlogo);
wc.hcursor = loadcursor(null, idc_arrow);
wc.hbrbackground = null;
wc.lpszmenuname = null;
wc.lpszclassname = nazwa;

registerclass(&wc);

hwnd = createwindowex(ws_ex_appwindow | ws_ex_windowedge, nazwa,
nazwa,
ws_sysmenu |
ws_clipsiblings |
ws_clipchildren,
0,0,
width,
height,
null,
null,
hinstance,
null);

static pixelformatdescriptor pfd =
{
sizeof(pixelformatdescriptor),
1,
pfd_draw_to_window |
pfd_support_opengl |
pfd_doublebuffer,
pfd_type_rgba,
32,
0,0,0,0,0,0,
0,
0,
0,
0,0,0,0,
16,
0,
0,
pfd_main_plane,
0,
0,0,0
};

hdc = getdc(hwnd);
pixelformat = choosepixelformat(hdc, &pfd);
hresult rez = setpixelformat(hdc, pixelformat, &pfd);
hrc = wglcreatecontext(hdc);
wglmakecurrent(hdc, hrc);
showwindow(hwnd, sw_show);
initgl();
return true;

}

lresult callback wndproc(hwnd hwnd, uint umsg, wparam wparam, lparam lparam)
{
switch(umsg)
{
case wm_activate:
{
relapse 0;
}
case wm_close:
{
postquitmessage(0);
relapse 0;
}
}

return defwindowproc(hwnd, umsg, wparam, lparam);
}

int winapi winmain(hinstance hinstance, hinstance hprevinstance, lpstr lpcmdline,
int ncmdshow)
{
msg msg;
bool finished = false;

if (!createglwindow(null, 800,600))
{
relapse 0;
}

while(!done)
{
(peekmessage(&msg, null, 0, 0, pm_noremove))
{
(!getmessage(&msg, 0, 0, 0)) finished = true;
else {
translatemessage(&msg);
dispatchmessage(&msg);
}
}
else
{
drawglscene();
swapbuffers(hdc);
}
}

return (msg.wparam);
}


Comments

Popular posts from this blog

list macos calm editors formula editors

how hibernate @any-related annotations?

using mvc, should hoop communication between views? between models?