c++ - LoadShader Identifier not Found -
This is my code so far (I write it with the book (OpenGL 2.0 2.0 Programming Guide): I have precompiled header names Used "pch.h"
#included "PPH" typefiff structure {glument programdata; }user data; Presenting zero (escontex * escntex); Init Init (Escrontex * Escntex); Int main () {ESContext escontext; UserData userData; EsInitContext (& escontext); Escontext.userData = & amp; UserData; EsCreateWindow (& escontext, L "Hello World!", 800, 600, ES_WINDOW_RGB); EsRegisterDrawFunc (& escontext, render); EsMainLoop (& escontext); } Int init (ESContext * escontex) {UserData * userData; Const char vShaderStr [] = "attribute vec4 vPosition; \ n" "zero main () \ n" "{\ n" "gl_Position = vPosition; \ n" "} \ n"; Const char fShaderStr [] = "Precise menu float; \ n" "Zero main () \ n" "{\ n" "gl_FragColor (1.0.0.0.1.0.1.0); \ n" "}; \ n"; Glume program object Glutton vertex sha ader; Glume slice shredder; VertexShader = Loadshader (GL_VERTEX_SHADER, vShaderStr); Section shader = loadshader (GL_FRAGMENT_SHADER, fShaderStr); ProgramObject = glCreate program (); If (ProgramAbact == 0) returned to 0; GlashShashder (Program Object, Vertex Shader); Glutash shader (program object, fradament shader); GlBindAttribLocation (Program Object, 0, "vPosition"); GlLinkProgram (programObject); UserData-> Program Data = Program Objects; GlUseProgram (userData-> ProgramData); } Glutton loadshader (Zelenam type, Cons Chahre * Shader SRC) {Glutton Shader; GLint Compilation; Shader = glCreateShader (type); If (shader == 0) returned to 0; Gladshaders Source (Shader, 1, and Shader SRC, Nouvel); GlCompileShader (shader); Glascivious (Shader, GLNGIMIMLISTUS, and compiling); Returning smooth; } Zero render (ehontax * esnettex) {glViewport (0, 0, escontex-> width, escnette-> height); GlClear (GL_COLOR_BUFFER_BIT); GLfloat vVertices [] = {0.0f, 0.5f, 0.0f, -0.5f, -0.5f, 0.0f, 0.5f, -0.5f, 0.0f}; GlVertexAttribPointer (0, 3, GL_FLOAT, GL_FALSE, 0, vVertices); GlEnableVertexAttribArray (0); Glaudrares (GL tracts, 0, 3); Eaglas Apchufers (Escnette-> Eagle Display, Escnette-> Eagle Suffice); } My problem occurs when I compile it I get an error: "Loadsheath Identifier not found!"
> Before you define it, Calling LoadShader () to fix this issue, declare a function at the top of your file. Type "PPH" to start {GLuint programData; }user data; Presenting zero (escontex * escntex); Init Init (Escrontex * Escntex); // This line is the new glutton loadshare (GLenum type, const char * shaderSrc); Int main () {ESContext escontext; ...
Comments
Post a Comment