Jump to content

  • Log In with Google      Sign In   
  • Create Account

akaitora

Member Since 05 Sep 2008
Offline Last Active Dec 17 2015 12:12 PM

Posts I've Made

In Topic: Corrupted Vertex Buffer

16 September 2015 - 10:57 PM

mhagain, thanks for the solution!  That fixed it!  I didn't realized that glVertexAttribPointer required the buffer to be bound before use.  Thanks for the heads up!


In Topic: Corrupted Vertex Buffer

16 September 2015 - 01:13 AM

Any ideas?


In Topic: Corrupted Vertex Buffer

12 September 2015 - 10:32 PM

btw, for my Begin/End shader code,  I am doing the following

 

 
//---------------------------------------------------------------------
void ShaderFx::BeginPass()
{
    glUseProgram(shaderProgram);
    
    if( !modelHasUvs )
    {
        GLint vertexAttribLocation = glGetAttribLocation(shaderProgram, "vertex");
        glEnableVertexAttribArray(vertexAttribLocation);
        glVertexAttribPointer(vertexAttribLocation, 3, GL_FLOAT, GL_FALSE, 0, 0);
    }
    else
    {
        
        GLint vertexAttribLocation = glGetAttribLocation(shaderProgram, "vertex");
        glEnableVertexAttribArray(vertexAttribLocation);
        glVertexAttribPointer(vertexAttribLocation, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), 0);
        
        GLuint texCoordAttribLocation = glGetAttribLocation(shaderProgram, "uv");
        glEnableVertexAttribArray(texCoordAttribLocation);
        glVertexAttribPointer(texCoordAttribLocation, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (const GLvoid*)(3 * sizeof(GLfloat)));
        
    }
}
 
//---------------------------------------------------------------------
void ShaderFx::EndPass()
{
    GLint vertexAttribLocation = glGetAttribLocation(shaderProgram, "vertex");
    GLuint texCoordAttribLocation = glGetAttribLocation(shaderProgram, "uv");
    
    glDisableVertexAttribArray(vertexAttribLocation);
    glDisableVertexAttribArray(texCoordAttribLocation);
}
 

In Topic: Corrupted Vertex Buffer

12 September 2015 - 10:14 PM

Good catch!  Unfortunately I forgot to mention that I am handing the shader for the QuadGeom in a higher level class like so.

 

 
void onRenderImage(ApplicationContext &context)
{
    glClearColor(0.0, 0.3, 0, 1);
    glEnable(GL_DEPTH_TEST);
    
    glViewport(0, 0, context.ResolutionWidth, context.ResolutionHeight);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    
    context.ShaderFx->BeginPass();
    
    context.ShaderFx->SetVector2Parameter("resolution", context.ResolutionWidth, context.ResolutionHeight);
    
    context.ShaderFx->SetFloatParameter("time", context.TimeInSecondsSinceStartup);
    
    
    float mouseX = (float)((context.MouseX - context.WindowPosX)) / context.ResolutionWidth;
    float mouseY = (float)(-(context.MouseY - context.WindowPosY)) / context.ResolutionHeight;
    
    context.ShaderFx->SetVector2Parameter("mouse", mouseX, mouseY);
    
    context.QuadGeo->Render();
    
    context.ShaderFx->EndPass();
    
    glDisable(GL_DEPTH_TEST);
    context.DisplayText->DrawString("", 0, 0);
}
 

 

Any other ideas?  Thanks!


In Topic: Roughness in a Reflection

09 June 2015 - 11:27 AM

So if I understand correctly, from a shader perspective, we sample a cubemap just like we would as normal.  The only difference is that the cubemap is been blurred offline. Perhaps we have multiple versions of the blur per mip map.  


PARTNERS