Triangles not displayed correctly on fullscreen

Started by
7 comments, last by mrbastard 18 years, 11 months ago
Hello, I use Visual C++ and OpenGL. I wrote a programm that draws triangles (with glBegin(GL_TRIANGLES) and glVertex3f(...)) on the screen. But for some reason this only works in windowed mode. When I toggle to fullscreen, the triangles appear as an ugly group of horizontal lines that flicker when you move the camera. Quads are displayed normally on fullscreen. Can anyone tell me what I'm doing wrong? Thank you for your help, Phex
Advertisement
I think it's a problem with your z-buffer. Could you paste your pixelformatdescriptor and Projection setup? Don't forget to use the source-tags! [ (/)source ]
Quote:Original post by Pipo DeClown
I think it's a problem with your z-buffer. Could you paste your pixelformatdescriptor and Projection setup?

I am not totally sure if this is what you meant, but I hope so:
PIXELFORMATDESCRIPTOR pfd =			{	sizeof (PIXELFORMATDESCRIPTOR), 	1,						PFD_DRAW_TO_WINDOW |		 	PFD_SUPPORT_OPENGL |	 	PFD_DOUBLEBUFFER,		PFD_TYPE_RGBA, 	window->init.bitsPerPixel,	0, 0, 0, 0, 0, 0,	 	0,				0,				0,			 	0, 0, 0, 0,		 	16,			 	0,				0,			 	PFD_MAIN_PLANE,	 	0,				0, 0, 0		 };

And
glViewport (0, 0, (GLsizei)(width), (GLsizei)(height));glMatrixMode (GL_PROJECTION);						 glLoadIdentity ();gluPerspective (45.0f, (GLfloat)(width)/(GLfloat)(height), 0.1f, 500.0f);

rgds,
Phex
Did you setup the DEVMODE when you switch to fullscreen?
Quote:Original post by nhatkthanh
Did you setup the DEVMODE when you switch to fullscreen?

Yes; or at least I hope I did it correctly. This is the relevant code:
BOOL ChangeScreenResolution (int width, int height, int bitsPerPixel)	{	DEVMODE dmScreenSettings;	ZeroMemory (&dmScreenSettings, sizeof (DEVMODE));	dmScreenSettings.dmSize			= sizeof (DEVMODE);	dmScreenSettings.dmPelsWidth		= width;	dmScreenSettings.dmPelsHeight		= height;	dmScreenSettings.dmBitsPerPel		= bitsPerPixel;	dmScreenSettings.dmFields		= DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;	if (ChangeDisplaySettings (&dmScreenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)		return FALSE;	return TRUE;}
Is nobody able to help me? I would really appreciate a hint because I cant find any bug on my own...
does the unedited nehe tutorial work or does it do the same?
[size="1"]
The Tutorial (34 in this case) works perfect (even when I insert my own drawing function).
check for anything you are doing differently, especially anything involving z buffer precision like Pipo said, but also remembering that bad near/far values passed to gluPerspective could affect the z buffer.
[size="1"]

This topic is closed to new replies.

Advertisement