Archived

This topic is now archived and is closed to further replies.

ScreenSaver display objects

This topic is 5005 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

OK this is a hopefully simple question. I found a reference to a screensaver search I did, and was able to slap this together. REF:http://www.gamedev.net/community/forums/topic.asp?topic_id=22388 #include "stdafx.h" #include <windows.h> // Header File For Windows #include <gl\gl.h> // Header File For The OpenGL32 Library #include <gl\glu.h> // Header File For The GLu32 Library #include <gl\glaux.h> // Header File For The Glaux Library #include <scrnsave.h> HDC hDC=NULL; // Private GDI Device Context HGLRC hRC=NULL; // Permanent Rendering Context HWND hWnd=NULL; // Holds Our Window Handle HINSTANCE hInstance; // Holds The Instance Of The Application //----------------------------------------------------------------------------- LONG WINAPI ScreenSaverProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_CREATE: break; case WM_DESTROY: PostQuitMessage(0); break; } return DefScreenSaverProc(hWnd, msg, wParam, lParam); } //----------------------------------------------------------------------------- BOOL CALLBACK ScreenSaverConfigureDialog(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_INITDIALOG: return FALSE; case WM_COMMAND: switch(LOWORD(wParam)) { case IDOK: // save settings case IDCANCEL: EndDialog(hDlg, LOWORD(wParam)); break; } return TRUE; } return FALSE; } // Mesage handler for about box. LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_INITDIALOG: return TRUE; case WM_COMMAND: if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) { EndDialog(hDlg, LOWORD(wParam)); return TRUE; } break; } return FALSE; } //----------------------------------------------------------------------------- BOOL WINAPI RegisterDialogClasses(HANDLE hInst) { // If a screen saver does not register any special window // classes for the configuration dialog box, the // RegisterDialogClasses function must return TRUE. return TRUE; } //----------------------------------------------------------------------------- I am including the opengl libs and the screensaver lib and it will compile just fine. The question I have it that I cannot seem to get lesson 2 box and triangle to show up and was hoping someone could just add in what and where I need it to this script. [edited by - microcyb on March 30, 2004 1:40:18 PM]

Share this post


Link to post
Share on other sites
I humbly recommend my tutorial on screensavers in OpenGL (link on nehe.gamedev.net under more tutorials). It probably has the asnwer to what you''re looking for, but could be too large and confusing if what you''re looking for is a small detail.




"Finishing in second place, simply means you are the first loser." - PouyaCat

Share this post


Link to post
Share on other sites
Well I know MySQL, and stuff, but your code did confuse me as I only just want to display a triangle on the screen as in lesson 2.

I have screen saver load up fine, but always black, and just trying to find out how or what I am missing as I just wanted that simple triangle.

Looking at your code, I just got even more lost as it is fasioned around MySQL.

Share this post


Link to post
Share on other sites
Well, the MySQL part is minimal in that particular program and in no way is the screensaver "fashioned around" MySQL. The more probable cause for confusion here is the sheer size of the code and the fact that it''s object-oriented and spread into several files.

Anyhow - have you set your viewport and lookat parameters for OpenGL - oftentimes one can''t see anything on the screen when the most basic parameters aren''t set. Does it otherwise draw an empty screen or does it crash - you never explicitly said what happens?




"Finishing in second place, simply means you are the first loser." - PouyaCat

Share this post


Link to post
Share on other sites
Well I have not added in anything yet as you see the code above is all that I have.

The key here is that I am attempting to understand just how to initailize the opengl components and display the triangle.

The key here is I am looking for the simple short way as I have not attempted all the error handling or dialog display.

Only just attempting to get the triangle to display.

In other words taking it on the baby step approach or the K.I.S.S. factor.

Right now I get a blank screen, but no crashes.


[edited by - microcyb on March 30, 2004 5:40:45 PM]

Share this post


Link to post
Share on other sites
I take it no one has an answer to this question?
My goal was to simply display the same information as in lesson 2 into a screen saver srceen.

If anyone does know how to do this, it would be greatly appreciated.

[edited by - microcyb on March 31, 2004 10:26:57 AM]

Share this post


Link to post
Share on other sites