void IntGL(HDC &hDC, HGLRC &hRC, HWND hWnd, HINSTANCE hInstance)
{
if(prev) GetClientRect(hWnd, &rect);
else
{
SetRect(&rect, 0, 0, GetSystemMetrics(SM_CXSCREEN),
GetSystemMetrics(SM_CYSCREEN));
}
WNDCLASSEX wc;
hInstance = GetModuleHandle(NULL);
ZeroMemory (&wc, sizeof (WNDCLASSEX));
wc.cbSize = sizeof (WNDCLASSEX);
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wc.lpfnWndProc = (WNDPROC) WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_ICON1);
wc.hCursor = LoadCursor(NULL, NULL);
wc.hbrBackground = NULL;
wc.lpszMenuName = NULL;
wc.lpszClassName = "window";
if(!RegisterClassEx(&wc))
{
MessageBox(NULL, "Window Registration Failed!", "Error!",
MB_ICONEXCLAMATION | MB_OK);
}
if(!prev)
{
DEVMODE dmScreenSettings;
memset(&dmScreenSettings,0,sizeof(dmScreenSettings));
dmScreenSettings.dmSize=sizeof(dmScreenSettings);
dmScreenSettings.dmPelsWidth = rect.right;
dmScreenSettings.dmPelsHeight = rect.bottom;
dmScreenSettings.dmBitsPerPel = 16;
dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
if (ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL)
{
if (MessageBox(NULL, "Unable to render!","ERROR 1", MB_OK))
{
end=TRUE;
}
}
}
hWnd = CreateWindowEx( WS_EX_APPWINDOW,
"window",
"Fall!",
style,
0,
0,
rect.right,
rect.bottom,
NULL,
NULL,
hInstance,
NULL);
if(hWnd == NULL)
{
MessageBox(NULL, "Window Creation Failed!", "Error!",
MB_ICONEXCLAMATION | MB_OK);
}
{
static PIXELFORMATDESCRIPTOR pfd=
{
sizeof(PIXELFORMATDESCRIPTOR),
1,
PFD_DRAW_TO_WINDOW |
PFD_SUPPORT_OPENGL |
PFD_DOUBLEBUFFER,
PFD_TYPE_RGBA,
16,
0, 0, 0, 0, 0, 0,
0,
0,
0,
0, 0, 0, 0,
16,
0,
0,
PFD_MAIN_PLANE,
0,
0, 0, 0
};
glViewport(0,0,rect.left,rect.top);
hDC=GetDC(hWnd);
int PixelFormat=ChoosePixelFormat(hDC,&pfd);
SetPixelFormat(hDC,PixelFormat,&pfd);
hRC=wglCreateContext(hDC);
wglMakeCurrent(hDC,hRC);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
perspectiveGL(45.0f,(GLfloat)rect.right/(GLfloat)rect.bottom,0.1f,100.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glEnable(GL_TEXTURE_2D);
glShadeModel(GL_SMOOTH);
glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
glLightfv(GL_LIGHT0, GL_POSITION, position);
glEnable(GL_LIGHT0);
glColorMaterial(GL_FRONT, GL_DIFFUSE);
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_LIGHTING);
inttex();
loadDisplayLists(load3DS((LPCTSTR)IDR_OBJECT1));
if(start) SetCursor(NULL);
ShowWindow(hWnd,SW_SHOW);
SetForegroundWindow(hWnd);
SetFocus(hWnd);
}
}
green objects
Its strange that this happens but when I run this screensaver I made it objects comeup all green on other computers but mine.
This is how it ints stuff.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement