GLSL Issue, How to add this file to vc2010?

the file name, basic.vert,
//
#version 400
in vec3 VertexPosition;
in vec3 VertexColor;

out vec3 Color;

void main()
{
Color =VertexColor;
gl_Position = vec4(VertexPosition,1.0);
}
How to add it in vc?

and this , name basic.frag /// they are for gl4.0 sample.
#version 400
in vec3 Color;
out vec4 FragColor;

void main()
{
FragColor = vec4(Color,1.0);
}
////////////////////////////////
The main app is
#pragma comment(lib,“glew32.lib”)

#include <GL/glew.h>
#include “textfile.h”

#include <GL/glut.h>
#include <iostream>
using namespace std;

GLuint vShader,fShader;

float positionData[] = {
-0.8f, -0.8f, 0.0f,
0.8f, -0.8f, 0.0f,
0.0f, 0.8f, 0.0f };

float colorData[] = {
1.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 1.0f };

GLuint vaoHandle;//vertex array object

How? You don’t. This are plain data-files, your exe has to read. Nothing, VS has to compile. After compiling your exe, put them into the Debug-Folder in your Solution-Folder, thats (as default) your “current workingdir” when you start your exe.

You mean compile them, basic.vert and basic.frag individually into each *.exe, then put the *.exe into debug dir with main prog, then run the main program?

No, he means to stick the text files there.

You compile shaders during your program’s execution, not at C/C++ compile time.

I mean how to use them in vc2010, if not use their special complier like NVIDIA FxComposer etc.

You use them in VC2010 no differently than in any other toolchain.

The compiler you use is the one that happens at runtime, not at your program’s compile time. You load a text file that contains your shader’s text, you stick that text string into OpenGL, and out comes a compiled, linked program object.

This happens no matter what compiler you use for C++.

pls show an example, or step by step by use vc. is it:
stck the two files to the debug fold with mainglslpro.exe?

pls show an example, or step by step by use vc.

Um, here’s an idea. Why don’t you follow that nice link I gave you?

And more importantly, if you can’t even load a file in a C++ program without someone giving you code to copy-and-paste from, you aren’t ready to be doing graphics at all. Learn how to use C++ for a while, then you can learn how to do graphics programming in it.

[QUOTE=Alfonse Reinheart;1264796]You use them in VC2010 no differently than in any other toolchain.

The compiler you use is the one that happens at runtime, not at your program’s compile time. You load a text file that contains your shader’s text, you stick that text string into OpenGL, and out comes a compiled, linked program object.

This happens no matter what compiler you use for C++.[/QUOTE]
the doc is too loong to read, is there any simpe step to describe how to use it under vc?

Writing your code for you will do neither of us any good. Also, if you’d actually bothered to even skim that page, you’d find perfectly complete example code showing how to compile shaders.

Also, why do you keep asking about “under vc”? As has been explained to you, which compiler you use is irrelevant!

[QUOTE=Alfonse Reinheart;1264798]Um, here’s an idea. Why don’t you follow that nice link I gave you?

And more importantly, if you can’t even load a file in a C++ program without someone giving you code to copy-and-paste from, you aren’t ready to be doing graphics at all. Learn how to use C++ for a while, then you can learn how to do graphics programming in it.[/QUOTE]
There iis load file func,
initShader(“basic.vert”,“basic.frag”);

initVBO();

wherever I put the files, even give the whole path, still fail execution

const GLchar *vShaderCode = textFileRead(VShaderFile);
and
const GLubyte *vendor = glGetString( GL_VENDOR );//////—<here is error pointer.
const GLubyte *version = glGetString( GL_VERSION );
const GLubyte *glslVersion =
glGetString( GL_SHADING_LANGUAGE_VERSION );
GLint major, minor;
glGetIntegerv(GL_MAJOR_VERSION, &major);
glGetIntegerv(GL_MINOR_VERSION, &minor);
cout << “GL Vendor :” << vendor << endl;
cout << "GL Renderer : " << renderer << endl;
cout << "GL Version (string) : " << version << endl;
cout << "GL Version (integer) : " << major << “.” << minor << endl; //here get a strange number
cout << "GLSL Version : " << glslVersion << endl;

when run to this statement, get a error pointer vShaderCode.
cxx0030 can’t count expresssion.
what’s matter?

they show
vendor nvidia corp
renderer geforce 9600gt
version <string> 2.1.2
version <integer> -858993460.-858993460 //////not a simple number
glsl version 1.20 nividia via cg compiler

is there any matter with version of nividia card?

You are now asking about basic C++ (aka: how to read a text file). That’s not an appropriate question for an OpenGL forum.

version <string> 2.1.2
version <integer> -858993460.-858993460 //////not a simple number

That’s uninitialized memory. Likely due to the fact that the OpenGL version is 2.1, and therefore the integer-fetching functions didn’t exist yet.

What tool are you using that prints this?

[QUOTE=Alfonse Reinheart;1264800]Writing your code for you will do neither of us any good. Also, if you’d actually bothered to even skim that page, you’d find perfectly complete example code showing how to compile shaders.

Also, why do you keep asking about “under vc”? As has been explained to you, which compiler you use is irrelevant![/QUOTE]
for I m using vc at present to compile this file. I dont know other compiler, either. I think a skillful programmer out there will find the error as soon as possible, more power than I read the doc to find the error.

[QUOTE=Alfonse Reinheart;1264806]You are now asking about basic C++ (aka: how to read a text file). That’s not an appropriate question for an OpenGL forum.

That’s uninitialized memory. Likely due to the fact that the OpenGL version is 2.1, and therefore the integer-fetching functions didn’t exist yet.

What tool are you using that prints this?[/QUOTE]

no other than ctl-v, ctl-c.

and yet the vendor has nothing to do with this statement:
const GLchar *vShaderCode = textFileRead(VShaderFile);
and it has also got error pointer.

the matter is solved.