Jump to content

  • Log In with Google      Sign In   
  • Create Account

Sponji

Member Since 14 Jan 2011
Online Last Active Today, 05:35 AM

#5285537 Difference when enabling index buffer before and after GL_ARRAY_BUFFER

Posted by Sponji on 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...);



#5283346 Spritebatch only renders first time

Posted by Sponji on 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;
}

 




#5283075 How can I locate a memory leak?

Posted by Sponji on 24 March 2016 - 12:07 AM

I started using clang's address sanitizer few months ago, and it seems really awesome compared to slow valgrind. It's even easy to use, just compile and link your program with -fsanitize=address and it will tell you what goes wrong.




#5280006 SDL Renderer Issue

Posted by Sponji on 07 March 2016 - 06:44 AM

You've changed the code? The codes you gave don't initialize it.




#5279995 SDL Renderer Issue

Posted by Sponji on 07 March 2016 - 05:52 AM

You don't seem to initialize Sprite's renderer anywhere?




#5279883 [C++/D3D11] Problem with texturing a model

Posted by Sponji on 06 March 2016 - 04:15 PM

My guess would be that 

ObjectDatas[ArrayCount].texture = m_texture;

should be

ObjectDatas[i].texture = m_texture;



#5246946 Perspective projection makes triangle disapear

Posted by Sponji on 16 August 2015 - 12:49 PM

Good catch. I haven't even paid any attention to those example codes because I've been just using the library for years and checked for the release notes. And the release notes say that it was changed in 0.9.6.0.
 
Stupid internet points though, not sure why I get -6 for bringing that up.



#5246895 Perspective projection makes triangle disapear

Posted by Sponji on 16 August 2015 - 07:33 AM

 

glm::perspective takes fov as radians nowadays. So you probably want to use glm::radians(60.0f).

 

I just checked the glm docs.  http://glm.g-truc.net/glm.pdf

It's not radians, its degrees.

 

 

Check better, that's probably outdated. See http://glm.g-truc.net/0.9.7/api/a00174.html#gac3613dcb6c6916465ad5b7ad5a786175




#5246852 Perspective projection makes triangle disapear

Posted by Sponji on 16 August 2015 - 02:20 AM

glm::perspective takes fov as radians nowadays. So you probably want to use glm::radians(60.0f).




#5218158 Nothing visible when doing indexed drawing

Posted by Sponji on 21 March 2015 - 04:36 PM

So, did it work after you changed it to 6?




#5212673 SDL Texture Relations

Posted by Sponji on 24 February 2015 - 05:17 AM

1) Yes
2) Not sure if you could compare those like that, because textures don't have position or anything, they are just "images". Maybe you could think them as a brushes?
3) Seems right
4) So, you could generate the images for all object types and then create textures(or maybe one bigger texture) from those. But I would just create a single texture for one small tile and render that with SDL_RenderCopy multiple times to correct places on the screen.



#5210846 Disassociate mouse with its position

Posted by Sponji on 15 February 2015 - 09:32 AM

You could also use raw input instead of querying the cursor location. I haven't used that myself, but it should work well: https://msdn.microsoft.com/en-us/library/windows/desktop/ee418864%28v=vs.85%29.aspx.




#5208138 Get started with 'sliding' collision response

Posted by Sponji on 02 February 2015 - 12:22 AM

I usually just separate the movement for the axises.

player.x += movement.x;
if(map.collides(player)) { /* move back on x-axis */ }

player.y += movement.y;
if(map.collides(player)) { /* move back on y-axis */ }



#5206586 Trouble loading and displaying with transparency, 8bit indexed bitmaps

Posted by Sponji on 25 January 2015 - 12:50 PM

I think this line makes your code slow:

color = bitmap.Palette.Entries[index];

Because this says: "This property returns a copy of the ColorPalette object used by this Image."

 

Maybe just grab the palette/entries first so you can access them directly?




#5206500 SDL2 and openGL3-4

Posted by Sponji on 24 January 2015 - 10:02 PM

SDL2 works just fine, just tell it what kind of context you want to create with a few calls to SDL_GL_SetAttribute. It doesn't handle the function pointers for the needed OpenGL functions though, so use GLEW or something similar for that to make your life easier.






PARTNERS