allow to compile and run the ExampleBrowser on older Mac OSX versions (without OpenGL3)
using the 'NO_OPENGL3' preprocessor definition both premake/cmake has support for this now needs some testing
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
#ifndef NO_OPENGL3
|
||||
/*
|
||||
Copyright (c) 2012 Advanced Micro Devices, Inc.
|
||||
|
||||
@@ -1641,3 +1642,4 @@ int GLInstancingRenderer::getInstanceCapacity() const
|
||||
{
|
||||
return m_data->m_maxNumObjectCapacity;
|
||||
}
|
||||
#endif //NO_OPENGL3
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#ifndef NO_OPENGL3
|
||||
#include "GLPrimitiveRenderer.h"
|
||||
#include "GLPrimInternalData.h"
|
||||
|
||||
@@ -319,4 +320,5 @@ void GLPrimitiveRenderer::setScreenSize(int width, int height)
|
||||
m_screenWidth = width;
|
||||
m_screenHeight = height;
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#ifndef NO_OPENGL3
|
||||
|
||||
///See http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-14-render-to-texture/
|
||||
|
||||
@@ -132,4 +133,5 @@ GLRenderToTexture::~GLRenderToTexture()
|
||||
glDeleteFramebuffers(1, &m_framebufferName);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
#define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#include <OpenGL/gl3.h>
|
||||
#include <OpenGL/gl3ext.h>
|
||||
#include "OpenGLInclude.h"
|
||||
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -107,16 +107,16 @@ float loop;
|
||||
{
|
||||
(*m_resizeCallback)(width,height);
|
||||
}
|
||||
|
||||
#ifndef NO_OPENGL3
|
||||
NSRect backingBounds = [self convertRectToBacking:[self bounds]];
|
||||
GLsizei backingPixelWidth = (GLsizei)(backingBounds.size.width),
|
||||
backingPixelHeight = (GLsizei)(backingBounds.size.height);
|
||||
|
||||
// Set viewport
|
||||
glViewport(0, 0, backingPixelWidth, backingPixelHeight);
|
||||
|
||||
// glViewport(0,0,(GLsizei)width,(GLsizei)height);
|
||||
|
||||
#else
|
||||
glViewport(0,0,(GLsizei)width,(GLsizei)height);
|
||||
#endif
|
||||
}
|
||||
|
||||
[m_context setView: self];
|
||||
@@ -140,7 +140,7 @@ float loop;
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef NO_OPENGL3
|
||||
if (openglVersion==3)
|
||||
{
|
||||
NSOpenGLPixelFormatAttribute attrs[] =
|
||||
@@ -156,6 +156,7 @@ float loop;
|
||||
// Init GL context
|
||||
fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes: (NSOpenGLPixelFormatAttribute*)attrs];
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
NSOpenGLPixelFormatAttribute attrs[] =
|
||||
{
|
||||
@@ -437,8 +438,11 @@ void MacOpenGLWindow::createWindow(const b3gWindowConstructionInfo& ci)
|
||||
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
|
||||
SetFrontProcess(&psn);
|
||||
*/
|
||||
|
||||
#ifndef NO_OPENGL3
|
||||
m_retinaScaleFactor = [m_internalData->m_myview convertSizeToBacking:sz].width;
|
||||
#else
|
||||
m_retinaScaleFactor=1.f;
|
||||
#endif
|
||||
|
||||
[m_internalData->m_myApp finishLaunching];
|
||||
[pool release];
|
||||
|
||||
@@ -24,7 +24,7 @@ subject to the following restrictions:
|
||||
//#include <OpenGL/gl.h>
|
||||
//#include <OpenGL/glu.h>
|
||||
//#import <Cocoa/Cocoa.h>
|
||||
#ifdef USE_OPENGL2
|
||||
#if defined (USE_OPENGL2) || defined (NO_OPENGL3)
|
||||
#include <OpenGL/gl.h>
|
||||
#else
|
||||
#include <OpenGL/gl3.h>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#ifndef NO_OPENGL3
|
||||
#include "opengl_fontstashcallbacks.h"
|
||||
#include "../OpenGLWindow/GLPrimitiveRenderer.h"
|
||||
#include "../OpenGLWindow/GLPrimInternalData.h"
|
||||
@@ -250,3 +251,5 @@ void dumpTextureToPng(int textureWidth, int textureHeight, const char* fileName)
|
||||
free(pixels);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user