Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Screenshot Function Easy

Author
Message
3DVector
15
Years of Service
User Offline
Joined: 19th Jan 2009
Location: Germany
Posted: 20th Jan 2009 00:25
Hello all,

sorry for my bad english, im learning (after i had learned c++ )

Here`s a Screenshot-Function from me, you only need GDK-Instructions for it.(!)

#include "DarkGDK.h"

void Screenshot (void);

void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 60 );
dbMakeObjectCube ( 1, 10 );

while ( LoopGDK ( ) )
{
if ( dbEscapeKey ( ) )
return;

if ( dbKeyState( 2 ) == 1 )
Screenshot();

dbRotateObject ( 1, dbObjectAngleX ( 1 ) + 0.2f, dbObjectAngleY ( 1 ) + 0.4f, dbObjectAngleZ ( 1 ) + 0.8f );
dbSync ( );
}
}

void Screenshot (void)
{
dbMakeCamera ( 1 );
dbPositionCamera ( 1, dbCameraPositionX ( 0 ), dbCameraPositionY ( 0 ), dbCameraPositionZ ( 0 ) );
dbRotateCamera ( 1, dbCameraAngleX ( 0 ), dbCameraAngleY ( 0 ), dbCameraAngleZ ( 0 ) );

dbSetCameraToImage ( 1, 1, dbScreenWidth(), dbScreenHeight() );
dbSync();
dbSaveImage( "C:\\Screenshot.jpg", 1 );

dbSetCurrentBitmap ( 0 );
dbDeleteImage ( 1 );
dbDeleteCamera ( 1 );

return;
}

Have Fun with it!

Greetings
Mathias
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 20th Jan 2009 02:03
Or...



>.>
3DVector
15
Years of Service
User Offline
Joined: 19th Jan 2009
Location: Germany
Posted: 20th Jan 2009 09:53
Hello Zuka, if i use your Code, i get an Error Message:
(translated from german in english something like: )

Untreated exception with 0x0135fccf in C3D.exe: 0xC0000005: Access injury during the reading at position 0x00000000.

?
stevebrit
15
Years of Service
User Offline
Joined: 6th Jan 2009
Location: Florida USA
Posted: 20th Jan 2009 11:26
Thanks for that code it works here very nicely. That made me think of another use for that. When wanting to get a 3d object into a 2d format for use in a 2d game. You could rotate a sprite the needed amount of degrees then save another frame until you had enough frames to make up a 2d animation sheet from a 3d image. hope that all makes sense....

Regards Steve
Thoben
16
Years of Service
User Offline
Joined: 4th Aug 2008
Location: Munich, Ger
Posted: 13th May 2009 23:37
Sorry for bumping this thread, but I have a question regarding Screenshots.

The simple code from Zuka works very well, but is it possible to make multiple screenshots? If I make a screenshot now, it saves the pic to the defined folder. But if I take another Screenshot, it will overwrite the old one.

So is there a possibility to count the Filename up? Like Screen1.jpg, Screen2.jpg etc.?

Login to post a reply

Server time is: 2024-11-25 11:40:45
Your offset time is: 2024-11-25 11:40:45