|
| static int | gl_setupAttributes (int fallback) |
| | Tries to set up the OpenGL attributes for the OpenGL context.
|
| static int | gl_createWindow (unsigned int flags) |
| | Creates the OpenGL window.
|
| static int | gl_getFullscreenMode (void) |
| | Returns the fullscreen configuration as SDL2 flags.
|
| static int | gl_getGLInfo (void) |
| | Gets some information about the OpenGL window.
|
| static int | gl_defState (void) |
| | Sets the opengl state to its default parameters.
|
| static int | gl_setupScaling (void) |
| | Sets up dimensions in gl_screen, including scaling as needed.
|
| static void | gl_applyFixes (void) |
| | Applies driver-specific fixes and workarounds before initializing OpenGL.
|
| void | gl_screenshot (const char *filename) |
| | Takes a screenshot.
|
| void | gl_saveFboDepth (GLuint fbo, const char *filename) |
| GLboolean | gl_hasVersion (int major, int minor) |
| | Checks to see if opengl version is at least major.minor.
|
| int | gl_setupFullscreen (void) |
| | Tries to apply the configured display mode to the window.
|
| int | gl_init (unsigned int extra_flags) |
| | Initializes SDL/OpenGL and the works.
|
| void | gl_resize (void) |
| | Handles a window resize and resets gl_screen parameters.
|
| void | gl_viewport (int x, int y, int w, int h) |
| | Sets the opengl viewport.
|
| void | gl_setDefViewport (int x, int y, int w, int h) |
| | Sets the default viewport.
|
| void | gl_defViewport (void) |
| | Resets viewport to default.
|
| void | gl_windowToScreenPos (int *sx, int *sy, int wx, int wy) |
| | Translates the window position to screen position.
|
| void | gl_screenToWindowPos (int *wx, int *wy, int sx, int sy) |
| | Translates the screen position to windos position.
|
| GLenum | gl_stringToFilter (const char *s) |
| | Gets the associated min/mag filter from a string.
|
| GLenum | gl_stringToClamp (const char *s) |
| | Gets the associated min/mag filter from a string.
|
| GLenum | gl_stringToBlendFunc (const char *s) |
| | Gets a blend function from a string.
|
| GLenum | gl_stringToBlendFactor (const char *s) |
| | Gets a blend factor from a string.
|
| void | gl_colourblind (void) |
| | Enables or disables the colourblind shader.
|
| void | gl_exit (void) |
| | Cleans up OpenGL, the works.
|
This file handles most of the more generic opengl functions.
The main way to work with opengl in naev is to create glTextures and then use the blit functions to draw them on the screen. This system will handle relative and absolute positions.
There are two coordinate systems: relative and absolute.
Relative:
- Everything is drawn relative to the player, if it doesn't fit on screen it is clipped.
- Origin (0., 0.) would be ontop of the player.
Absolute:
- Everything is drawn in "screen coordinates".
- (0., 0.) is bottom left.
- (SCREEN_W, SCREEN_H) is top right.
Note that the game actually uses a third type of coordinates for when using raw commands. In this third type, the (0.,0.) is actually in middle of the screen. (-SCREEN_W/2.,-SCREEN_H/2.) is bottom left and (+SCREEN_W/2.,+SCREEN_H/2.) is top right.
Definition in file opengl.c.