Jump to content
  • Advertisement

Balajanovski

Member
  • Content Count

    7
  • Joined

  • Last visited

Community Reputation

112 Neutral

About Balajanovski

  • Rank
    Newbie

Personal Information

  • Interests
    |programmer|
  1. Balajanovski

    Trouble with GLSL shaders

    Well, I've fixed it now, here is the new code: The reason its longer is because I've now included the whole function GLuint shader_frag = 0; GLuint shader_prog = 0; shader_prog = glCreateProgram(); shader_frag = glCreateShader(GL_FRAGMENT_SHADER); std::string shader_file; std::ifstream is(shader_src); std::string temp_str; while (is >> temp_str) shader_file += temp_str + ' '; is.close(); std::cout << shader_file << std::endl; GLchar *shader_file_c = new GLchar[shader_file.length() + 1]; std::strcpy(shader_file_c, shader_file.c_str()); GLint len = shader_file.length(); glShaderSource(shader_frag, 1, (const GLchar **) &shader_file_c, &len); delete[] shader_file_c; glCompileShader(shader_frag); glAttachShader(shader_prog, shader_frag); glLinkProgram(shader_prog); return shader_prog;
  2. Balajanovski

    Trouble with GLSL shaders

    That's odd, because the shaders are working fine 
  3. Balajanovski

    Trouble with GLSL shaders

    Recently I was trying to add shaders to my game. I have gotten it to work but I feel like this code is too "shonky" and too C-style. Any suggestions for ways to clean this code up and remove the dangerous C-style casts would be welcome. std::string shader_file; std::ifstream is(shader_src); is >> shader_file; is.close(); GLchar *shader_file_c = new GLchar[shader_file.length() + 1]; std::strcpy(shader_file_c, shader_file.c_str()); delete[] shader_file_c; GLint len = shader_file.length(); glShaderSourceARB(shader_frag, 1, (const GLchar **) &shader_file_c, &len); glCompileShaderARB(shader_frag); glAttachObjectARB(shader_prog, shader_frag); glLinkProgramARB(shader_prog);
  4. Balajanovski

    SDL Window not showing up

    @fastcall22 Thank you very much that fixed it
  5. Balajanovski

    SDL Window not showing up

    Recently I have been attempting to recreate the arcade game Tron. I initialise SDL and I create the window and renderer, yet, for some reason the window doesn't even show up. The executable opens, yet there is no window. If anyone could shed some insight onto the issue, that would be more than appreciated.   Github repository link: https://github.com/Balajanovski/tron-clone   Github latest commit link: https://github.com/Balajanovski/tron-clone/commit/76bde01fc8010fed119b9b895daf19dc36a2ff6f
  6. Balajanovski

    Issues With SDL FPS

    Thank you for pointing me to such a good article
  7. Balajanovski

    Issues With SDL FPS

    I have recently been attempting to recreate the game Tetris with SDL. The only problem I'm having is that the game runs too fast when I set it to 60 FPS. Does anyone have any suggestions unto how to slow down my game without lowering the FPS.   Github repository: https://github.com/Balajanovski/tetris-clone   Current commit: https://github.com/Balajanovski/tetris-clone/commit/c82fb962da9ae0e9c9913dec89d37ba95c9133f0
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!