2009-09-25 13:34:34 +00:00
|
|
|
/*
|
|
|
|
* Cogl
|
|
|
|
*
|
|
|
|
* An object oriented GL/GLES Abstraction/Utility Layer
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007,2008,2009 Intel Corporation.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2010-03-01 12:56:10 +00:00
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*
|
2009-09-25 13:34:34 +00:00
|
|
|
*/
|
|
|
|
|
2009-11-26 19:06:35 +00:00
|
|
|
#ifndef __COGL_FRAMEBUFFER_PRIVATE_H
|
|
|
|
#define __COGL_FRAMEBUFFER_PRIVATE_H
|
2009-09-25 13:34:34 +00:00
|
|
|
|
|
|
|
#include "cogl-handle.h"
|
|
|
|
#include "cogl-matrix-stack.h"
|
2010-04-14 18:41:08 +00:00
|
|
|
#include "cogl-clip-state.h"
|
2009-09-25 13:34:34 +00:00
|
|
|
|
2009-11-26 19:06:35 +00:00
|
|
|
typedef enum _CoglFramebufferType {
|
|
|
|
COGL_FRAMEBUFFER_TYPE_ONSCREEN,
|
|
|
|
COGL_FRAMEBUFFER_TYPE_OFFSCREEN
|
|
|
|
} CoglFramebufferType;
|
2009-09-25 13:34:34 +00:00
|
|
|
|
2010-07-07 13:41:54 +00:00
|
|
|
struct _CoglFramebuffer
|
2009-09-25 13:34:34 +00:00
|
|
|
{
|
2010-07-07 13:41:54 +00:00
|
|
|
CoglObject _parent;
|
2009-11-26 19:06:35 +00:00
|
|
|
CoglFramebufferType type;
|
2009-09-25 13:34:34 +00:00
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
|
|
|
|
CoglMatrixStack *modelview_stack;
|
|
|
|
CoglMatrixStack *projection_stack;
|
|
|
|
int viewport_x;
|
|
|
|
int viewport_y;
|
|
|
|
int viewport_width;
|
|
|
|
int viewport_height;
|
|
|
|
|
2010-04-14 18:41:08 +00:00
|
|
|
CoglClipState clip_state;
|
2010-04-26 17:08:45 +00:00
|
|
|
|
|
|
|
gboolean dirty_bitmasks;
|
|
|
|
int red_bits;
|
|
|
|
int blue_bits;
|
|
|
|
int green_bits;
|
|
|
|
int alpha_bits;
|
2010-07-07 13:41:54 +00:00
|
|
|
};
|
2009-09-25 13:34:34 +00:00
|
|
|
|
2009-11-26 19:06:35 +00:00
|
|
|
#define COGL_FRAMEBUFFER(X) ((CoglFramebuffer *)(X))
|
2009-09-25 13:34:34 +00:00
|
|
|
|
|
|
|
typedef struct _CoglOffscreen
|
|
|
|
{
|
2009-11-26 19:06:35 +00:00
|
|
|
CoglFramebuffer _parent;
|
2009-09-25 13:34:34 +00:00
|
|
|
GLuint fbo_handle;
|
2009-11-30 20:04:41 +00:00
|
|
|
GSList *renderbuffers;
|
2009-11-25 14:26:32 +00:00
|
|
|
CoglHandle texture;
|
2009-09-25 13:34:34 +00:00
|
|
|
} CoglOffscreen;
|
|
|
|
|
2010-11-11 15:28:44 +00:00
|
|
|
/* Flags to pass to _cogl_offscreen_new_to_texture_full */
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL = 1
|
|
|
|
} CoglOffscreenFlags;
|
|
|
|
|
2009-09-25 13:34:34 +00:00
|
|
|
#define COGL_OFFSCREEN(X) ((CoglOffscreen *)(X))
|
|
|
|
|
|
|
|
typedef struct _CoglOnscreen
|
|
|
|
{
|
2009-11-26 19:06:35 +00:00
|
|
|
CoglFramebuffer _parent;
|
2009-09-25 13:34:34 +00:00
|
|
|
} CoglOnscreen;
|
|
|
|
|
|
|
|
#define COGL_ONSCREEN(X) ((CoglOnscreen *)(X))
|
|
|
|
|
|
|
|
void
|
2009-11-26 19:06:35 +00:00
|
|
|
_cogl_framebuffer_state_init (void);
|
2010-04-26 17:08:45 +00:00
|
|
|
|
2009-10-21 22:20:44 +00:00
|
|
|
int
|
2010-07-07 13:41:54 +00:00
|
|
|
_cogl_framebuffer_get_width (CoglFramebuffer *framebuffer);
|
2010-04-26 17:08:45 +00:00
|
|
|
|
2009-10-21 22:20:44 +00:00
|
|
|
int
|
2010-07-07 13:41:54 +00:00
|
|
|
_cogl_framebuffer_get_height (CoglFramebuffer *framebuffer);
|
2010-04-26 17:08:45 +00:00
|
|
|
|
2010-04-14 18:41:08 +00:00
|
|
|
CoglClipState *
|
2010-07-07 13:41:54 +00:00
|
|
|
_cogl_framebuffer_get_clip_state (CoglFramebuffer *framebuffer);
|
2010-04-26 17:08:45 +00:00
|
|
|
|
2009-09-25 13:34:34 +00:00
|
|
|
void
|
2010-07-07 13:41:54 +00:00
|
|
|
_cogl_framebuffer_set_viewport (CoglFramebuffer *framebuffer,
|
2009-09-25 13:34:34 +00:00
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
int width,
|
|
|
|
int height);
|
|
|
|
int
|
2010-07-07 13:41:54 +00:00
|
|
|
_cogl_framebuffer_get_viewport_x (CoglFramebuffer *framebuffer);
|
2010-04-26 17:08:45 +00:00
|
|
|
|
2009-09-25 13:34:34 +00:00
|
|
|
int
|
2010-07-07 13:41:54 +00:00
|
|
|
_cogl_framebuffer_get_viewport_y (CoglFramebuffer *framebuffer);
|
2010-04-26 17:08:45 +00:00
|
|
|
|
2009-09-25 13:34:34 +00:00
|
|
|
int
|
2010-07-07 13:41:54 +00:00
|
|
|
_cogl_framebuffer_get_viewport_width (CoglFramebuffer *framebuffer);
|
2010-04-26 17:08:45 +00:00
|
|
|
|
2009-09-25 13:34:34 +00:00
|
|
|
int
|
2010-07-07 13:41:54 +00:00
|
|
|
_cogl_framebuffer_get_viewport_height (CoglFramebuffer *framebuffer);
|
2010-04-26 17:08:45 +00:00
|
|
|
|
2009-09-25 13:34:34 +00:00
|
|
|
void
|
2010-07-07 13:41:54 +00:00
|
|
|
_cogl_framebuffer_get_viewport4fv (CoglFramebuffer *framebuffer,
|
|
|
|
int *viewport);
|
2010-04-26 17:08:45 +00:00
|
|
|
|
2009-09-25 13:34:34 +00:00
|
|
|
CoglMatrixStack *
|
2010-07-07 13:41:54 +00:00
|
|
|
_cogl_framebuffer_get_modelview_stack (CoglFramebuffer *framebuffer);
|
2010-04-26 17:08:45 +00:00
|
|
|
|
2009-09-25 13:34:34 +00:00
|
|
|
CoglMatrixStack *
|
2010-07-07 13:41:54 +00:00
|
|
|
_cogl_framebuffer_get_projection_stack (CoglFramebuffer *framebuffer);
|
2009-09-25 13:34:34 +00:00
|
|
|
|
2009-11-26 19:06:35 +00:00
|
|
|
typedef enum _CoglFramebufferFlushFlags
|
2009-09-25 13:34:34 +00:00
|
|
|
{
|
|
|
|
/* XXX: When using this, that imples you are going to manually load the
|
|
|
|
* modelview matrix (via glLoadMatrix). _cogl_matrix_stack_flush_to_gl wont
|
2009-11-26 19:06:35 +00:00
|
|
|
* be called for framebuffer->modelview_stack, and the modelview_stack will
|
2009-09-25 13:34:34 +00:00
|
|
|
* also be marked as dirty. */
|
2009-11-26 19:06:35 +00:00
|
|
|
COGL_FRAMEBUFFER_FLUSH_SKIP_MODELVIEW = 1L<<0,
|
2010-11-02 17:34:51 +00:00
|
|
|
/* Similarly this flag implies you are going to flush the clip state
|
|
|
|
yourself */
|
|
|
|
COGL_FRAMEBUFFER_FLUSH_SKIP_CLIP_STATE = 1L<<1
|
2009-11-26 19:06:35 +00:00
|
|
|
} CoglFramebufferFlushFlags;
|
2009-09-25 13:34:34 +00:00
|
|
|
|
|
|
|
void
|
2010-07-07 13:41:54 +00:00
|
|
|
_cogl_framebuffer_flush_state (CoglFramebuffer *framebuffer,
|
2009-11-26 19:06:35 +00:00
|
|
|
CoglFramebufferFlushFlags flags);
|
2009-09-25 13:34:34 +00:00
|
|
|
|
|
|
|
CoglHandle
|
|
|
|
_cogl_onscreen_new (void);
|
|
|
|
|
2010-07-07 13:41:54 +00:00
|
|
|
CoglFramebuffer *
|
2009-11-26 19:06:35 +00:00
|
|
|
_cogl_get_framebuffer (void);
|
2010-04-26 17:08:45 +00:00
|
|
|
|
2009-09-25 13:34:34 +00:00
|
|
|
GSList *
|
2009-11-26 19:06:35 +00:00
|
|
|
_cogl_create_framebuffer_stack (void);
|
2010-04-26 17:08:45 +00:00
|
|
|
|
2009-09-25 13:34:34 +00:00
|
|
|
void
|
2009-11-26 19:06:35 +00:00
|
|
|
_cogl_free_framebuffer_stack (GSList *stack);
|
2009-09-25 13:34:34 +00:00
|
|
|
|
2010-11-11 15:28:44 +00:00
|
|
|
/*
|
|
|
|
* _cogl_offscreen_new_to_texture_full:
|
|
|
|
* @texhandle: A handle to the texture to target
|
|
|
|
* @create_flags: Flags specifying how to create the FBO
|
|
|
|
* @level: The mipmap level within the texture to target
|
|
|
|
*
|
|
|
|
* Creates a new offscreen buffer which will target the given
|
|
|
|
* texture. By default the buffer will have a depth and stencil
|
|
|
|
* buffer. This can be disabled by passing
|
|
|
|
* %COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL in @create_flags.
|
|
|
|
*
|
|
|
|
* Return value: the new CoglOffscreen object.
|
|
|
|
*/
|
|
|
|
CoglHandle
|
|
|
|
_cogl_offscreen_new_to_texture_full (CoglHandle texhandle,
|
|
|
|
CoglOffscreenFlags create_flags,
|
|
|
|
unsigned int level);
|
|
|
|
|
2009-11-26 19:06:35 +00:00
|
|
|
#endif /* __COGL_FRAMEBUFFER_PRIVATE_H */
|
2009-09-25 13:34:34 +00:00
|
|
|
|