DI-Guy SDK Documentation  13.8
diguyOglGraphicsFrameBuffer.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2024 MAK Technologies, Inc.
3  * All rights reserved.
4  ****************************************************************************/
5 
6 #pragma once
7 
8 #if WIN32
9 #include <windows.h>
10 #endif
11 // needed for function prototypes
12 #include <GL/glew.h>
13 #include <GL/gl.h>
14 
16 
22 {
23 public:
24 
27 
28  virtual int resize(int width, int height) override;
29 
30  virtual void bind() override;
31  virtual void clear() override;
32  virtual void unbind() override;
33 
34  virtual GLuint get_texture_id() override { return m_texture_id; }
35  virtual GLuint get_frame_buffer_id() override { return m_frame_buffer_object_id; }
36  virtual GLuint get_depth_texture_id() override { return m_depth_texture_id; };
37 
38  int get_width() { return m_width; }
39  int get_height() { return m_height; }
40 
41 private:
42 
43  int create_buffers();
44 
45  int check_status();
46 
47  int destroy_buffers();
48 
49  /*
50  * Common data members.
51  */
52 
54 
56  GLuint m_texture_id;
58 
59  /*
60  * Frame buffer object data members.
61  */
63 
66 
67  /*
68  * State to save and restore between bind() and unbind().
69  */
70  int m_original_vp[4];
73 
74 };
75 
76 
84 
int m_original_FBO_id
Definition: diguyOglGraphicsFrameBuffer.h:71
GLuint m_texture_id
Definition: diguyOglGraphicsFrameBuffer.h:56
virtual GLuint get_texture_id() override
Definition: diguyOglGraphicsFrameBuffer.h:34
virtual void clear() override
clears the frame buffer
int get_width()
Definition: diguyOglGraphicsFrameBuffer.h:38
GLuint m_depth_texture_id
Definition: diguyOglGraphicsFrameBuffer.h:57
int m_original_RBO_id
Definition: diguyOglGraphicsFrameBuffer.h:72
int get_height()
Definition: diguyOglGraphicsFrameBuffer.h:39
int m_height
Definition: diguyGraphicsFrameBuffer.h:81
A class that represents a frame buffer, this is used by the graphics api to enable shadow maps in pro...
Definition: diguyGraphicsFrameBuffer.h:26
GLuint m_frame_buffer_object_id
Definition: diguyOglGraphicsFrameBuffer.h:64
Subclass to allow diguy to create frame buffers.
Definition: diguyOglGraphicsFrameBuffer.h:21
virtual void bind() override
binds the frame buffer
int m_width
Definition: diguyGraphicsFrameBuffer.h:80
virtual GLuint get_depth_texture_id() override
Definition: diguyOglGraphicsFrameBuffer.h:36
virtual int resize(int width, int height) override
bool m_enable_mipmaps
Definition: diguyOglGraphicsFrameBuffer.h:53
diguyGraphicsFrameBuffer * diguyOglGraphicsFrameBuffer_create_func()
Create function declaration.
virtual ~diguyOglGraphicsFrameBuffer()
bool m_initialized
Definition: diguyOglGraphicsFrameBuffer.h:55
GLuint m_depth_render_buffer_id
Definition: diguyOglGraphicsFrameBuffer.h:65
bool m_fbo_valid
Definition: diguyOglGraphicsFrameBuffer.h:62
virtual void unbind() override
unbinds the frame buffer, presumably restores the main view rendering
virtual GLuint get_frame_buffer_id() override
Definition: diguyOglGraphicsFrameBuffer.h:35
int m_original_vp[4]
Definition: diguyOglGraphicsFrameBuffer.h:70