Jump to content

  • Log In with Google      Sign In   
  • Create Account

Sponji

Member Since 14 Jan 2011
Offline Last Active Today, 12:18 PM

Posts I've Made

In Topic: linked list of struct that is derived from another c++

29 April 2016 - 02:38 PM

while (p!= NULL) p = p->next;
return p;

Doesn't that just always return null?


In Topic: X11 + OpenGL causes segfault

08 April 2016 - 12:20 PM

Yeah, but those functions work? Try it where it crashes, because then it would probably give you null pointers, which would mean that the context is not made current.

 

Edit: Or what, do those work or not? Not sure if you've made that clear yet. Do the gl functions work right after creating the context?


In Topic: X11 + OpenGL causes segfault

08 April 2016 - 12:17 PM

Where did you call that glXGetProcAddress? Make sure it works in the same place as where you do the call to glClear.


In Topic: Difference when enabling index buffer before and after GL_ARRAY_BUFFER

06 April 2016 - 10:41 PM

You should show how EnableVAO, EnableVBO and Update methods are implemented. And what is the code for failing render? Since you grouped VAO and vertex buffer lines together, I guess you just bound the index buffer before binding the VAO. Just remember that the VAO should be bound first, because the buffers are bound to it.

glBindVertexArray(vao);
glBindBuffer(...indexbuffer...);
glBindBuffer(...vertexbuffer...);

In Topic: Spritebatch only renders first time

25 March 2016 - 02:12 AM

Maybe I wrote in a silly way, but you need to keep the _numAttributes = 0 line in the dispose method too. That's needed for addAttribute method so that it understands to reset counting from zero.

 

//enable the shader 
void GLSLProgram::use() {
    glUseProgram(_programID);
}

//disable the shader
void GLSLProgram::unuse() {
    glUseProgram(0);
}

void GLSLProgram::dispose() {
    if (_programID) glDeleteProgram(_programID);
    _numAttributes = 0;
}

 


PARTNERS