~unity-team/clutk/gles-support

« back to all changes in this revision

Viewing changes to clutk/ctk-render-target.c

  • Committer: Jay Taoko
  • Date: 2010-07-05 22:15:15 UTC
  • mfrom: (229.1.15 clutk.gles-support)
  • Revision ID: jay.taoko@canonical.com-20100705221515-lpluw720lp9pft98
Replaced GLEW headers with OpenGL ES headers.
Compile on Marvel ARM board. 
Working test: tests/test-clutk-text


[modified]
  clutk/ctk-arb-asm-private.c                                                                               
  clutk/ctk-effect-blur.c
  clutk/ctk-effect-context.c
  clutk/ctk-effect-drop-shadow.c
  clutk/ctk-effect-glow.c
  clutk/ctk-gfx-private.c
  clutk/ctk-layer-actor.c
  clutk/ctk-layer.c
  clutk/ctk-main.c
  clutk/ctk-menu.c
  clutk/ctk-render-target.c
  clutk/ctk-utils.c
    - modified code to skip non OpenGL ES compatible calls
    - Effects are deactivated
    - Using the following headers on Marvell ARM board:
        <GLES2/gl2.h>
        <GLES2/gl2ext.h>

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
#include "ctk-render-target.h"
38
38
 
39
39
#include <stdlib.h>
40
 
#include <GL/glew.h>
41
 
#include <GL/glxew.h>
 
40
 
 
41
#ifdef WITH_GLES
 
42
  // Hearders for OpenGL 2.0: gl2.h, gl2ext.h
 
43
  #include <GLES2/gl2.h>
 
44
  #include <GLES2/gl2ext.h>
 
45
#else
 
46
  #include <GL/glew.h>
 
47
  #include <GL/glxew.h>
 
48
#endif
42
49
 
43
50
#include "ctk-utils.h"
44
51
 
125
132
 
126
133
  if (G_LIKELY (self))
127
134
    {
 
135
#ifndef WITH_GLES      
128
136
      CHECKGL (glGenFramebuffersEXT (1, &self->fbo));
129
137
      CHECKGL (glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, self->fbo));
130
138
      CHECKGL (glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0));
 
139
#endif
131
140
    }
132
141
 
133
142
  return self;
148
157
ctk_render_target_new_sized (guint width,
149
158
                             guint height)
150
159
{
 
160
#ifndef WITH_GLES
 
161
 
151
162
  CtkRenderTarget *self;
152
163
 
153
164
  /* Create a zero'd struct */
154
165
  self = ctk_render_target_allocate ();
155
 
  
 
166
 
156
167
  if (G_LIKELY (self))
157
168
  {
158
169
      GLenum status;
226
237
 
227
238
      CHECKGL (glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0));
228
239
    }
229
 
 
230
240
  return self;
 
241
#else
 
242
  return 0;
 
243
#endif  
231
244
}
232
245
 
233
246
 
255
268
 
256
269
  self->width = width;
257
270
  self->height = height;
258
 
 
 
271
#ifndef WITH_GLES
259
272
  CHECKGL (glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, self->fbo));
260
273
 
261
274
  if (self->depth)
302
315
                                          self->texture,
303
316
                                          0));
304
317
    }
 
318
#endif
305
319
}
306
320
 
307
321
/**
317
331
{
318
332
  if (G_LIKELY (self != NULL))
319
333
    {
 
334
#ifndef WITH_GLES      
320
335
      if (self->texture)
321
336
        CHECKGL (glDeleteTextures (1, &self->texture));
322
337
      if (self->depth)
323
338
        CHECKGL (glDeleteRenderbuffersEXT (1, &self->depth));
324
339
      if (self->fbo)
325
340
        CHECKGL (glDeleteFramebuffersEXT (1, &self->fbo));
 
341
#endif
326
342
 
327
343
     g_slice_free (CtkRenderTarget, self);
328
344
   }
338
354
void
339
355
ctk_render_target_bind (CtkRenderTarget *self)
340
356
{
 
357
#ifndef WITH_GLES
341
358
  GLenum status;
342
359
 
343
360
  g_return_if_fail (self);
369
386
    g_warning("[ctk_render_target_bind] Invalid rendertarget size \n");
370
387
 
371
388
  CHECKGL (glViewport (0, 0, self->width, self->height));
 
389
#endif  
372
390
}
373
391
 
374
392
 
382
400
void
383
401
ctk_render_target_unbind (void)
384
402
{
 
403
#ifndef WITH_GLES  
385
404
  CHECKGL (glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0));
 
405
#endif
386
406
}
387
407
 
388
408