Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions project/src/graphics/opengl/OpenGLBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1678,12 +1678,15 @@ namespace lime {

value result = alloc_empty_object ();

std::string buffer (GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, 0);
GLsizei maxLength = 0;
glGetProgramiv (program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxLength);

std::string buffer (maxLength, 0);
GLsizei outLen = 0;
GLsizei size = 0;
GLenum type = 0;

glGetActiveAttrib (program, index, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &outLen, &size, &type, &buffer[0]);
glGetActiveAttrib (program, index, maxLength, &outLen, &size, &type, &buffer[0]);

buffer.resize (outLen);

Expand All @@ -1698,17 +1701,22 @@ namespace lime {

HL_PRIM vdynamic* HL_NAME(hl_gl_get_active_attrib) (int program, int index) {

char buffer[GL_ACTIVE_ATTRIBUTE_MAX_LENGTH];
GLsizei maxLength = 0;
glGetProgramiv (program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxLength);

char* buffer = (char*)malloc (maxLength);
GLsizei outLen = 0;
GLsizei size = 0;
GLenum type = 0;

glGetActiveAttrib (program, index, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &outLen, &size, &type, &buffer[0]);
glGetActiveAttrib (program, index, maxLength, &outLen, &size, &type, &buffer[0]);

char* _buffer = (char*)malloc (outLen + 1);
memcpy (_buffer, &buffer, outLen);
_buffer[outLen] = '\0';

free (buffer);

const int id_size = hl_hash_utf8 ("size");
const int id_type = hl_hash_utf8 ("type");
const int id_name = hl_hash_utf8 ("name");
Expand Down