Dark Bit Factory & Gravity
PROGRAMMING => General coding questions => Topic started by: va!n on August 20, 2007
-
hi there...
i created with the help of remi (who did the 4k OGL version) just a simple and not spectacular "4k procedual gfx intro" at buenzli... i am not really sure what place of it got... (but afaik it got not the last place :P)
However on 800x600 screen its ok, but on other resolutions there is a little problem... Loader part (showing group logo) is based on a window and GDI... than the generated image will be shown on 800x600 with OGL (fullscreen)... Is there any way to fix this, to have everytime a fullscreen? As i heared, the problem may caused because of the mix with GDI and OGL, where both systems has different coords!? (even if the source is to simple, i dont want spread it here, due fact of the LoaderPart (Logo) ^^
So if someone may help me and fix the source and convert it from PB -> VC2005 (i will try to convert much as possible), that would be really great! Please PM! Thanks a lot in advance! PS: However the intro can be converted to DX9 too, if you know only DX instead OGL ^^
[Edited]
Here is the party version of our first PC 4k intro (procedual gfx entry) ^^ Its nothing special... but even if the image looks simple, its not so simple as it looks on the first view ^^ Its jut a fun production with an optical illussion :P
http://www.secretly.de/public/SCL_Donut.exe (http://www.secretly.de/public/SCL_Donut.exe)
-
it look good, u could make rainbow with it then change the shape effect
-
Thanks HotShot ;)
Btw, in the 4k procedual gfx compo you are only allowed to disaplay ONE generated image... i asked the orgas to add the loader thing and i am lucky, they accepted it ;)
-
Welldone Va!n, nice illussions there dude.
-
Welldone Va!n, nice illussions there dude.
Indeed. Looks on the first sight quite simple - but the longer you watch it the more
interesting it becomes. Well done !
-
It definately has the ability to mess with your eyes!
I am not very good at seeing optical illusions these days because my right eye is not very good, but when I see one that works my vision goes a little bit blurry and it happened here :)
-
Haha, I was waiting for something to happen and I noticed it getting weirder. Nice effect, I like these things :)
-
Ow! My eyes!
However on 800x600 screen its ok, but on other resolutions there is a little problem... Loader part (showing group logo) is based on a window and GDI... than the generated image will be shown on 800x600 with OGL (fullscreen)... Is there any way to fix this, to have everytime a fullscreen? As i heared, the problem may caused because of the mix with GDI and OGL, where both systems has different coords!?
Can you explain that a little better please? Are you saying that the window size changes but the generated image doesn't? In that case you need to use glViewport() to set the new size of the window.
Jim
-
Using GDI will always cost you more bytes (I have tested this), try to convert the loader part to OGL. btw I guess that you are not using ChangeDisplaySettings command to go fullscreen and you're using only a maximized window, right ???
-
Oh shit... things i thought that would be happen, still happens... :( Looks like people don't understand that it was not a 4k intro... it was a "4k procedual graphic" entry... (my first ever 4k for pc)
would be nice if someone here may help me to fix it and get it work in VC2005 (and pack it using crinkler to get the size smaller ^^)
So many thanks in advance.
The problem with the source:
Its done in PB using Win32/OGL API only! So it should be easy to port to VC2005... The intro just opens only one window
hWnd = CreateWindow_("edit", 0, #WS_POPUP | #WS_VISIBLE | #WS_MAXIMIZE, 0, 0 ,0 ,0, 0 ,0 ,0, 0 );
hDC = GetDC_ (hWnd)
SetPixelFormat_ ( hDC, ChoosePixelFormat_( hDC, pfd), pfd );
wglMakeCurrent_ ( hDC, wglCreateContext_(hDC) );
ShowCursor_(#False);;
glOrtho_(0, 720, 0, 600, -128, 128);
The glOrtho coords are used in fact to scale the generated image (illusion)... not the title picture... The title picture will be displayer here in a window but i can see the desktop around the window (if desktop is bigger as 800x600)... but when the intro will display the illussion image, it will swap to fullscreen O.O Normaly the full program should work in fullscreen...
-
Hey va!n try to add this code before you create your window:
DEVMODE dmScreenSettings;
dmScreenSettings.dmSize=sizeof(dmScreenSettings);
dmScreenSettings.dmPelsWidth = 800;
dmScreenSettings.dmPelsHeight = 600;
dmScreenSettings.dmBitsPerPel = 32;
dmScreenSettings.dmFields=DM_PELSWIDTH|DM_PELSHEIGHT;
ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN);
or you can try this:
rc\right = GetSystemMetrics(SM_CXSCREEN);
rc\bottom = GetSystemMetrics(SM_CYSCREEN);
Hope it help...
-
Btw, Congrats on your 1st 4K Va!n dude. :)
-
Hey va!n,
here's how i did my entry (based on auld's framework):
DEVMODE dmScreenSettings;
dmScreenSettings.dmSize = sizeof(dmScreenSettings);
dmScreenSettings.dmPelsWidth = 800;
dmScreenSettings.dmPelsHeight = 600;
dmScreenSettings.dmBitsPerPel = 32;
dmScreenSettings.dmFields = DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN);
PIXELFORMATDESCRIPTOR pfd;
pfd.cColorBits = 32;
pfd.cDepthBits = 24;
pfd.dwFlags = PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
HDC hDC = GetDC ( CreateWindow("edit", 0,
WS_POPUP|WS_VISIBLE|WS_MAXIMIZE,
0, 0, 0 , 0, 0, 0, 0, 0) );
SetPixelFormat ( hDC, ChoosePixelFormat ( hDC, &pfd) , &pfd );
wglMakeCurrent ( hDC, wglCreateContext(hDC) );
ShowCursor(FALSE);
for screen init,
wglMakeCurrent ( NULL, NULL );
for deinit...
though, i haven't found out how to take a screenshot of it.. It fails anytime, any idea how to make it possible to take screenshots with this?
-
...
though, i haven't found out how to take a screenshot of it.. It fails anytime, any idea how
to make it possible to take screenshots with this?
Never done it myself - but AFAIK you can read the FrameBuffer with the glReadPixels()
command. In that way you should get an array of the RGB colors (Hint: set the right RGB
color order with GL_BGR).
Would be interesting to know if it works - good luck !
[EDIT
Just googled for screenshot and glReadPixels() and found the following glut example
with source.
Direct download link : http://www.robthebloke.org/opengl_examples/screengrab.zip (http://www.robthebloke.org/opengl_examples/screengrab.zip)
[/EDIT]
-
true, i can already save as tga, but i meant that print screen seems not to work.. weird.. ???
-
true, i can already save as tga, but i meant that print screen seems not to work.. weird.. ???
Aha thats cos the code is dirty and avoids some "windows" necessaries and does only the minimum for OGL. I suggest you download "screenhunter" free edition. It works every time.
Auld/chris
-
true, i can already save as tga, but i meant that print screen seems not to work.. weird.. ???
Ahh ... ok ... thought you wanted to add a screencaptuure function by yourself. But then take a
decent screencapturing tool like the one chris suggested.
-
ok, thanks to both for helping out :) nice hint auld.. i think this tool will come handy, if i may say so..
-
I've a simpler way to capture your screenshot, just add this code:
MSG msg; //added
do {
if (PeekMessage (&msg,NULL,0,0,PM_REMOVE) != 0) //added
{ //added
DispatchMessage(&msg); //added
} //added
...
...
...
} while ( !GetAsyncKeyState(VK_ESCAPE) );
Now just press "Print Screen" and paste your screenshot to your paint program.
:cheers:
-
@rbraz:
cooool !!! :goodpost: K++