Author Topic: Need help to fix a little simple 4k  (Read 8977 times)

0 Members and 1 Guest are viewing this topic.

Offline va!n

  • Pentium
  • *****
  • Posts: 1432
  • Karma: 109
    • View Profile
    • http://www.secretly.de
Need help to fix a little simple 4k
« 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
« Last Edit: August 20, 2007 by va!n »
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

Offline Hotshot

  • DBF Aficionado
  • ******
  • Posts: 2114
  • Karma: 91
    • View Profile
Re: Need help to fix a little simple 4k
« Reply #1 on: August 20, 2007 »
it look good, u could make rainbow with it then change the shape effect

Offline va!n

  • Pentium
  • *****
  • Posts: 1432
  • Karma: 109
    • View Profile
    • http://www.secretly.de
Re: Need help to fix a little simple 4k
« Reply #2 on: August 20, 2007 »
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 ;)
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Need help to fix a little simple 4k
« Reply #3 on: August 20, 2007 »
Welldone Va!n, nice illussions there dude.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: Need help to fix a little simple 4k
« Reply #4 on: August 20, 2007 »
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 !
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Need help to fix a little simple 4k
« Reply #5 on: August 20, 2007 »
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 :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline mike_g

  • Amiga 1200
  • ****
  • Posts: 435
  • Karma: 34
    • View Profile
Re: Need help to fix a little simple 4k
« Reply #6 on: August 20, 2007 »
Haha, I was waiting for something to happen and I noticed it getting weirder. Nice effect, I like these things :)

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Need help to fix a little simple 4k
« Reply #7 on: August 21, 2007 »
Ow!  My eyes!
Quote
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
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: Need help to fix a little simple 4k
« Reply #8 on: August 21, 2007 »
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 ???
Challenge Trophies Won:

Offline va!n

  • Pentium
  • *****
  • Posts: 1432
  • Karma: 109
    • View Profile
    • http://www.secretly.de
Re: Need help to fix a little simple 4k
« Reply #9 on: August 21, 2007 »
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

Code: [Select]
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...
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: Need help to fix a little simple 4k
« Reply #10 on: August 22, 2007 »
Hey va!n try to add this code before you create your window:

Code: [Select]

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:

Code: [Select]
rc\right  = GetSystemMetrics(SM_CXSCREEN);
rc\bottom = GetSystemMetrics(SM_CYSCREEN);

Hope it help...

Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Need help to fix a little simple 4k
« Reply #11 on: August 22, 2007 »
Btw, Congrats on your 1st 4K Va!n dude.  :)
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline nystep

  • ZX 81
  • *
  • Posts: 19
  • Karma: 4
    • View Profile
Re: Need help to fix a little simple 4k
« Reply #12 on: August 22, 2007 »
Hey va!n,

here's how i did my entry (based on auld's framework):

Code: [Select]
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,

Code: [Select]
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?

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: Need help to fix a little simple 4k
« Reply #13 on: August 22, 2007 »
...

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
[/EDIT]
« Last Edit: August 22, 2007 by benny! »
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline nystep

  • ZX 81
  • *
  • Posts: 19
  • Karma: 4
    • View Profile
Re: Need help to fix a little simple 4k
« Reply #14 on: August 22, 2007 »
true, i can already save as tga, but i meant that print screen seems not to work.. weird..  ???

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: Need help to fix a little simple 4k
« Reply #15 on: August 22, 2007 »
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
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: Need help to fix a little simple 4k
« Reply #16 on: August 22, 2007 »
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.
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline nystep

  • ZX 81
  • *
  • Posts: 19
  • Karma: 4
    • View Profile
Re: Need help to fix a little simple 4k
« Reply #17 on: August 22, 2007 »
ok, thanks to both for helping out :) nice hint auld.. i think this tool will come handy, if i may say so..

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: Need help to fix a little simple 4k
« Reply #18 on: August 23, 2007 »
I've a simpler way to capture your screenshot, just add this code:

Code: [Select]
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:
Challenge Trophies Won:

Offline va!n

  • Pentium
  • *****
  • Posts: 1432
  • Karma: 109
    • View Profile
    • http://www.secretly.de
Re: Need help to fix a little simple 4k
« Reply #19 on: August 23, 2007 »
@rbraz:
cooool !!!  :goodpost:  K++
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won: