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?
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.
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?
Um, here's an idea. Why don't you follow that nice link I gave you?pls show an example, or step by step by use vc.
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.