Cg and OpenGL

Cg and OpenGL - Class overview and Bedich Bene Ph.D Purdue...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
9/27/2010 1 and Bed ř ich Beneš, Ph.D. Purdue University Department of Computer Graphics © Bedrich Benes Class overview how to link OpenGL and Cg 1. create the Cg context 2. define programs 3. load vp and fp 4. enable/disable profile 5. bind vps and fps © Bedrich Benes Create the Cg context Say that a Cg will be used - context Cg context is a container for Cg programs usually one per program static CGcontext context=NULL; context= cgCreateContext() ; if (!context) exit(-1); //the entire program goes here… cgDestroyContext(context); © Bedrich Benes Define programs Define variables for programs programs are loaded and compiled one program – one variable static CGprogram vp=NULL,fp=NULL; vp= cgCreateProgramFromFile (context,CG_SOURCE,”", CG_PROFILE_VP40,”entryVP”,NULL); fp= cgCreateProgramFromFile (context,CG_SOURCE,”", CG_PROFILE_FP40,”entryFP”,NULL);
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
9/27/2010 2 © Bedrich Benes Define programs CGprogram cgCreateProgramFromFile( CGcontext context, CGenum program_type, const char *file, CGprofile profile, const char *entry, const char **args); context: cgContext to which this is added program_type: CG_SOURCE, CG_OBJECT file: filename
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/19/2012 for the course CGT 411 taught by Professor Staff during the Spring '08 term at Purdue.

Page1 / 5

Cg and OpenGL - Class overview and Bedich Bene Ph.D Purdue...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online