Skip to main content
GameDev.net gamedev.net
🔒 Locked

OpenGL won't Render Objects Fullscreen

Started by openglJunkie Dec 5, 2008 at 8:28 PM 3 replies 1.2k views
Original Post
openglJunkie
openglJunkie
What are some common reasons for OpenGL not rendering when switching to fullscreen mode? I have a bunch of code and if I need to post some code, I'd like to narrow the choices down as little as possible.
Hexmind
Hexmind
If you are using textures you have to rebind all your textures each time you switch video mode. Hope that helps.
Yann L
Yann L
Quote:
Original post by Hexmind
If you are using textures you have to rebind all your textures each time you switch video mode.

No you don't. You only need to reload resources if you lose the context.

Quote:

What are some common reasons for OpenGL not rendering when switching to fullscreen mode?

There aren't any, unless you provide some more information. It could be virtually anything. Check if your glViewport params are correct, if you have a valid OpenGL context bound, if your new video mode supports GL rendering, etc.
openglJunkie
openglJunkie
Apparently this only happens when I'm trying to draw a line. I was just messing around and had switched over from using points, but I don't see why my lines aren't being displayed while in fullscreen.

If you need to know, I'm using OpenGL with Win32 and the code for the Win32 part is encapsulated. So if you need any of that I can get it.


bool init(){	int w = opengl->getWidth(), h = opengl->getHeight();	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);	// Enable States	glEnable(GL_DEPTH_TEST);	glDepthFunc(GL_LEQUAL);	glClearDepth(1.0);	glShadeModel(GL_SMOOTH);    return true;}void display(){	glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);        // I added this to see if it would work help my fullscreen problem	glMatrixMode(GL_PROJECTION);	glLoadIdentity();	glViewport(0.0, 0.0, opengl->getWidth(), opengl->getHeight());	glOrtho(0.0f, opengl->getWidth(), 0.0f, opengl->getHeight(), 1.0f, 100.0f);	glMatrixMode(GL_MODELVIEW);	glLoadIdentity();	gluLookAt(		0.0, 0.0, 1.0,		0.0, 0.0, 0.0,		0.0, 1.0, 0.0);		glColor3f(0.0f, 0.0f, 1.0f);	glPointSize(5);	glBegin(GL_LINES);		glVertex2f(0.0f, 0.0f);		glVertex2f(100.0f, 100.0f);	glEnd();glFlush();}void resize(int w, int h){	if(h==0) h = 1;	glMatrixMode(GL_PROJECTION);	glLoadIdentity();		glViewport(0, 0, w, h);		gluPerspective(45.0, w/h, 1.0, 100.0);glMatrixMode(GL_MODELVIEW);glLoadIdentity();}
openglJunkie
openglJunkie
You can download the full source code, here:

http://files.filefront.com/glBasicrar/;12576098;/fileinfo.html

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.