/* Link the pixmap/pbuffer associated with surface as texture.
* ctxt is the target context for the texture operation
*/
-extern void glo_surface_as_texture(GloContext *ctxt, GloSurface *surface);
+extern void glo_surface_as_texture(GloContext *ctxt, GloSurface *surface, int surface_type);
/* Create a surface with given width and height, */
extern GloSurface *glo_surface_create(int width, int height, GloContext *context);
}
/* Bind the surface as texture */
-void glo_surface_as_texture(GloContext *ctxt, GloSurface *surface)
+void glo_surface_as_texture(GloContext *ctxt, GloSurface *surface, int surface_type)
{
#if 0
//Not QUit sure about this function;
}
/* Bind the surface as texture */
-void glo_surface_as_texture(GloContext *ctxt, GloSurface *surface)
+void glo_surface_as_texture(GloContext *ctxt, GloSurface *surface, int surface_type)
{
#if 0
int glFormat, glType;
#include "gl_mangled.h"
#endif
+enum{
+ SURFACE_WINDOW,
+ SURFACE_PIXMAP,
+ SURFACE_PBUFFER,
+};
+
void *g_malloc(size_t size);
void *g_realloc(void *ptr, size_t size);
void g_free(void *ptr);
}
/* Bind the surface as texture */
-void glo_surface_as_texture(GloContext *ctxt, GloSurface *surface)
+void glo_surface_as_texture(GloContext *ctxt, GloSurface *surface, int surface_type)
{
#if 0
void (*ptr_func_glXBindTexImageEXT) (Display *dpy, GLXDrawable draw, int buffer, int *attrib_list);
/* glTexImage2D use different RGB order than the contexts in the pixmap surface */
/* glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, surface->width, surface->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, surface->image->data);*/
+ if(surface_type == SURFACE_PBUFFER)
+ {
if ((glFormat == GL_RGBA || glFormat == GL_BGRA) && glType == GL_UNSIGNED_BYTE) {
GLubyte *b = (GLubyte *)surface->image->data;
int stride = surface->width * 4;
}
g_free(tmp);
}
+ }
+
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, surface->width, surface->height, 0, glFormat, glType, surface->image->data);
#endif
}
/* If this pixmap is linked as texture previously */
if (link_drawable(process, client_drawable))
glo_surface_as_texture(process->current_state->context,
- qsurface->surface);
+ qsurface->surface, qsurface->type);
ret.i = client_drawable;
}
}
else
- glo_surface_as_texture(process->current_state->context, qsurface->surface);
+ glo_surface_as_texture(process->current_state->context, qsurface->surface, qsurface->type);
break;
}
add_pixmap_texture_mapping(process->current_state,
process->current_state->bindTexture2D,
client_drawable);
- glo_surface_as_texture(process->current_state->context, qsurface->surface);
+ glo_surface_as_texture(process->current_state->context, qsurface->surface, qsurface->type);
ret.i = 1;
}
else
if ( qsurface )
{
- glo_surface_as_texture(process->current_state->context, qsurface->surface);
+ glo_surface_as_texture(process->current_state->context, qsurface->surface, qsurface->type);
fprintf(stderr, "edwin:bindtexture: drawable=0x%x,qsurface=%p.\n", drawable, qsurface);
}
}