equal
deleted
inserted
replaced
29 #include "context.h" |
29 #include "context.h" |
30 #include "util.h" |
30 #include "util.h" |
31 |
31 |
32 DGLContext* DGLContext_create(void* native_context) |
32 DGLContext* DGLContext_create(void* native_context) |
33 { |
33 { |
34 DGLContext* ctx = malloc(sizeof(DGLContext)); |
34 DGLContext* ctx = (DGLContext*)malloc(sizeof(DGLContext)); |
35 if(ctx == NULL) |
35 if(ctx == NULL) |
36 { |
36 { |
37 return NULL; |
37 return NULL; |
38 } |
38 } |
39 |
39 |
59 ctx->renderbuffers = NULL; |
59 ctx->renderbuffers = NULL; |
60 |
60 |
61 ctx->hgl.GetIntegerv(GL_MAX_VERTEX_ATTRIBS, &temp); |
61 ctx->hgl.GetIntegerv(GL_MAX_VERTEX_ATTRIBS, &temp); |
62 ctx->max_vertex_attribs = temp; |
62 ctx->max_vertex_attribs = temp; |
63 |
63 |
64 ctx->vertex_arrays = malloc(ctx->max_vertex_attribs * sizeof(DGLVertexArray)); |
64 ctx->vertex_arrays = (DGLVertexArray*)malloc(ctx->max_vertex_attribs * sizeof(DGLVertexArray)); |
65 if(ctx->vertex_arrays == NULL) |
65 if(ctx->vertex_arrays == NULL) |
66 { |
66 { |
67 return GL_FALSE; |
67 return GL_FALSE; |
68 } |
68 } |
69 |
69 |
361 shader->length = 0; |
361 shader->length = 0; |
362 |
362 |
363 DGLES2_ASSERT(source != NULL); |
363 DGLES2_ASSERT(source != NULL); |
364 DGLES2_ASSERT(length >= 0); |
364 DGLES2_ASSERT(length >= 0); |
365 |
365 |
366 shader->source = malloc(length + 1); |
366 shader->source = (char*)malloc(length + 1); |
367 if(shader->source == NULL) |
367 if(shader->source == NULL) |
368 { |
368 { |
369 return GL_FALSE; |
369 return GL_FALSE; |
370 } |
370 } |
371 strncpy(shader->source, source, length); |
371 strncpy(shader->source, source, length); |