🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: cn.bbs.comp.program
1 messages
1 total messages Started by ���� Tue, 05 May 1998 00:00
OPENGL(11)
#972
Author: ����
Date: Tue, 05 May 1998 00:00
127 lines
5189 bytes
BBSˮľ�廪վ�þ�����
������: yxy (��˿˿#���ߵ�С��ӥ), ����: GAME_Designer 
��  ��: OPENGL(11) 
����վ: BBS ˮľ�廪վ (Thu Jan 22 10:46:32 1998) 
 
��ν�������������ݡ������ϴΣ����ϴ�ƽ��������ͼ�У������� 
������һ�����飨һά���ά...���������������ݣ��������?�� 
��һ��Nά�ռ䣬���Լ������Ͷ��㡣���ϴε������У�����ѧ���� 
��ΰ���������е�������Ļ����������ϣ������һ�鲼�ϳ��� 
���ʵ���״����������档���ϴ�Ψһû��ʹ�õĺ��������������� 
���������һ������ĺ�����������Dz���һ���������?���� 
�����ڵ����嶼��������?����һ�������Դ�� 
///////////////////////////////////////////////////////////// 
//sample.cpp 
#include "glos.h" 
#include <GL/gl.h> 
#include <GL/glaux.h> 
#include "windows.h" 
void myinit(void); 
void CALLBACK  display(void); 
void CALLBACK  reshape(GLsizei w,GLsizei h); 
 
//����һ��һά�������ݣ���������������ֺ�ɫ����ɫ����255��MAX���� 
//�����ǽ������ɫ���?���ͶȲ��ϱ仯�� 
#define TEXTUREWIDTH 64 
GLubyte Texture[3*TEXTUREWIDTH]; 
void makeTexture(void) 
{ 
 int i; 
 for(i=0;i<TEXTUREWIDTH;i++) 
 { 
   Texture[3*i]=255; 
   Texture[3*i+1]=255-2*i; 
   Texture[3*i+2]=255; 
 } 
} 
GLfloat sgenparams[]={1.0,1.0,1.0,0.0}; 
 
void myinit(void) 
{ 
        auxInitDisplayMode(AUX_SINGLE|AUX_RGBA); 
        auxInitPosition(0,0,500,500); 
        auxInitWindow("sample1"); 
        glClearColor(0.0,0.0,0.0,0.0); 
        glClear(GL_COLOR_BUFFER_BIT); 
 
//�������� 
        makeTexture(); 
        glPixelStorei(GL_UNPACK_ALIGNMENT,1); 
//�������� 
        glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE); 
        glTexParameterf(GL_TEXTURE_1D,GL_TEXTURE_WRAP_S,GL_REPEAT); 
        glTexParameterf(GL_TEXTURE_1D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); 
        glTexParameterf(GL_TEXTURE_1D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); 
        glTexImage1D(GL_TEXTURE_1D,0,3,TEXTUREWIDTH,0, 
                         GL_RGB,GL_UNSIGNED_BYTE,Texture); 
//Ψһ��ǰ�����Ӳ�ͬ�ĵط���������������Զ�������ɻ������� 
//������S 
        glTexGeni(GL_S,GL_TEXTURE_GEN_MODE,GL_OBJECT_LINEAR); 
        glTexGenfv(GL_S,GL_OBJECT_PLANE,sgenparams); 
//�������� 
        glEnable(GL_TEXTURE_1D); 
        glEnable(GL_TEXTURE_GEN_S); 
 
 
//��������       
       glEnable(GL_DEPTH_TEST); 
       glDepthFunc(GL_LESS); 
         
//һЩ��ͼ���ƣ���ϸ�ɲ���VC5������� 
       glEnable(GL_CULL_FACE); 
       glEnable(GL_LIGHTING); 
       glEnable(GL_LIGHT0); 
       glEnable(GL_AUTO_NORMAL); 
       glEnable(GL_NORMALIZE); 
       glFrontFace(GL_CW); 
       glCullFace(GL_BACK); 
       glMaterialf(GL_FRONT,GL_SHININESS,64.0); 
//     glShadeModel(GL_FLAT); 
} 
 
void CALLBACK reshape(GLsizei w,GLsizei h) 
{ 
 
glViewport(0,0,w,h); 
glMatrixMode(GL_PROJECTION); 
glLoadIdentity(); 
 
if(w<=h) 
 glOrtho(-4.0,4.0,-4.0*(GLfloat)h/(GLfloat)w, 
         4.0*(GLfloat)h/(GLfloat)w,-4.0,4.0); 
else 
  glOrtho(-4.0*(GLfloat)h/(GLfloat)w, 
         4.0*(GLfloat)h/(GLfloat)w,-4.0,4.0,-4.0,4.0); 
glMatrixMode(GL_MODELVIEW); 
glLoadIdentity(); 
} 
 
void CALLBACK display(void) 
{ 
  glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); 
  glPushMatrix(); 
  glRotatef(30.0,1.0,0.0,0.0); 
//����ǿ��ĸ���⺯��Ǻǻ���һ������ 
  auxSolidTeapot(1.5); 
  glPopMatrix(); 
  glFlush(); 
} 
void main(void) 
{ 
        myinit(); 
        
    auxReshapeFunc(reshape); 
    auxMainLoop(display); 
} 
//end of sample 
//////////////////////////////////////////////////////////// 
���������ȫ�������Ѿ���ϡ������н��������һ������ȫ������ 
�˱��������ӳ�䡣 
 
-- 
�� ��Դ:��BBS ˮľ�廪վ bbs.net.tsinghua.edu.cn��[FROM: 166.111.74.90] 

BBSˮľ�廪վ�þ�����

�� ��Դ: �й�ƴ�BBSվ [bbs.ustc.edu.cn]
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads