Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualDark Engineer

Posted 22 January 2013 - 05:20 PM

SimpleFragmentShader

#version 150

out vec4 outColor;

void main()
{
    outColor = vec4( 1.0, 1.0, 1.0, 1.0 );
}

SimpleVertexShader

#version 150

in vec2 position;

void main()
{
    gl_Position = vec4( position, 0.0, 1.0 );
}

and function for loading them

string loadShaderFile(const string fileName)
{
    
    ifstream shaderFile( fileName.c_str());

    //find the file size
    shaderFile.seekg(0, ios::end);
    std::streampos length = shaderFile.tellg();
    shaderFile.seekg(0, ios::beg);

    //read whole file into a vector
    vector<char> buffer(length);
    shaderFile.read(&buffer[0], length);

    //return the shader string
    return string( buffer.begin(), buffer.end());
}

I think something is wrong under 53 line but i'm begginer in OpenGL


#3Dark Engineer

Posted 22 January 2013 - 05:18 PM

SimpleFragmentShader

#version 150
out vec4 outColor;void 
main()
{    
outColor = vec4( 1.0, 1.0, 1.0, 1.0 );}

SimpleVertexShader

#version 150in vec2 position;void main(){    gl_Position = vec4( position, 0.0, 1.0 );}

and function for loading them

string loadShaderFile(const string fileName){		ifstream shaderFile( fileName.c_str());	//find the file size	shaderFile.seekg(0, ios::end);	std::streampos length = shaderFile.tellg();	shaderFile.seekg(0, ios::beg);	//read whole file into a vector	vector buffer(length);	shaderFile.read(&buffer[0], length);	//return the shader string	return string( buffer.begin(), buffer.end());}

I think something is wrong under 53 line but i'm begginer in OpenGL


#2Dark Engineer

Posted 22 January 2013 - 05:17 PM

SimpleFragmentShader
#version 150out vec4 outColor;void main(){    outColor = vec4( 1.0, 1.0, 1.0, 1.0 );}
SimpleVertexShader
#version 150in vec2 position;void main(){    gl_Position = vec4( position, 0.0, 1.0 );}
and function for loading them
string loadShaderFile(const string fileName){		ifstream shaderFile( fileName.c_str());	//find the file size	shaderFile.seekg(0, ios::end);	std::streampos length = shaderFile.tellg();	shaderFile.seekg(0, ios::beg);	//read whole file into a vector	vector<char> buffer(length);	shaderFile.read(&buffer[0], length);	//return the shader string	return string( buffer.begin(), buffer.end());}

I think something is wrong under 53 line but i'm begginer in OpenGL

#1Dark Engineer

Posted 22 January 2013 - 02:54 PM

SimpleFragmentShader

#version 150

out vec4 outColor;

void main()
{
    outColor = vec4( 1.0, 1.0, 1.0, 1.0 );
}

SimpleVertexShader

#version 150

in vec2 position;

void main()
{
    gl_Position = vec4( position, 0.0, 1.0 );
}

and function for loading them

 

string loadShaderFile(const string fileName)
{
	
	ifstream shaderFile( fileName.c_str());

	//find the file size
	shaderFile.seekg(0, ios::end);
	std::streampos length = shaderFile.tellg();
	shaderFile.seekg(0, ios::beg);

	//read whole file into a vector
	vector<char> buffer(length);
	shaderFile.read(&buffer[0], length);

	//return the shader string
	return string( buffer.begin(), buffer.end());
}

 


PARTNERS