Maximized window creation using OPENGL

Hi,

I would like to know how to create a window in vc++ using opengl in maximized mode (NOT fullscreen mode) and disable properties like minimize, resize, etc. (everything for an OPENGL window)

Thanks,
Naresh

Set the correct window styles for the buttons, or lack thereof:
http://msdn.microsoft.com/library/defaul…indowStyles.asp

Call ShowWindow() with SW_SHOWMAXIMIZED
http://msdn.microsoft.com/library/defaul…/ShowWindow.asp

thanks for the links… These properties can be set only when I have a handle to the window. However, the window was created using OPENGL and it returns a unique number that identifies the window. How do I retrieve the handle for the window using the unique number?

Sorry, this doesn’t make sense.
OpenGL doesn’t know of any windows.
The platform (operating system) specific functions wgl… or glx… functions tie window managers and OpenGL functionality together.

If you do not have control about how a window has been created you cannot change the window styles. But you said you want to “create a window in vc++” so you must have these informations.

OK. I am not able to understand much of what you say. Let me explain what I want clearly…

// Create image window
glutInitWindowSize(cols, rows);
glutInitWindowPosition((ScreenWidth - cols) /2, (ScreenHeight - rows) /2);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutCreateWindow(filename);

The above code is what I wrote for creating a window. I want this window to start in maximized mode when it enters glutMainLoop();

Relic is talking about using the Win32 API to deal with the windows stuff. You didn’t mention you were using GLUT (kind of important).

Anyways, dunno, never tried it. I think you want glutFullScreen:
http://www.opengl.org/documentation/specs/glut/spec3/spec3.html

So you’re using the GLUT library to create the window (not OpenGL, you see).

GLUT abstracts the operating system calls like Microsoft’s Win32 API call CreateWindow() so that the same GLUT source can be compiled under Windows or Linux, just the underlying Window manager calls are completely different.

What I was assuming is you have a Windows program using the Win32 API directly to create a window and know what window styles are.
I don’t know if you can set the necessary window styles via any GLUT interface.

If you want to have a small minimal windows sample you’ll find examples on the internet.
These are an Ok start: http://nehe.gamedev.net/
(though I prefer demo apps which do not render in the idle loop).

Tin, I assumed GLUT was implied in OPENGL. sorry for that!
The glutFullScreen function is to render the window in fullscreen like games (without the titlebar, buttons, etc.) I want the window to be just maximized (like what it is when we hit the maximize button on any windowed application.

Sorry abt that confusion, Relic. I have been following the nehe’s tutorials. They have been really useful.

Do you mean to say that a GLUT based window cannot be maximized? I have searched on google but couldn’t get sufficient info.

Sorry, Scoob. :slight_smile:

You can definitely maximize the window through the Windows API. Look at GetActiveWindow and SetWindowPos, for example. Though I consider it kinda ugly to mix GLUT and Win32 calls. I’d go ahead and go all the way with windows at this point, but suit yourself.

You could also just get the desktop dimensions and create the window with those dimensions to begin with. Look at GetSystemMetrics with SM_(CX/CY)SCREEN.

Tin, GlutCreateWindow is executed when the control enters the GlutMainLoop(); so any change to the window through Windows API commands will not be effected on the desired window. I tried using the commands but didn’t work…

The purpose of the window is to load an image and highlight points on the image where the mouse left button is clicked. I think it is easier to work with OpenGL to do the graphics and stuff. Thats why I am resorting to use it.

I am using the GetSystemMetrics to get the ScreenWidth, ScreenHeight used in the code above.

GLUT is not OpenGL. It is a library written by someone to help making crossplatform code. The Red Book uses it for that reason. Some people use Linux, some Macs, some Unix, some FreeBSD. Before GLUT, there was AUX. The first Red book used it.

GLUT is old and hasn’t been updated for a long time. There are SDL, freeGLUT, Qt, wxWindows and probably others that can do a better job.

You also should have a look on GLFW - this is by far the best toolkit I know about! It does not support multiple windows thought (but it’s not that important anyway).

I find GLFW very nice too. Small simple quick and efficient.