Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compile errors on Linux #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions include/vapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

#include "vgl.h"

#ifndef _WIN32
#include <sys/time.h>
#endif

class VermilionApplication
{
protected:
Expand Down
2 changes: 1 addition & 1 deletion include/vec.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# define _USE_MATH_DEFINES 1
#endif

#include <math.h>
#include <cmath>
#include <iostream>

const float DegreesToRadians = static_cast<float>(M_PI / 180.0f);
Expand Down
1 change: 1 addition & 0 deletions lib/LoadShaders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <cstdlib>
#include <iostream>
#include <cstdio>

#include <GL3/gl3w.h>
#include "LoadShaders.h"
Expand Down
1 change: 1 addition & 0 deletions lib/vbm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "vgl.h"

#include <stdio.h>
#include <string.h>

VBObject::VBObject(void)
: m_vao(0),
Expand Down
63 changes: 33 additions & 30 deletions lib/vdds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,44 +602,47 @@ void vglLoadDDS(const char* filename, vglImageData* image)

if (image->target == GL_NONE)
goto done_close_file;

{
size_t current_pos = ftell(f);
size_t file_size;
fseek(f, 0, SEEK_END);
file_size = ftell(f);
fseek(f, (long)current_pos, SEEK_SET);

size_t current_pos = ftell(f);
size_t file_size;
fseek(f, 0, SEEK_END);
file_size = ftell(f);
fseek(f, (long)current_pos, SEEK_SET);
image->totalDataSize = file_size - current_pos;
image->mip[0].data = new uint8_t [image->totalDataSize];

image->totalDataSize = file_size - current_pos;
image->mip[0].data = new uint8_t [image->totalDataSize];
fread(image->mip[0].data, file_size - current_pos, 1, f);

fread(image->mip[0].data, file_size - current_pos, 1, f);
int level;
GLubyte * ptr = reinterpret_cast<GLubyte*>(image->mip[0].data);

int level;
GLubyte * ptr = reinterpret_cast<GLubyte*>(image->mip[0].data);
int width = file_header.std_header.width;
int height = file_header.std_header.height;
int depth = file_header.std_header.depth;

int width = file_header.std_header.width;
int height = file_header.std_header.height;
int depth = file_header.std_header.depth;
image->sliceStride = 0;

image->sliceStride = 0;
if (image->mipLevels == 0)
{
image->mipLevels = 1;
}

if (image->mipLevels == 0)
{
image->mipLevels = 1;
}
for (level = 0; level < image->mipLevels; ++level)
{
image->mip[level].data = ptr;
image->mip[level].width = width;
image->mip[level].height = height;
image->mip[level].depth = depth;
image->mip[level].mipStride = vgl_GetDDSStride(file_header, width) * height;
image->sliceStride += image->mip[level].mipStride;
ptr += image->mip[level].mipStride;
width >>= 1;
height >>= 1;
depth >>= 1;
}

for (level = 0; level < image->mipLevels; ++level)
{
image->mip[level].data = ptr;
image->mip[level].width = width;
image->mip[level].height = height;
image->mip[level].depth = depth;
image->mip[level].mipStride = vgl_GetDDSStride(file_header, width) * height;
image->sliceStride += image->mip[level].mipStride;
ptr += image->mip[level].mipStride;
width >>= 1;
height >>= 1;
depth >>= 1;
}

done_close_file:
Expand Down
1 change: 1 addition & 0 deletions src/10-fur/10-fur.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

BEGIN_APP_DECLARATION(FurApplication)
// Override functions from base class
Expand Down
1 change: 1 addition & 0 deletions src/11-doublewrite/11-doublewrite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "LoadShaders.h"

#include <stdio.h>
#include <string.h>
#include <string>

#define MAX_FRAMEBUFFER_WIDTH 2048
Expand Down
1 change: 1 addition & 0 deletions src/11-oit/11-oit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "LoadShaders.h"

#include <stdio.h>
#include <string.h>
#include <string>

#define MAX_FRAMEBUFFER_WIDTH 2048
Expand Down
1 change: 1 addition & 0 deletions src/11-overdrawcount/11-overdrawcount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "LoadShaders.h"

#include <stdio.h>
#include <string.h>
#include <string>

#define MAX_FRAMEBUFFER_WIDTH 2048
Expand Down
2 changes: 1 addition & 1 deletion src/12-particlesimulator/12-particlesimulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void ComputeParticleSimulator::Initialize(const char * title)

static const char compute_shader_source[] =
STRINGIZE(
#version 430 core\n
version 430 core\n

layout (std140, binding = 0) uniform attractor_block
{
Expand Down