Jump to content
  • Advertisement
Sign in to follow this  
markty

green objects

This topic is 5104 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.
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);

	}
	
}

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!