CoffeeandCode

Members
  • Content count

    8
  • Joined

  • Last visited

Community Reputation

188 Neutral

About CoffeeandCode

  • Rank
    Newbie
  1. Taking your last idea: just generate one vbo on the fly with the limbs your player has chosen, rather than having 9.699999 million unused vbo's.
  2. No, they didn't deprecate the creation of framebuffers in the version it was added :L you're probably trying to write to a read-only framebuffer or not loading the correct opengl version in your program.
  3. Have you tried clearing it with glClear(GL_COLOR_BUFFER_BIT) then swapping the buffers? Sounds like you're just looking at a garbage front buffer
  4. If your graphics drivers are any good, it will only do the multiplication once. If your driver can't perform this optimization, switch gpu vendor.
  5. You can't be doing this, its too expensive. If you modify a model matrix, don't update your projection matrix just for shits and giggles, that's inefficient and a huge performance drop. Imagine how many times per second you are doing that! Instead, figure out the offset of each matrix into the buffer and store those indices then whenever you NEED to do an operation, map the buffer and modify the matrix based on one of those indices. Also, instead of working out the model view proj matrix on the CPU, do the multiplication in your shader. GPUs are far better at matrix multiplication in almost any situation.
  6. Instead of answering the question (because I don't know) I'll just suggest you use `glDrawBuffer(GL_NONE)` to explicitly tell it not to draw to a color buffer. I dont use a fragment shader with this setting and Everything runs great.
  7. What exactly is the question? How to open up a context or how to send the render over tcp/ip?
  8. Hello. I have been working on a game engine for a couple of days now and I've had it rendering a colourful cube and playing sounds in OGG format, but, after refractoring my code-base to make things easier it no longer displays the cube! (This happened when I put the shader program and methods into a seperate class) What could be the problem?   OpenGL/SDL2 context class: class RenderContext{ public: RenderContext(); ~RenderContext(); void draw(); //void swapbuffers(); int16_t good; ShaderProgram *program; private: WindowSDL *window; FontLoading *fonts; };       ShaderProgram blass: class ShaderProgram{ public: ShaderProgram(){ } ShaderProgram(const char *vsPath, const char *fsPath){ int32_t compileStat, linkStat; uint32_t vertexS = glCreateShader(GL_VERTEX_SHADER); uint32_t fragS = glCreateShader(GL_FRAGMENT_SHADER); string vsSource = LoadFile(vsPath); string fsSource = LoadFile(fsPath); const char *source = vsSource.c_str(); glShaderSource(vertexS, 1, &source, NULL); source = fsSource.c_str(); glShaderSource(fragS, 1, &source, NULL); glCompileShader(vertexS); glGetShaderiv(vertexS, GL_COMPILE_STATUS, &compileStat); if(compileStat == 0){ char BUFFER[256]; glGetShaderInfoLog(vertexS, sizeof(BUFFER), NULL, BUFFER); cerr << "-!- Error compiling vertex shader: " << BUFFER << endl; good = false; return; } glCompileShader(fragS); glGetShaderiv(fragS, GL_COMPILE_STATUS, &compileStat); if(compileStat == 0){ char BUFFER[256]; glGetShaderInfoLog(fragS, sizeof(BUFFER), NULL, BUFFER); cerr << "-!- Error compiling fragment shader: " << BUFFER << endl; good = false; return; } program = glCreateProgram(); glAttachShader(program, vertexS); glAttachShader(program, fragS); glLinkProgram(program); glGetProgramiv(program, GL_LINK_STATUS, &linkStat); if(!linkStat){ cerr << "-!- Error linking program." << endl; good = false; return; } good = true; } void getUniform(uint32_t &location, const char *uniformName){ location = glGetUniformLocation(program, uniformName); assert(location != 0xFFFFFFFF); } void bind(){ glUseProgram(program); } void unbind(){ glUseProgram(0); } ~ShaderProgram(){ glDeleteProgram(program); glUseProgram(0); } bool good; uint32_t program; };   Included a screenshot of output now and a screenshot of output then. Thanks.   [attachment=14958:Screenshot from 2013-04-16 23:12:34.png] [attachment=14959:Screenshot from 2013-04-18 18:12:26.png]