Jump to content

  • Log In with Google      Sign In   
  • Create Account

Sponji

Member Since 14 Jan 2011
Offline Last Active Today, 09:43 AM

Posts I've Made

In Topic: Is SDL the right or wrong choice for my engine?

03 September 2016 - 01:55 AM

I've been using SDL for years and I think it's just awesome to get stuff working crossplatform much easier. But of course it still takes time to get some specific things working in some weird situations. Probably took me a few days to get my little framework working with Emscripten the first time I used it, mostly because of a shader bug which only happened on Chromium.

 

I think you're in the right direction with designing it to work with different libraries, the final game under your framework/engine shouldn't care what library is creating the graphics contexts or processing input events or whatever. You can even make your own code for handling those later on, if it's really needed. Just don't spend too much time on making some random wrapper classes at first. Make it work with one library first and clean up if/when you realize something could be done better.


In Topic: [OGL] Textures are not displaying properly

25 May 2016 - 12:20 PM

And you've made sure the shaders compile fine? Does glGetUniformLocation return valid location? Did you bind the attribute locations correctly? Btw, AMD's CodeXL is the new gDEBugger.


In Topic: [OGL] Textures are not displaying properly

25 May 2016 - 11:47 AM

I don't see anything wrong with the vertex attributes, but yeah, it's usually unnecessary to disable them. You can just set up everything in your VAO and its buffers and attributes will be remembered next time you bind the VAO.

 

One problem could be with your glUniform call, you're passing weird stuff for it, you shouldn't use texture id for it. Maybe that's not the actual problem if the texture id is a sane number for glActiveTexture call, but at least I'd suggest fixing that one.

GLuint texture_id = ...;
int index = 0;
glActiveTexture(GL_TEXTURE0 + index);
glUniform1i(shader.getUniformLocation("sampler"), index);
glBindTexture(GL_TEXTURE_2D, texture_id);

In Topic: glMultiDrawArrays does not render properly

23 May 2016 - 02:10 PM

And did you try using byte offset for glBufferSubData and index offset for glMultiDrawArrays?


In Topic: glMultiDrawArrays does not render properly

23 May 2016 - 01:55 PM

I haven't used multidraw things myself, but isn't your offset wrong? Shouldn't it be the index for the first vertex, and not the byte offset?

// Offset += (VertexBuffer.size() * sizeof(GLfloat));
Offset += ShapeVertices.size()

PARTNERS