mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
OpenGL: Add GLEW-inspired dynamic function loading
This commit is contained in:
parent
8a6a520026
commit
54423f6583
21 changed files with 23934 additions and 525 deletions
|
|
@ -419,18 +419,18 @@ struct ShaderPrograms : public ReferenceCountedObject
|
|||
screenBounds.set (bounds.getX(), bounds.getY(), 0.5f * bounds.getWidth(), 0.5f * bounds.getHeight());
|
||||
}
|
||||
|
||||
void bindAttributes (OpenGLContext& context)
|
||||
void bindAttributes()
|
||||
{
|
||||
context.extensions.glVertexAttribPointer ((GLuint) positionAttribute.attributeID, 2, GL_SHORT, GL_FALSE, 8, nullptr);
|
||||
context.extensions.glVertexAttribPointer ((GLuint) colourAttribute.attributeID, 4, GL_UNSIGNED_BYTE, GL_TRUE, 8, (void*) 4);
|
||||
context.extensions.glEnableVertexAttribArray ((GLuint) positionAttribute.attributeID);
|
||||
context.extensions.glEnableVertexAttribArray ((GLuint) colourAttribute.attributeID);
|
||||
gl::glVertexAttribPointer ((GLuint) positionAttribute.attributeID, 2, GL_SHORT, GL_FALSE, 8, nullptr);
|
||||
gl::glVertexAttribPointer ((GLuint) colourAttribute.attributeID, 4, GL_UNSIGNED_BYTE, GL_TRUE, 8, (void*) 4);
|
||||
gl::glEnableVertexAttribArray ((GLuint) positionAttribute.attributeID);
|
||||
gl::glEnableVertexAttribArray ((GLuint) colourAttribute.attributeID);
|
||||
}
|
||||
|
||||
void unbindAttributes (OpenGLContext& context)
|
||||
void unbindAttributes()
|
||||
{
|
||||
context.extensions.glDisableVertexAttribArray ((GLuint) positionAttribute.attributeID);
|
||||
context.extensions.glDisableVertexAttribArray ((GLuint) colourAttribute.attributeID);
|
||||
gl::glDisableVertexAttribArray ((GLuint) positionAttribute.attributeID);
|
||||
gl::glDisableVertexAttribArray ((GLuint) colourAttribute.attributeID);
|
||||
}
|
||||
|
||||
OpenGLShaderProgram::Attribute positionAttribute, colourAttribute;
|
||||
|
|
@ -1314,7 +1314,7 @@ struct StateHelpers
|
|||
|
||||
activeShader = &shader;
|
||||
shader.program.use();
|
||||
shader.bindAttributes (context);
|
||||
shader.bindAttributes();
|
||||
|
||||
if (shader.onShaderActivated)
|
||||
shader.onShaderActivated (shader.program);
|
||||
|
|
@ -1341,7 +1341,7 @@ struct StateHelpers
|
|||
if (activeShader != nullptr)
|
||||
{
|
||||
quadQueue.flush();
|
||||
activeShader->unbindAttributes (context);
|
||||
activeShader->unbindAttributes();
|
||||
activeShader = nullptr;
|
||||
context.extensions.glUseProgram (0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue