#include <iostream>#include <fstream>#include <string>#include "gl.h"#include "glext.h"#include "fragmentprog.h"Include dependency graph for fragmentprog.cpp:

Go to the source code of this file.
Functions | |
| static int | findLineNumber (const string &s, unsigned int index) |
| static bool | LoadNvFragmentProgram (const string &filename, unsigned int &id) |
| static string * | ReadTextFromFile (const string &filename) |
|
||||||||||||
|
Definition at line 73 of file fragmentprog.cpp. Referenced by LoadARBVertexProgram(). 00074 {
00075 if (index >= s.length())
00076 return -1;
00077
00078 int lineno = 1;
00079 for (unsigned int i = 0; i < index; i++)
00080 {
00081 if (s[i] == '\n')
00082 lineno++;
00083 }
00084
00085 return lineno;
00086 }
|
|
||||||||||||
|
Definition at line 89 of file fragmentprog.cpp. References _, GL_FRAGMENT_PROGRAM_NV, GL_PROGRAM_ERROR_POSITION_NV, GL_PROGRAM_ERROR_STRING_NV, glx::glGenProgramsNV, glx::glLoadProgramNV, and ReadTextFromFile(). Referenced by fp::initNV(). 00090 {
00091 cout << _("Loading NV fragment program: ") << filename << '\n';
00092
00093 string* source = ReadTextFromFile(filename);
00094 if (source == NULL)
00095 {
00096 cout << _("Error loading NV fragment program: ") << filename << '\n';
00097 return false;
00098 }
00099
00100 glx::glGenProgramsNV(1, (GLuint*) &id);
00101 glx::glLoadProgramNV(GL_FRAGMENT_PROGRAM_NV,
00102 id,
00103 source->length(),
00104 reinterpret_cast<const GLubyte*>(source->c_str()));
00105
00106 delete source;
00107
00108 GLenum err = glGetError();
00109 if (err != GL_NO_ERROR)
00110 {
00111 GLint errPos = 0;
00112 glGetIntegerv(GL_PROGRAM_ERROR_POSITION_NV, &errPos);
00113 cout << _("Error in fragment program ") << filename << ' ' <<
00114 glGetString(GL_PROGRAM_ERROR_STRING_NV) << '\n';
00115 return false;
00116 }
00117
00118 return true;
00119 }
|
|
|
Definition at line 57 of file fragmentprog.cpp. Referenced by LoadARBVertexProgram(), LoadNvFragmentProgram(), and LoadNvVertexProgram(). 00058 {
00059 ifstream textFile(filename.c_str(), ios::in);
00060 if (!textFile.good())
00061 return NULL;
00062
00063 string* s = new string();
00064
00065 char c;
00066 while (textFile.get(c))
00067 *s += c;
00068
00069 return s;
00070 }
|
1.4.1