Commit Graph

51 Commits (60841c1d96073b0adbb687f29dfc059619ad3919)

Author SHA1 Message Date
Lukas Werling 60841c1d96 Write text files with unix file endings
The old LineFeed constant caused problems with Qt. Using \n directly is
easier and I don't think there's a reason left to use \r\n anyways.
We've always converted the files in the repository. Nowadays, even
notepad.exe works with unix file endings.
2019-02-19 15:28:12 +01:00
Tushar Maheshwari a661eab867 Automatic fixes using clang-tidy for header files
A follow-up on a previous PR GH-41. The discussion in the forum can be
viewed at http://forum.openclonk.org/topic_show.pl?pid=33086.
Run clang-tidy (without auto, pass-by-value and using checks) to fix the
header files not modified in the previous PR.

Summary of the changes:

 - C++11 member initialization.
 - nullptr instead of 0 for pointers.
 - override for functions declared virtual in base class.
 - default trivial special member functions
2017-05-15 13:46:46 +02:00
Tushar Maheshwari 3a4f49ad90 Revisit #includes
Consolidate the include statements scattered across the code in accordance
with the comment in C4Include.h. The advantages are listed in the same
comment.
Furthermore, it follows llvm-include-order which is the logical
extrapolation of the project's style guideline wherever possible
(C4Include.h being the most-frequent exception).
2017-05-15 13:24:59 +02:00
Tushar Maheshwari e58a7884e4 Automatic fixes using clang-tidy
See http://forum.openclonk.org/topic_show.pl?tid=3376 for discussion.

Close GH-41
2017-05-03 20:30:45 +02:00
Sven Eberhardt ebda8193ef Replace NULL by nullptr in C++ sources
We don't support pre-C++0x any more, so nullptr should be fine everywhere (except in the plain C source files)
2016-11-02 19:58:02 -04:00
Julius Michaelis 376ca5a9df Prevent using USE_CONSOLE in lib{misc,c4script} 2016-10-22 17:42:23 +02:00
Lukas Werling b614209593 SDL: Use OpenGL 3.1 if 3.2 is not available (like WGL) 2016-09-17 12:32:18 +02:00
Lukas Werling b7359e0c27 Remove the GTK platform (USE_GTK)
The GTK code does not work with the Qt editor. The simpler SDL2 platform
does, so we have little reason to keep the GTK code.

Note that GTK is still a dependency for mape.

Discussion: http://forum.openclonk.org/topic_show.pl?tid=3328
2016-08-03 16:25:46 +02:00
Sven Eberhardt 534e4cc745 Merge branch 'master' into qteditor
Conflicts:
	src/script/C4AulParse.cpp
2016-07-24 10:23:57 -04:00
Nicolas Hake 9a45843828 WGL: Fall-back to a 3.1 context if 3.2 context creation fails
This is an emergency fallback for older Intel drivers on Windows, which
do not support OpenGL 3.2. As we're creating 3.2 contexts mostly to
access the Core profile, which was not available in earlier versions,
falling back to 3.1 should be fine; I don't think we're using anything
specific to 3.2.
2016-06-27 01:08:28 +02:00
Armin Burgmeier 208cb12b2e Fix crash on shutdown
a) make sure the context is deselected on destruction, so that
   CStdGL::Clear() destructor doesn't try to deselect a non-existing context.
b) Calling Clear() in CStdGLCtx::~CStdGLCtx() does only call
   CStdGLCtx::Clear(), even though Clear() is virtual. The reason is that by
   the time the CStdGLCtx destructor is executed, the CStdGLCtxQt part of the
   object has already been destructed. Therefore, make CStdGLCtx::Clear() safe
   to be run without the context ever having been initialized, and explicitly
   call CStdGLCtxQt::Clear() in CStdGLCtxQt::~CStdGLCtxQt(). This is certainly
   not the most elegant way to handle this, but it should do the job for now.
2016-04-10 12:06:57 -07:00
Armin Burgmeier cf708a7cb1 Some cleanup in CStdGLCtxQt 2016-04-10 12:06:57 -07:00
Sven Eberhardt 879d501592 Merge remote-tracking branch 'remotes/origin/qteditor' into qteditor
Conflicts:
	src/editor/C4ConsoleQtPropListViewer.cpp
	src/editor/C4ConsoleQtPropListViewer.h
	src/script/C4ValueArray.cpp
2016-04-04 19:34:02 -04:00
Sven Eberhardt e8f48fd53e Qt Editor: Win32 build fixes 2016-04-03 23:46:20 -04:00
Nicolas Hake 9dddf289db Merge branch 'master' into qteditor 2016-04-03 21:06:32 +02:00
Nicolas Hake eabca223f5 Update all copyright notices for 2016 2016-04-03 20:24:42 +02:00
Nicolas Hake 493c276126 Rewrite header inclusions to #include "path/to/file.h" style 2016-04-03 20:24:42 +02:00
Armin Burgmeier b6e573296a CStdGLCtxQt: share with Qt's global share context
This allows the OpenGL context that Qt creates for QOpenGLWidget to use the
GL objects that we created beforehand.
2016-03-25 14:17:16 -07:00
Lukas Werling 4290038909 Move all viewport drawing to QOpenGLWidget::paintGL
Unfortunately, this still doesn't fix rendering. Note that the paintGL()
isn't called periodically yet, only when resizing the window.
2016-03-22 16:50:38 +01:00
Lukas Werling 75f62e52f2 Make Qt editor work with the SDL engine
Viewport rendering doesn't quite work yet, though.
2016-03-20 21:16:52 +01:00
Günther Brammer 92217e51e0 GLX: Use gdk instead of XLib to make glXCreateContextAttribsARB not exit 2016-02-12 20:39:39 +01:00
Günther Brammer 2434b22b20 Improve SDL2 OpenGL context error message 2016-02-06 23:46:58 +01:00
Günther Brammer 934b519bb4 Update the SDL port to SDL2
SDL2 is a much closer match to the other platform code, and
allows the creation of OpenGL 3 core contexts, which is
now required.
2016-02-06 16:48:21 +01:00
Günther Brammer 59e5a327b2 gtk: Add support for microsoft windows 2016-02-06 16:47:44 +01:00
Günther Brammer 487277b58d WGL: Stop caching the window handle in the GL context 2016-02-06 15:54:47 +01:00
Nicolas Hake 506d116c42 WGL: Wrap the temporary context for OpenGL extension detection in a class
Unlike GLX, the OpenGL function pointers are context-dependant. Because we
need an extension function to create the context we're going to use, we
first need to create a temporary context. Since this is independent of the
library used to fetch the function pointers, decouple it from glewInit().
2016-01-29 18:37:32 +01:00
Günther Brammer 5e5d8dd49a GLX: Avoid exiting if glXCreateContextAttribsARB fails
It's not clear that the glXCreateNewContext fallback does anyone any good
because it can't create the Core Profile Context we need, but better a
fallback message followed by Shader compilation errors than an obscure
X11 protocoll error. Probably.
2016-01-29 17:12:44 +01:00
Günther Brammer fd534c430e GL: Move notification about debug context to common code 2016-01-29 16:55:36 +01:00
Günther Brammer 83cf09db1a GL: Replace CStdGLCtx::Reinitialize with parameter to Clear() 2016-01-29 16:52:36 +01:00
Günther Brammer 7167459f67 win32: Move PIXELFORMATDESCRIPTOR from C4AbstractApp to CStdGLCtx
That is the only user.
2016-01-23 22:02:52 +01:00
Günther Brammer 34a720ca54 win32: Remove unused CreateContext function taking a HWND 2016-01-23 22:02:52 +01:00
Günther Brammer 37fd0a88c6 win32: Rename C4Window::hRenderWindow to renderwnd to match GTK+ 2016-01-23 22:02:52 +01:00
Günther Brammer 93f12150c4 CMake: Remove obsolete USE_X11 option and add USE_WIN32_WINDOWS
USE_WIN32_WINDOWS was previously defined in PlatformAbstraction.h. Move it
to CMakeLists.txt and config.h like its peers. Replace USE_X11 with USE_GTK
or GDK_WINDOWING_X11 as appropriate.
2016-01-23 20:36:34 +01:00
Armin Burgmeier ab6152e48c Create an OpenGL core profile context on Windows
I didn't actually test this, but shamelessly stole the code from Isilkor's
opengl-3.2 branch.
2016-01-17 11:37:17 -08:00
Armin Burgmeier d7d24ca36a Enable OGL core profile for linux 2016-01-17 11:37:17 -08:00
Armin Burgmeier fabb4cbdbf Implement a mechanism that allows using VAOs across contexts
Basically add another layer of indirection around accessing VAOs. The problem
is that VAOs are not shared between OpenGL contexts. This mechanism allows to
treat them mostly as if they were shared if they are only accessed through
the API defined in CStdGL.

This is accomplished by caching all existing VAOs per context. If a VAO is
being accessed, it is checked whether that VAO exists in the currently
selected context. If yes, return it, otherwise create a new VAO and return it,
together with a flag that indicates that the VAO needs to be initialized.
2016-01-17 11:37:17 -08:00
Armin Burgmeier 379fac32ee Move alpha test into the fragment shader 2015-12-19 17:04:34 -08:00
Fabian Pietsch 8ef6d65520 GLX: More debug output, to be able to trace the code paths taken 2015-05-28 21:34:14 +02:00
Nicolas Hake 36d348d94d GLX: Allow creating debug contexts
To create debug contexts, we have to use glXCreateContextAttribsARB. To use
that, we have to initialize GLEW, which means creating a dummy GL context. To
create a dummy context with the same FB config as the final one, we need to...
initialize GLEW, because it suppresses the GLX 1.4 function declarations.
So instead we'll just manually initialize the three function pointers we're
going to need.
2015-05-28 21:34:11 +02:00
Nicolas Hake 0a8c367d6c GLX: Don't request indirect contexts, ever
We're trying to do 3D rendering here, there's no point asking for an indirect
rendering context.
2015-05-25 23:59:47 +02:00
Nicolas Hake d53c8bffad WGL: Reinitialize GLEW after creating rendering context
The GL driver is allowed to use different entry points depending on the
context. This means that we can't just initialize GLEW once and use it
all the time, but we must refresh the entry point list every time we
create a new context.
2015-05-25 18:32:35 +02:00
Nicolas Hake c58e474f76 win32/GL: Reuse the same rendering context for everything
Some resources can't be shared across different rendering contexts while
others can. Additionally, the standard GLEW library does not support
multiple rendering contexts (that's what GLEX MX is for), even though it
might work on some (or even most) cards. WGL supports reuse of a
rendering context across multiple windows as long as the pixel formats
are the same.
2015-03-26 15:51:01 +01:00
Nicolas Hake 5562b09dc4 Remove a lot of disabled legacy code, round 2
Maybe at some point we'll be rid of all the commented-out code that
nobody has looked at in years.
2015-03-25 20:02:53 +01:00
Nicolas Hake bd4e772b7d Win32: Correctly deselect OpenGL context
The MSDN reference for wglMakeCurrent states that the first (hdc)
parameter is ignored when the second one is NULL. This is incorrect: it
checks validity of the hdc parameter before doing any work. Since we
have a DC anyway, it's no problem to pass that to wglMakeCurrent.
2015-02-19 13:04:30 +01:00
Nicolas Hake cac94659d0 wGL: Allow OpenGL debugging
This introduces a new command line parameter "--debug-opengl", which
will create special debug OpenGL contexts and attach a callback that the
driver will invoke when it detects a problem. The callback will then
write the error message to the logfile, and break into the debugger if
one is attached.
Currently only works on Windows.
2015-02-16 17:45:10 +01:00
Günther Brammer 5bcedb5bbf Remove some redundant #includes 2015-01-25 18:53:48 +01:00
Armin Burgmeier a508fb38e7 Remove GL shade model changes
This gets rid of GL state changes for questionable gain. It also fixes drawing
of fade sky backgrounds in global viewports (where, for some reason, the shade
model was set to GL_FLAT instead of GL_SMOOTH).
2014-12-29 22:27:49 +01:00
Nicolas Hake e0dc30c59a Update copyright notices
As discussed in http://forum.openclonk.org/topic_show.pl?tid=2917, I
have merged all copyright notices into a single file and referenced that
merged file from each source file.

For the updated source files, the timeline has been split into three
parts:
 1. Pre-RWD code (before 2001)
 2. RWD code (2001 through 2009)
 3. OpenClonk code (2009 and later)
All pre-RWD copyright notices have been left intact, as have RWD-era
copyright notices where the file did not have a RedWolf design copyright
notice but only individual author ones. All copyright notices of the
OpenClonk era have been replaced by a single notice ranging from the
first recorded year to the current year (2013). Mape code did not get a
OpenClonk Team copyright notice because it is somewhat separate from the
main OpenClonk codebase and has only been touched by Armin Burgmeier.
2013-12-23 13:03:19 +01:00
Tim Blume 240193ad5a Remove remains of Direct3D support
Direct3D hasn't worked for more than a year now, and there don't seem to
be any efforts to revive it. Remove it and concentrate on better OpenGL
support.
2013-11-02 21:39:34 +01:00
Günther Brammer 864c5c7ea8 copyright notices update 2012 2013-01-12 16:31:40 +01:00