Advertisement

ScreenSaver display objects

Started by March 30, 2004 12:28 PM
4 comments, last by microcyb 20 years, 11 months ago
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]
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

"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
Advertisement
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.
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

"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
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]
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]

This topic is closed to new replies.

Advertisement