Various Windows and VC++ 2010 fixes.

This commit is contained in:
Camilla Berglund 2011-07-27 17:09:17 +02:00
parent dc345d7914
commit 4afc67c1df
9 changed files with 54 additions and 11 deletions

View File

@ -34,12 +34,18 @@
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE. * DAMAGE.
*/ */
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "getopt.h" #include "getopt.h"
/* 2011-07-27 Camilla Berglund <elmindreda@elmindreda.org>
*
* Added _CRT_SECURE_NO_WARNINGS macro.
*/
/* 2009-10-12 Camilla Berglund <elmindreda@elmindreda.org> /* 2009-10-12 Camilla Berglund <elmindreda@elmindreda.org>
* *
* Removed unused global static variable 'ID'. * Removed unused global static variable 'ID'.

View File

@ -23,6 +23,8 @@
// //
//======================================================================== //========================================================================
#define _CRT_SECURE_NO_WARNINGS
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
@ -422,7 +424,7 @@ static void update_map(int num_iter)
if (fabs(pd) <= 1.0f) if (fabs(pd) <= 1.0f)
{ {
/* tx,tz is within the circle */ /* tx,tz is within the circle */
GLfloat new_height = disp + (cos(pd*3.14f)*disp); GLfloat new_height = disp + (float) (cos(pd*3.14f)*disp);
map_vertices[1][ii] += new_height; map_vertices[1][ii] += new_height;
} }
} }

30
include/GL/glfw3.h Normal file → Executable file
View File

@ -75,7 +75,7 @@ extern "C" {
#else #else
#define APIENTRY #define APIENTRY
#endif #endif
#define GL_APIENTRY_DEFINED #define GLFW_APIENTRY_DEFINED
#endif /* APIENTRY */ #endif /* APIENTRY */
@ -96,7 +96,7 @@ extern "C" {
/* Others (e.g. MinGW, Cygwin) */ /* Others (e.g. MinGW, Cygwin) */
#define WINGDIAPI extern #define WINGDIAPI extern
#endif #endif
#define GL_WINGDIAPI_DEFINED #define GLFW_WINGDIAPI_DEFINED
#endif /* WINGDIAPI */ #endif /* WINGDIAPI */
/* Some <GL/glu.h> files also need CALLBACK defined */ /* Some <GL/glu.h> files also need CALLBACK defined */
@ -112,7 +112,7 @@ extern "C" {
/* Other Windows compilers */ /* Other Windows compilers */
#define CALLBACK __stdcall #define CALLBACK __stdcall
#endif #endif
#define GLU_CALLBACK_DEFINED #define GLFW_CALLBACK_DEFINED
#endif /* CALLBACK */ #endif /* CALLBACK */
/* Microsoft Visual C++, Borland C++ and Pelles C <GL*glu.h> needs wchar_t */ /* Microsoft Visual C++, Borland C++ and Pelles C <GL*glu.h> needs wchar_t */
@ -594,6 +594,30 @@ GLFWAPI void glfwEnable(GLFWwindow window, int token);
GLFWAPI void glfwDisable(GLFWwindow window, int token); GLFWAPI void glfwDisable(GLFWwindow window, int token);
/*************************************************************************
* Global definition cleanup
*************************************************************************/
/* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */
#ifdef GLFW_APIENTRY_DEFINED
#undef APIENTRY
#undef GLFW_APIENTRY_DEFINED
#endif
#ifdef GLFW_WINGDIAPI_DEFINED
#undef WINGDIAPI
#undef GLFW_WINGDIAPI_DEFINED
#endif
#ifdef GLFW_CALLBACK_DEFINED
#undef CALLBACK
#undef GLFW_CALLBACK_DEFINED
#endif
/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -57,7 +57,7 @@ GLFWAPI void glfwSetGammaFormula(float gamma, float blacklevel, float gain)
float value = (float) i / ((float) (size - 1)); float value = (float) i / ((float) (size - 1));
// Apply gamma // Apply gamma
value = pow(value, 1.f / gamma) * 65535.f + 0.5f; value = (float) pow(value, 1.f / gamma) * 65535.f + 0.5f;
// Apply gain // Apply gain
value = gain * (value - 32767.5f) + 32767.5f; value = gain * (value - 32767.5f) + 32767.5f;

View File

@ -34,13 +34,16 @@
// We don't need all the fancy stuff // We don't need all the fancy stuff
#define NOMINMAX #define NOMINMAX
#define WIN32_LEAN_AND_MEAN
#define VC_EXTRALEAN #define VC_EXTRALEAN
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h> #include <windows.h>
#include <mmsystem.h> #include <mmsystem.h>
#include "../../include/GL/wglext.h" #include "../include/GL/wglext.h"
//======================================================================== //========================================================================

View File

@ -1556,7 +1556,8 @@ void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height) void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
{ {
int bpp, newMode = 0, refresh; //int bpp, refresh;
int newMode = 0;
GLboolean sizeChanged = GL_FALSE; GLboolean sizeChanged = GL_FALSE;
if (window->mode == GLFW_FULLSCREEN) if (window->mode == GLFW_FULLSCREEN)
@ -1647,7 +1648,7 @@ void _glfwPlatformRefreshWindowParams(void)
{ {
PIXELFORMATDESCRIPTOR pfd; PIXELFORMATDESCRIPTOR pfd;
DEVMODE dm; DEVMODE dm;
int pixelFormat, mode; int pixelFormat;
_GLFWwindow* window = _glfwLibrary.currentWindow; _GLFWwindow* window = _glfwLibrary.currentWindow;

View File

@ -31,6 +31,8 @@
// //
//======================================================================== //========================================================================
#define _CRT_SECURE_NO_WARNINGS
#include <GL/glfw3.h> #include <GL/glfw3.h>
#include <stdio.h> #include <stdio.h>

View File

@ -34,18 +34,23 @@
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE. * DAMAGE.
*/ */
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "getopt.h" #include "getopt.h"
/* 2011-07-27 Camilla Berglund <elmindreda@elmindreda.org>
*
* Added _CRT_SECURE_NO_WARNINGS macro.
*/
/* 2009-10-12 Camilla Berglund <elmindreda@elmindreda.org> /* 2009-10-12 Camilla Berglund <elmindreda@elmindreda.org>
* *
* Removed unused global static variable 'ID'. * Removed unused global static variable 'ID'.
*/ */
char* optarg = NULL; char* optarg = NULL;
int optind = 0; int optind = 0;
int opterr = 1; int opterr = 1;

View File

@ -66,7 +66,7 @@ int main(void)
glfwSetWindowPos(windows[i], 100 + (i & 1) * 300, 100 + (i >> 1) * 300); glfwSetWindowPos(windows[i], 100 + (i & 1) * 300, 100 + (i >> 1) * 300);
glClearColor(i & 1, i >> 1, 0.0, 0.0); glClearColor((GLclampf) (i & 1), (GLclampf) (i >> 1), 0.0, 0.0);
} }
while (running) while (running)