Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
STARS.CPP
Package: openglsystem.rar [view]
Upload User: nthssl
Upload Date: 2022-04-05
Package Size: 25357k
Code Size: 1k
Category:
OpenCV
Development Platform:
Visual C++
- // Stars.cpp: implementation of the CStars class.
- //
- //////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "MyGame.h"
- #include "Stars.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char THIS_FILE[]=__FILE__;
- #define new DEBUG_NEW
- #endif
- #ifndef M_PI
- #define M_PI 3.14159265358979323846
- #endif
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- CStars::~CStars()
- {
- }
- CStars::CStars(int starn)
- {
- cc=0;
- S.resize(starn);
- C.resize(starn+10);
- for(int i=0;i<starn;++i)
- {
- S[i].v[0]=(drand48()-.5);
- S[i].v[1]=(drand48()-.5);
- S[i].v[2]=0;
- }
- float basecolor;
- for(i=0;i<starn+10;++i)
- {
- if(i%10) basecolor=drand48();
- C[i].v[0]=C[i].v[1]=C[i].v[2]=basecolor+sin((i%10)*M_PI/10.0);
- }
- }
- int CStars::Draw()
- {
- glDisable(GL_LIGHTING);
- glColor3f(1.0,1.0,1.0);
- glEnableClientState (GL_VERTEX_ARRAY);
- glEnableClientState (GL_COLOR_ARRAY);
- glVertexPointer(3,GL_FLOAT,0,S.begin());
- glColorPointer(3,GL_FLOAT,0,&(C[cc]));
- glDrawArrays(GL_POINTS,0,S.size());
- glDisableClientState (GL_VERTEX_ARRAY);
- glDisableClientState (GL_COLOR_ARRAY);
- glEnable(GL_LIGHTING);
- return S.size();
- };