2024-04-16 03:43:29 +00:00
|
|
|
#ifndef REND_OPENGL_H
|
|
|
|
#define REND_OPENGL_H
|
|
|
|
|
|
|
|
#include "renderer.h"
|
|
|
|
#include "3d.h"
|
|
|
|
|
|
|
|
class oeApplication;
|
|
|
|
|
|
|
|
// Starts up opengl
|
2024-04-16 18:56:40 +00:00
|
|
|
int opengl_Init(oeApplication *app, renderer_preferred_state *pref_state);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Closes down opengl
|
|
|
|
void opengl_Close();
|
|
|
|
void opengl_Shutdown();
|
|
|
|
|
|
|
|
// The main drawing function...draws a flat/textured/gouraud polygon
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_DrawPolygon(int, g3Point **, int, int);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_SetFlatColor(ddgr_color color);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Ends a frame
|
|
|
|
void opengl_EndFrame();
|
|
|
|
|
|
|
|
// Flips the screen
|
|
|
|
void opengl_Flip();
|
|
|
|
|
|
|
|
// Does setup for a new frame
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_BeginFrame(int, int, int, int, int);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Tells opengl what kind of texturing (linear/perspective) we want
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_SetTextureType(texture_type);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Sets the lighting state of opengl
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_SetLightingState(light_state state);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Sets the opengl color model (either rgb or mono)
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_SetColorModel(color_model state);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Sets the state of bilinear filtering for our textures
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_SetFiltering(sbyte state);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Sets the state of zbuffering to on or off
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_SetZBufferState(sbyte state);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Sets the near/far z values for zbuffering
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_SetZValues(float nearz, float farz);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Sets a bitmap as a lightmap to rendered on top of the next texture map
|
|
|
|
// a -1 value indicates no lighting map
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_SetLightingMap(int handle);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Clears the display to a specified color
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_ClearScreen(ddgr_color color);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Fills a rectangle on the display
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_FillRect(ddgr_color color, int x1, int y1, int x2, int y2);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Sets a pixel on the display
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_SetPixel(ddgr_color color, int x, int y);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Sets the near and far plane of fog
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_SetFogBorders(float nearz, float farz);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Sets the fog state to on or off
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_SetFogState(sbyte state);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Fills in projection variables
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_GetProjectionParameters(int *width, int *height);
|
|
|
|
void opengl_GetProjectionScreenParameters(int &screenLX, int &screenTY, int &screenW, int &screenH);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Returns the aspect ratio of the physical screen
|
2024-04-16 18:56:40 +00:00
|
|
|
float opengl_GetAspectRatio();
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Sets texture wrapping type
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_SetWrapType(wrap_type val);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Sets the constant alpha value
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_SetAlphaValue(ubyte val);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Sets the overall alpha scale factor (all alpha values are scaled by this value)
|
|
|
|
// usefull for motion blur effect
|
|
|
|
void opengl_SetAlphaFactor(float val);
|
|
|
|
|
|
|
|
// Returns the current Alpha factor
|
|
|
|
float opengl_GetAlphaFactor(void);
|
|
|
|
|
|
|
|
// Sets the type of alpha blending you want
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_SetAlphaType(sbyte atype);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Sets whether or not to write into the zbuffer
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_SetZBufferWriteMask(int state);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Gets the current state of the renderer
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_GetRenderState(rendering_state *rstate);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// draws a line
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_DrawLine(int x1, int y1, int x2, int y2);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// draws a line
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_DrawSpecialLine(g3Point *p0, g3Point *p1);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Sets the color that opengl uses for fog
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_SetFogColor(ddgr_color color);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Sets the coplanar z bias for rendered polygons
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_SetCoplanarPolygonOffset(float factor);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Sets up a some global preferences for openGL
|
2024-04-16 18:56:40 +00:00
|
|
|
int opengl_SetPreferredState(renderer_preferred_state *pref_state);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Sets the gamma correction value
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_SetGammaValue(float val);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Takes a screenshot of the frontbuffer and puts it into the passed bitmap handle
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_Screenshot(int bm_handle);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Returns the pixel color at x,y
|
2024-04-16 18:56:40 +00:00
|
|
|
ddgr_color opengl_GetPixel(int, int);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Clears the zbuffer
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_ClearZBuffer();
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Clears the texture cache
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_ResetCache();
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Takes a bitmap and blits it to the screen using linear frame buffer stuff
|
|
|
|
// X and Y are the destination X,Y
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_CopyBitmapToFramebuffer(int bm_handle, int x, int y);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
// Gets a renderer ready for a framebuffer copy, or stops a framebuffer copy
|
2024-04-16 18:56:40 +00:00
|
|
|
void opengl_SetFrameBufferCopyState(bool state);
|
2024-04-16 03:43:29 +00:00
|
|
|
|
|
|
|
#if defined(WIN32)
|
|
|
|
// returns directdraw object
|
|
|
|
void *opengl_DirectDrawObj();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// returns rendering statistics for the frame
|
|
|
|
void opengl_GetStatistics(tRendererStats *stats);
|
|
|
|
|
|
|
|
#ifdef MACINTOSH
|
|
|
|
void opengl_DettachContext(void);
|
|
|
|
void opengl_AttachContext(CGrafPtr);
|
|
|
|
void opengl_ResetContext(void);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|