#Makefile
ARCH := $(shell uname -m)
# TODO: stb_truetype doesn't compile with some of these warnings.
-CXX = g++ -std=gnu++0x -g
-# -Wall -Werror -Wshadow -pedantic
+CXX = g++ -std=gnu++0x -g -Wall -Werror -Wshadow -pedantic
MAIN = main.o
OBJ = log.o real.o document.o view.o screen.o vfpu.o graphicsbuffer.o framebuffer.o shaderprogram.o stb_truetype.o gl_core44.o
LIB_x86_64 = ../contrib/lib/libSDL2-2.0.so.0 -lGL
#include "gl_core44.h"
#include <SDL.h>
-#define IntGetProcAddress(name) SDL_GL_GetProcAddress(name)
+
+// Casting between function and data pointers is invalid C++ (but we need to
+// do it for OpenGL to work at all (yay!), so use gcc __extension__ operator
+// to silence warnings and errors here.
+typedef void (*func_ptr)();
+
+func_ptr IntGetProcAddress(const char *name)
+{
+#ifdef __GNUC__
+ __extension__ func_ptr fn = reinterpret_cast<func_ptr>(SDL_GL_GetProcAddress(name));
+ return fn;
+#else
+ return (func_ptr)SDL_GL_GetProcAddress(name);
+#endif
+}
int ogl_ext_NV_texture_barrier = ogl_LOAD_FAILED;
int ogl_ext_NV_copy_image = ogl_LOAD_FAILED;
typedef int (*PFN_LOADFUNCPOINTERS)();
typedef struct ogl_StrToExtMap_s
{
- char *extensionName;
+ const char *extensionName;
int *extensionVariable;
PFN_LOADFUNCPOINTERS LoadExtension;
} ogl_StrToExtMap;
}
else
{
- for(int i = 0; i < 8; ++i)
+ for(int x = 0; x < 8; ++x)
{
- for (int j = 0; j < 8; ++j)
+ for (int y = 0; y < 8; ++y)
{
- doc.Add(((i^j)&1)?RECT_OUTLINE:RECT_FILLED, Rect(0.2+i-4.0,0.2+j-4.0,0.6,0.6));
+ doc.Add(((x^y)&1)?RECT_OUTLINE:RECT_FILLED, Rect(0.2+x-4.0,0.2+y-4.0,0.6,0.6));
}
}
}
);
- double init_time = SDL_GetPerformanceCounter();
while (scr.PumpEvents())
{
scr.Clear();
scr.DebugFontPrint("Doing coordinate transform on the CPU.\n");
}
scr.Present();
- init_time = SDL_GetPerformanceCounter();
}
}
quad_vertex_buffer.SetType(GraphicsBuffer::BufferTypeVertex);
GLfloat quad[] = {
0, 0, 0, 0,
- 1, 0, ViewportWidth(), 0,
- 1, 1, ViewportWidth(), ViewportHeight(),
- 0, 1, 0, ViewportHeight()
+ 1, 0, (float)ViewportWidth(), 0,
+ 1, 1, (float)ViewportWidth(), (float)ViewportHeight(),
+ 0, 1, 0, (float)ViewportHeight()
};
quad_vertex_buffer.Upload(sizeof(GLfloat) * 16, quad);
quad_vertex_buffer.Bind();
// now decrement to bias correctly to find smallest
search -= 2;
while (entrySelector) {
- stbtt_uint16 start, end;
searchRange >>= 1;
start = ttUSHORT(data + search + 2 + segcount*2 + 2);
end = ttUSHORT(data + search + 2);
if (matchlen >= 0) {
// check for target_id+1 immediately following, with same encoding & language
if (i+1 < count && ttUSHORT(fc+loc+12+6) == next_id && ttUSHORT(fc+loc+12) == platform && ttUSHORT(fc+loc+12+2) == encoding && ttUSHORT(fc+loc+12+4) == language) {
- stbtt_int32 slen = ttUSHORT(fc+loc+12+8), off = ttUSHORT(fc+loc+12+10);
+ slen = ttUSHORT(fc+loc+12+8);
+ off = ttUSHORT(fc+loc+12+10);
if (slen == 0) {
if (matchlen == nlen)
return 1;
{
if (m_use_gpu_transform)
{
- GLfloat glbounds[] = {Float(m_bounds.x), Float(m_bounds.y), Float(m_bounds.w), Float(m_bounds.h)};
+ GLfloat glbounds[] = {static_cast<GLfloat>(Float(m_bounds.x)), static_cast<GLfloat>(Float(m_bounds.y)), static_cast<GLfloat>(Float(m_bounds.w)), static_cast<GLfloat>(Float(m_bounds.h))};
m_bounds_ubo.Upload(sizeof(float)*4, glbounds);
}
else
{
public:
View(Document & document, const Rect & bounds = Rect(0,0,1,1), const Colour & colour = Colour(0.f,0.f,0.f,1.f))
- : m_colour(colour), m_use_gpu_transform(false), m_bounds_dirty(true), m_buffer_dirty(true), m_document(document), m_bounds(bounds)
+ : m_use_gpu_transform(false), m_bounds_dirty(true), m_buffer_dirty(true), m_document(document), m_bounds(bounds), m_colour(colour)
{
Debug("View Created - Bounds => {%s}", m_bounds.Str().c_str());
}