ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libgender/test.C
(Generate patch)

Comparing libgender/test.C (file contents):
Revision 1.28 by root, Tue Oct 5 06:03:32 2004 UTC vs.
Revision 1.29 by root, Tue Oct 5 07:09:17 2004 UTC

7#include "SDL_opengl.h" 7#include "SDL_opengl.h"
8 8
9static SDL_Surface *global_image = NULL; 9static SDL_Surface *global_image = NULL;
10static GLuint global_texture = 0; 10static GLuint global_texture = 0;
11 11
12#include "util.h"
12#include "entity.h" 13#include "entity.h"
13
14#include "txtprt_import.h" 14#include "txtprt_import.h"
15
16CGcontext cgc;
17CGprogram vsh, fsh;
18CGparameter mv, mvp;
19
20static void CheckCgError(void)
21{
22 CGerror err = cgGetError();
23
24 if (err != CG_NO_ERROR)
25 {
26 printf("CG error: %s\n", cgGetErrorString(err));
27 exit(1);
28 }
29}
15 30
16/**********************************************************************/ 31/**********************************************************************/
17 32
18view camera; 33view camera;
19vec3 camera_velocity; 34vec3 camera_velocity;
361 //GLfloat lightc[4] = { 1, 0.1, 0.1, 1 }; 376 //GLfloat lightc[4] = { 1, 0.1, 0.1, 1 };
362 //glLightf (GL_LIGHT0, GL_QUADRATIC_ATTENUATION); 377 //glLightf (GL_LIGHT0, GL_QUADRATIC_ATTENUATION);
363 //glLightfv (GL_LIGHT0, GL_DIFFUSE, lightc); 378 //glLightfv (GL_LIGHT0, GL_DIFFUSE, lightc);
364 glEnable (GL_LIGHT0); 379 glEnable (GL_LIGHT0);
365 380
381 cgc = cgCreateContext ();
382 vsh = cgCreateProgramFromFile (cgc, CG_SOURCE, "vsh.cg", CG_PROFILE_ARBVP1, 0, 0);
383 CheckCgError ();
384 cgGLLoadProgram (vsh);
385 CheckCgError ();
386 mv = cgGetNamedParameter (vsh, "WorldProj");
387 CheckCgError ();
388 mvp = cgGetNamedParameter (vsh, "WorldViewProj");
389 CheckCgError ();
390 cgGLEnableProfile (CG_PROFILE_ARBVP1);
391 CheckCgError ();
392
393 fsh = cgCreateProgramFromFile (cgc, CG_SOURCE, "fsh.cg", CG_PROFILE_ARBFP1, 0, 0);
394 cgGLLoadProgram (fsh);
395 cgGLEnableProfile (CG_PROFILE_ARBFP1);
396
397 cgGLBindProgram (vsh);
398 cgGLBindProgram (fsh);
399
366 /* Loop until done. */ 400 /* Loop until done. */
367 start_time = SDL_GetTicks (); 401 start_time = SDL_GetTicks ();
368 frames = 0; 402 frames = 0;
369 403
370 draw_context c (camera); 404 draw_context c (camera);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines