Jump to content

  • Log In with Google      Sign In   
  • Create Account


Syerjchep

Member Since 23 May 2010
Offline Last Active Mar 31 2014 04:46 PM

Posts I've Made

In Topic: 3d online sandbox world I'd like help testing!

28 March 2014 - 01:51 AM

Seems nice but did you just list "Shaders" as a graphical feature? How else would you render a game these days ? smile.png

Guess I meant this game uses GLSL and OpenGL 3/4 whereas my previous projects were OpenGL 1/2 with fixed function pipelines.
Most of your OpenGL tutorials and thus a disproportionate amount of indie-games using OpenGL use OpenGL 1/2 still.

Added some screenshots to the OP.

In Topic: OpenGL program doesn't start on other peoples computers.

27 March 2014 - 09:12 AM

OK, first run, default settings:

0	: Program started.
0.00	: 4 quotes read.
0.00	: Could not find prefs file, creating with defaults.
0.30	: del --- c2 out of scope --- 
OpenGL error: 1280
0.33	: OpenAL: No Error
0.33	: Networking initalized.
0.33	: Initalized.
0.33	: Using glew version: 1.7.0
0.33	: AMD Radeon HD 6450
0.33	: ATI Technologies Inc.
0.33	: 4.0.12430 Core Profile Context 13.152.1.8000
0.33	: 4.30
0.33	: Opengl version used: 4.0
0.33	: del --- c2 out of scope --- 
OpenGL error: 1280
Before shaders...
Shaders allocated.
Vertex shader length: 2230
Fragment shader length: 7481
0.33	: Compiling shader: shaders/StandardShadingVertex.glsl
v1
v2
v3
0.37	: Vertex Error Message Size: 0,0
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_S_construct null not valid
Second run, LOG_SHADERS 0 .................................. IT WORKS! smile.png
0.33	: Vertex Error Message Size: 0,0
0.33	: Compiling shader: shaders/StandardShadingFragment.glsl
0.34	: Linking program.
0.36	: 
8.38	: UDP opened, address resolved.
8.88	: UDP opened, address resolved.
9.38	: UDP opened, address resolved.
16.49	: Window closed!
16.49	: OpenAL: No Error
16.64	: 0 frames ran.
16.64	: 16.6419 current time.
16.64	: 16.643 seconds elapsed.
16.64	: 0 fps average.
0	: Ended program.

Wow man, thanks a ton!
Can't believe all this time it had nothing to do with OpenGL at all lol

In Topic: OpenGL program doesn't start on other peoples computers.

27 March 2014 - 08:41 AM

Okeydokey, here's the latest stderr:

0	: Program started.
0.00	: 4 quotes read.
0.00	: Could not find prefs file, creating with defaults.
0.31	: r loading model --- b3 out of scope --- 
OpenGL error: 1280
0.38	: OpenAL: No Error
0.38	: Networking initalized.
0.38	: Initalized.
0.38	: Using glew version: 1.7.0
0.38	: AMD Radeon HD 6450
0.38	: ATI Technologies Inc.
0.38	: 4.0.12430 Core Profile Context 13.152.1.8000
0.38	: 4.30
0.38	: Opengl version used: 4.0
0.38	: r loading model --- b3 out of scope --- 
OpenGL error: 1280
Before shaders...
Shaders allocated.
Vertex shader length: 2230
Fragment shader length: 7481
0.38	: Compiling shader: shaders/StandardShadingVertex.glsl
v1
v2
v3
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_S_construct null not valid
InfoLogLength is 0 perhaps?

This is actually extremely helpful.
Well, I uploaded a new version.
This time there's a new setting in settings.txt.
Change LOG_SHADERS to 0 then try launching it.

In Topic: OpenGL program doesn't start on other peoples computers.

27 March 2014 - 07:08 AM

Well I looked up the error and all I got was "a string was constructed from a NULL char".
Basically I've edited my shader to look like this:
GLuint LoadShaders(const char * vertex_file_path,const char * fragment_file_path)
{
    try
    {
        checkForGLError();
        cerr<<"Before shaders...\n";
        // Create the shaders
        GLuint VertexShaderID = glCreateShader(GL_VERTEX_SHADER);
        GLuint FragmentShaderID = glCreateShader(GL_FRAGMENT_SHADER);

        cerr<<"Shaders allocated.\n";
        checkForGLError();

        // Read the Vertex Shader code from the file
        std::string VertexShaderCode;
        std::ifstream VertexShaderStream(vertex_file_path, std::ios::in);
        if(VertexShaderStream.is_open())
        {
            std::string Line = "";
            while(getline(VertexShaderStream, Line))
                VertexShaderCode += "\n" + Line;
            VertexShaderStream.close();
        }

        cerr<<"Vertex shader length: "<<VertexShaderCode.length()<<"\n";
        checkForGLError();

        // Read the Fragment Shader code from the file
        std::string FragmentShaderCode;
        std::ifstream FragmentShaderStream(fragment_file_path, std::ios::in);
        if(FragmentShaderStream.is_open()){
            std::string Line = "";
            while(getline(FragmentShaderStream, Line))
                FragmentShaderCode += "\n" + Line;
            FragmentShaderStream.close();
        }

        cerr<<"Fragment shader length: "<<FragmentShaderCode.length()<<"\n";
        checkForGLError();

        GLint Result = GL_FALSE;
        int InfoLogLength;

        // Compile Vertex Shader
        log("Compiling shader: "+string(vertex_file_path));
        char const * VertexSourcePointer = VertexShaderCode.c_str();
        cerr<<"v1\n";
        glShaderSource(VertexShaderID, 1, &VertexSourcePointer , NULL);
        checkForGLError();
        cerr<<"v2\n";
        glCompileShader(VertexShaderID);
        cerr<<"v3\n";
        checkForGLError();

        // Check Vertex Shader
        glGetShaderiv(VertexShaderID, GL_COMPILE_STATUS, &Result);
        glGetShaderiv(VertexShaderID, GL_INFO_LOG_LENGTH, &InfoLogLength);
        std::vector<char> VertexShaderErrorMessage(InfoLogLength);
        glGetShaderInfoLog(VertexShaderID, InfoLogLength, NULL, &VertexShaderErrorMessage[0]);
        log(&VertexShaderErrorMessage[0]);

        checkForGLError();

        // Compile Fragment Shader
        log("Compiling shader: "+string(fragment_file_path));
        char const * FragmentSourcePointer = FragmentShaderCode.c_str();
        glShaderSource(FragmentShaderID, 1, &FragmentSourcePointer , NULL);
        glCompileShader(FragmentShaderID);

        checkForGLError();

        // Check Fragment Shader
        glGetShaderiv(FragmentShaderID, GL_COMPILE_STATUS, &Result);
        glGetShaderiv(FragmentShaderID, GL_INFO_LOG_LENGTH, &InfoLogLength);
        std::vector<char> FragmentShaderErrorMessage(InfoLogLength);
        glGetShaderInfoLog(FragmentShaderID, InfoLogLength, NULL, &FragmentShaderErrorMessage[0]);
        log(&FragmentShaderErrorMessage[0]);

        checkForGLError();

        // Link the program
        log("Linking program.");
        GLuint ProgramID = glCreateProgram();
        glAttachShader(ProgramID, VertexShaderID);
        glAttachShader(ProgramID, FragmentShaderID);
        glLinkProgram(ProgramID);

        checkForGLError();

        // Check the program
        glGetProgramiv(ProgramID, GL_LINK_STATUS, &Result);
        glGetProgramiv(ProgramID, GL_INFO_LOG_LENGTH, &InfoLogLength);
        std::vector<char> ProgramErrorMessage( max(InfoLogLength, int(1)) );
        glGetProgramInfoLog(ProgramID, InfoLogLength, NULL, &ProgramErrorMessage[0]);
        log(&ProgramErrorMessage[0]);

        checkForGLError();

        glDeleteShader(VertexShaderID);
        glDeleteShader(FragmentShaderID);

        return ProgramID;
    }
    catch(int exc)
    {
        log("Making shader threw exception: "+ istr(exc));
    }
}
Where checkForGLError is defined as:
void checkForGLError()
{
    GLenum err;
	while ((err = glGetError()) != GL_NO_ERROR)
    {
        log("OpenGL error: " + err);
		cerr << "OpenGL error: " << err << endl;
	}
}
Basically if an exception is thrown I'll know.
I know the lengths of the strings before the code attempts to compile them.
I know which step in compiling it gets to (v1,v2,v3)
And if there are any glErrors thrown I'll hopefully see them.



If at your convince you or someone else could redownload the program, run it, and post stderr.txt (it'll have more information than logfile.txt) that'd be great.

In Topic: OpenGL program doesn't start on other peoples computers.

26 March 2014 - 11:20 PM

Well I've implemented plenty of glGetError calls but now need to upload the new version of the program and find someone with an AMD processor.

Also, is it bad if my vertex shader is version 330 core but my fragment shader is version 150 and they're run with each other?

PARTNERS