|
|
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » GLCtrl questions
GLCtrl questions [message #28706] |
Mon, 13 September 2010 11:52 |
cbpporter
Messages: 1406 Registered: September 2007
|
Ultimate Contributor |
|
|
I have a few questions about GlCtrl. I don't know too much about OpenGl because I'm more on the side of DirectX. But for some pretty basic stuff it should suffice and setting up DirectX is not easy.
1. As far as I can tell, except for the control itself standard OpenGl API is used. This means that one can do anything with GLCtrl that one can do with straight forwards OpenGl? Also, these function seem to not take any destination. Can I have more OpenGl views at the same time?
2. Can you have other controls inside the OpenGl control? And does normal (HDC based for Windows) draw operation work on that control? Can I render a 3D scene and then draw a line on top of it without OpenGL?
3. How can I make my application full screen and supply a resolution? Also, is it possible for OpenGL in fullscreen mode to use full/real hardware accelerated page swapping (not just hardware accelerated bliting)?
|
|
|
Re: GLCtrl questions [message #28717 is a reply to message #28706] |
Mon, 13 September 2010 20:01 |
281264
Messages: 272 Registered: June 2010 Location: Spain
|
Experienced Member |
|
|
Hi cbpporter,
Not being an OpenGL expert (I am currently using a limited portion of it and not for games, btw) these are my answers:
1.- GLCTrl is a way to create a substratum for the usage of OpenGL in Windows: i.e. specification of pixelformatdescriptor, creation of an OpenGL rendering context (by using wglCreateContext(), and so on. These features are easily recognizable in the code. I suggest you to have a look to the well known “Red book”, available for free in the internet(not the latest version, but it is ok: http://fly.cc.fer.hr/~unreal/theredbook/). Also have a lookt at the example included in the reference assembly of TheIde.
Yes, you can create anything in OpenGL by using GLCTrl. For example, the function in GLCTrl.cpp:void GLCtrl::StdView()
{
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_NICEST);
Size sz = GetSize();
glViewport(0, 0, (GLsizei)sz.cx, (GLsizei)sz.cy);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0f, (GLfloat)(sz.cx)/(GLfloat)(sz.cy), 1.0f, 100.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
sets up the basic features you need: viewport, type of perspective projection (gluPerspective in this case, although I am currently using glOrtho), etc..
Yes, you can have more than one OpenGL views at the same time. Just generate a second drawing/geometry and “project” it in a different viewport within the main window. You can use docking and dock a different windows adjacent to the “central” window.
2.- I have never tried that for I never needed it.
3.- As long as you are able to create a window without borders, capable to occupy the whole screen (which is not related with OpenGL), then OpenGL will occupy the full screen.
BTW I am interested in working with a TopWindow in U++ capable to occupy the full screen, i.e. to use the screen space used by the lower Windows toolbar; any hint how to do it?
|
|
|
|
Re: GLCtrl questions [message #28722 is a reply to message #28706] |
Mon, 13 September 2010 21:01 |
|
cbpporter wrote on Mon, 13 September 2010 11:52 | 3. How can I make my application full screen and supply a resolution? Also, is it possible for OpenGL in fullscreen mode to use full/real hardware accelerated page swapping (not just hardware accelerated bliting)?
|
281264 wrote on Mon, 13 September 2010 20:01 | 3.- As long as you are able to create a window without borders, capable to occupy the whole screen (which is not related with OpenGL), then OpenGL will occupy the full screen.
BTW I am interested in working with a TopWindow in U++ capable to occupy the full screen, i.e. to use the screen space used by the lower Windows toolbar; any hint how to do it?
|
To get a full-screen window, there is method TopWindow::FullScreen() (surprisingly ). Just make your GlCtrl filling the whole window and you get what you want, in the resolution currently set on the monitor.
To change the resolution, I'm afraid you'd have to go low-level. Not sure if there is some way to do it using OpenGL. I remember switching VGA modes using inline assembler (very long ago, in dos programs written in pascal, but it still works sometimes, at least on win XP). I'm not sure what is the current situation in modern OSes.
Honza
Honza
|
|
|
Re: GLCtrl questions [message #28724 is a reply to message #28722] |
Mon, 13 September 2010 21:12 |
cbpporter
Messages: 1406 Registered: September 2007
|
Ultimate Contributor |
|
|
dolik.rce wrote on Mon, 13 September 2010 22:01 |
cbpporter wrote on Mon, 13 September 2010 11:52 | 3. How can I make my application full screen and supply a resolution? Also, is it possible for OpenGL in fullscreen mode to use full/real hardware accelerated page swapping (not just hardware accelerated bliting)?
|
281264 wrote on Mon, 13 September 2010 20:01 | 3.- As long as you are able to create a window without borders, capable to occupy the whole screen (which is not related with OpenGL), then OpenGL will occupy the full screen.
BTW I am interested in working with a TopWindow in U++ capable to occupy the full screen, i.e. to use the screen space used by the lower Windows toolbar; any hint how to do it?
|
To get a full-screen window, there is method TopWindow::FullScreen() (surprisingly ). Just make your GlCtrl filling the whole window and you get what you want, in the resolution currently set on the monitor.
To change the resolution, I'm afraid you'd have to go low-level. Not sure if there is some way to do it using OpenGL. I remember switching VGA modes using inline assembler (very long ago, in dos programs written in pascal, but it still works sometimes, at least on win XP). I'm not sure what is the current situation in modern OSes.
Honza
Honza
|
I was trying to achieve the DirectX kind of fullscreen. You can have a small view, like 300x200 dedicated to DirectX and the rest normal Windows widgets. If you go fullscreen with a given resolution, your 3D widget will remain small and the rest of the widgets will still work.
VGA is dead . Anyway, you can't change the resolution that way for Windows applications. There may be a way with Windows API.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: GLCtrl questions [message #29066 is a reply to message #29004] |
Mon, 04 October 2010 12:00 |
mrjt
Messages: 705 Registered: March 2007 Location: London
|
Contributor |
|
|
It's strange you're having problems, I was able to get multiple GLCtrls working in a Upp app quite easily. The main gotcha is to know that there are some cases (such a modal windows / prompts) that change the rendering context so you must always do wglGetContext / wglSetContext before calling GL functions.
I'm not sure what befit you would get from running the rendering in another thread. If your rendering is that slow then you will never be able to assure a responsive application. Just keep the GUI and Rendering in the main thread and move everything else (where possible) into worker threads.
|
|
|
Goto Forum:
Current Time: Fri Sep 20 03:45:07 CEST 2024
Total time taken to generate the page: 0.05953 seconds
|
|
|