#include <assert.h>
#include "opengl.h"
#include "mesh.h"
+#include "logger.h"
//#include "xform_node.h"
#define USE_OLDGL
float *Mesh::set_attrib_data(int attrib, int nelem, unsigned int num, const float *data)
{
if(attrib < 0 || attrib >= NUM_MESH_ATTR) {
- fprintf(stderr, "%s: invalid attrib: %d\n", __FUNCTION__, attrib);
+ error_log("%s: invalid attrib: %d\n", __FUNCTION__, attrib);
return 0;
}
if(nverts && num != nverts) {
- fprintf(stderr, "%s: attribute count missmatch (%d instead of %d)\n", __FUNCTION__, num, nverts);
+ error_log("%s: attribute count missmatch (%d instead of %d)\n", __FUNCTION__, num, nverts);
return 0;
}
nverts = num;
float *Mesh::get_attrib_data(int attrib)
{
if(attrib < 0 || attrib >= NUM_MESH_ATTR) {
- fprintf(stderr, "%s: invalid attrib: %d\n", __FUNCTION__, attrib);
+ error_log("%s: invalid attrib: %d\n", __FUNCTION__, attrib);
return 0;
}
const float *Mesh::get_attrib_data(int attrib) const
{
if(attrib < 0 || attrib >= NUM_MESH_ATTR) {
- fprintf(stderr, "%s: invalid attrib: %d\n", __FUNCTION__, attrib);
+ error_log("%s: invalid attrib: %d\n", __FUNCTION__, attrib);
return 0;
}
if(!vattr[attrib].data_valid) {
#if GL_ES_VERSION_2_0
- fprintf(stderr, "%s: can't read back attrib data on CrippledGL ES\n", __FUNCTION__);
+ error_log("%s: can't read back attrib data on CrippledGL ES\n", __FUNCTION__);
return 0;
#else
if(!vattr[attrib].vbo_valid) {
- fprintf(stderr, "%s: unavailable attrib: %d\n", __FUNCTION__, attrib);
+ error_log("%s: unavailable attrib: %d\n", __FUNCTION__, attrib);
return 0;
}
{
int nidx = nfaces * 3;
if(nidx && num != nidx) {
- fprintf(stderr, "%s: index count mismatch (%d instead of %d)\n", __FUNCTION__, num, nidx);
+ error_log("%s: index count mismatch (%d instead of %d)\n", __FUNCTION__, num, nidx);
return 0;
}
nfaces = num / 3;
{
if(!idata_valid) {
#if GL_ES_VERSION_2_0
- fprintf(stderr, "%s: can't read back index data in CrippledGL ES\n", __FUNCTION__);
+ error_log("%s: can't read back index data in CrippledGL ES\n", __FUNCTION__);
return 0;
#else
if(!ibo_valid) {
- fprintf(stderr, "%s: indices unavailable\n", __FUNCTION__);
+ error_log("%s: indices unavailable\n", __FUNCTION__);
return 0;
}
((Mesh*)this)->update_buffers();
if(!vattr[MESH_ATTR_VERTEX].vbo_valid) {
- fprintf(stderr, "%s: invalid vertex buffer\n", __FUNCTION__);
+ error_log("%s: invalid vertex buffer\n", __FUNCTION__);
return false;
}
if(cur_sdr && use_custom_sdr_attr) {
// rendering with shaders
if(global_sdr_loc[MESH_ATTR_VERTEX] == -1) {
- fprintf(stderr, "%s: shader attribute location for vertices unset\n", __FUNCTION__);
+ error_log("%s: shader attribute location for vertices unset\n", __FUNCTION__);
return false;
}