source: trunk/packages/vizservers/nanovis/NvStdVertexShader.cpp @ 2859

Last change on this file since 2859 was 2859, checked in by ldelgass, 8 years ago

No need to inline bind/unbind

  • Property svn:eol-style set to native
File size: 935 bytes
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2#include <stdio.h>
3
4#include "global.h"
5#include "NvStdVertexShader.h"
6
7NvStdVertexShader::NvStdVertexShader()
8{
9    init();
10}
11
12NvStdVertexShader::~NvStdVertexShader()
13{
14}
15
16void NvStdVertexShader::init()
17{
18    _cgVP = LoadCgSourceProgram(g_context, "vertex_std.cg", CG_PROFILE_VP30, 
19                                "main");
20    _mvp_vert_std_param = cgGetNamedParameter(_cgVP, "modelViewProjMatrix");
21    _mvi_vert_std_param = cgGetNamedParameter(_cgVP, "modelViewInv");
22}
23
24void NvStdVertexShader::bind()
25{
26    cgGLSetStateMatrixParameter(_mvp_vert_std_param, CG_GL_MODELVIEW_PROJECTION_MATRIX, CG_GL_MATRIX_IDENTITY);
27    cgGLSetStateMatrixParameter(_mvi_vert_std_param, CG_GL_MODELVIEW_MATRIX, CG_GL_MATRIX_INVERSE);
28    cgGLBindProgram(_cgVP);
29    cgGLEnableProfile(CG_PROFILE_VP30);
30}
31
32void NvStdVertexShader::unbind()
33{
34    cgGLDisableProfile(CG_PROFILE_VP30);
35}
Note: See TracBrowser for help on using the repository browser.