[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[paragui-cvs] CVS: paragui/src/draw/opengl pgglcore.cpp,1.1.2.3,1.1.2.4
From: |
Teunis Peters <address@hidden> |
Subject: |
[paragui-cvs] CVS: paragui/src/draw/opengl pgglcore.cpp,1.1.2.3,1.1.2.4 pgglmem.cpp,1.1.2.2,1.1.2.3 pggloper.cpp,1.1.2.4,1.1.2.5 pgglroot.cpp,1.1.2.5,1.1.2.6 pgglsurf.cpp,1.1.2.6,1.1.2.7 |
Date: |
Mon, 04 Nov 2002 05:58:35 -0500 |
Update of /cvsroot/paragui/paragui/src/draw/opengl
In directory subversions:/tmp/cvs-serv4742/src/draw/opengl
Modified Files:
Tag: devel-opengl
pgglcore.cpp pgglmem.cpp pggloper.cpp pgglroot.cpp
pgglsurf.cpp
Log Message:
Further opengl driver work
SDL driver now almost entirely works
opengl isn't rendering correctly but IS operational
Index: pgglcore.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/draw/opengl/Attic/pgglcore.cpp,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -r1.1.2.3 -r1.1.2.4
*** pgglcore.cpp 31 Oct 2002 10:38:04 -0000 1.1.2.3
--- pgglcore.cpp 4 Nov 2002 10:58:32 -0000 1.1.2.4
***************
*** 112,117 ****
s = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h,
bits, rmask, gmask, bmask, 0);
! if (s)
GLSDL_FIX_SURFACE(s);
switch (AddTexInfo(s)) {
--- 112,121 ----
s = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h,
bits, rmask, gmask, bmask, 0);
! if (s) {
GLSDL_FIX_SURFACE(s);
+ // SDL_PixelFormat *pf;
+ // pf = s->format;
+ // PG_LogMSG("%s[%s:%i]: bpp %i rmask %x gmask %x bmask %x amask %x",
__FUNCTION__, __FILE__, __LINE__, pf->BytesPerPixel, pf->Rmask, pf->Gmask,
pf->Bmask, pf->Amask);
+ };
switch (AddTexInfo(s)) {
***************
*** 142,147 ****
s = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h,
bits, rmask, gmask, bmask, amask);
! if (s)
GLSDL_FIX_SURFACE(s);
switch (AddTexInfo(s)) {
--- 146,155 ----
s = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h,
bits, rmask, gmask, bmask, amask);
! if (s) {
GLSDL_FIX_SURFACE(s);
+ // SDL_PixelFormat *pf;
+ // pf = s->format;
+ // PG_LogMSG("%s[%s:%i]: bpp %i rmask %x gmask %x bmask %x amask %x",
__FUNCTION__, __FILE__, __LINE__, pf->BytesPerPixel, pf->Rmask, pf->Gmask,
pf->Bmask, pf->Amask);
+ };
switch (AddTexInfo(s)) {
***************
*** 157,186 ****
DBG4(PG_LogMSG("%s:%i surface %p real %p\n", __FUNCTION__, __LINE__,
surface, realscreen->SDL()));
SDL_PixelFormat *pf;
! if (!surface) return 1; /* Well, there ain't much we can do anyway... */
pf = surface->format;
/* Colorkeying requires an alpha channel! */
if (surface->flags & SDL_SRCCOLORKEY)
! if (!pf->Amask) return 0;
/* We need pitch == (width * BytesPerPixel) for glTex[Sub]Image2D() */
! if (surface->pitch != (surface->w * pf->BytesPerPixel)) return 0;
if (pf->Amask) {
// PG_LogMSG("%s[%s:%i]: bpp %i rmask %x gmask %x bmask %x amask %x",
__FUNCTION__, __FILE__, __LINE__, _RGBAfmt.BytesPerPixel, _RGBAfmt.Rmask,
_RGBAfmt.Gmask, _RGBAfmt.Bmask, _RGBAfmt.Amask);
// PG_LogMSG("%s[%s:%i]: bpp %i rmask %x gmask %x bmask %x amask %x",
__FUNCTION__, __FILE__, __LINE__, pf->BytesPerPixel, pf->Rmask, pf->Gmask,
pf->Bmask, pf->Amask);
! if (pf->BytesPerPixel != _RGBAfmt.BytesPerPixel) return 0;
! if (pf->Rmask != _RGBAfmt.Rmask) return 0;
! if (pf->Gmask != _RGBAfmt.Gmask) return 0;
! if (pf->Bmask != _RGBAfmt.Bmask) return 0;
! if (pf->Amask != _RGBAfmt.Amask) return 0;
} else {
// PG_LogMSG("%s[%s:%i]: bpp %i rmask %x gmask %x bmask %x",
__FUNCTION__, __FILE__, __LINE__, _RGBAfmt.BytesPerPixel, _RGBAfmt.Rmask,
_RGBAfmt.Gmask, _RGBAfmt.Bmask);
// PG_LogMSG("%s[%s:%i]: bpp %i rmask %x gmask %x bmask %x",
__FUNCTION__, __FILE__, __LINE__, pf->BytesPerPixel, pf->Rmask, pf->Gmask,
pf->Bmask);
! if (pf->BytesPerPixel != _RGBfmt.BytesPerPixel) return 0;
! if (pf->Rmask != _RGBfmt.Rmask) return 0;
! if (pf->Gmask != _RGBfmt.Gmask) return 0;
! if (pf->Bmask != _RGBfmt.Bmask) return 0;
}
return 1;
}
--- 165,202 ----
DBG4(PG_LogMSG("%s:%i surface %p real %p\n", __FUNCTION__, __LINE__,
surface, realscreen->SDL()));
SDL_PixelFormat *pf;
! if (!surface) goto pass; /* Well, there ain't much we can do anyway... */
pf = surface->format;
/* Colorkeying requires an alpha channel! */
if (surface->flags & SDL_SRCCOLORKEY)
! if (!pf->Amask) goto fail;
/* We need pitch == (width * BytesPerPixel) for glTex[Sub]Image2D() */
! if (surface->pitch != (surface->w * pf->BytesPerPixel)) goto fail;
if (pf->Amask) {
// PG_LogMSG("%s[%s:%i]: bpp %i rmask %x gmask %x bmask %x amask %x",
__FUNCTION__, __FILE__, __LINE__, _RGBAfmt.BytesPerPixel, _RGBAfmt.Rmask,
_RGBAfmt.Gmask, _RGBAfmt.Bmask, _RGBAfmt.Amask);
// PG_LogMSG("%s[%s:%i]: bpp %i rmask %x gmask %x bmask %x amask %x",
__FUNCTION__, __FILE__, __LINE__, pf->BytesPerPixel, pf->Rmask, pf->Gmask,
pf->Bmask, pf->Amask);
! if (pf->BytesPerPixel != _RGBAfmt.BytesPerPixel) goto fail;
! if (pf->Rmask != _RGBAfmt.Rmask) goto fail;
! if (pf->Gmask != _RGBAfmt.Gmask) goto fail;
! if (pf->Bmask != _RGBAfmt.Bmask) goto fail;
! if (pf->Amask != _RGBAfmt.Amask) goto fail;
! // PG_LogMSG("%s[%s:%i]: OK", __FUNCTION__, __FILE__, __LINE__);
} else {
// PG_LogMSG("%s[%s:%i]: bpp %i rmask %x gmask %x bmask %x",
__FUNCTION__, __FILE__, __LINE__, _RGBAfmt.BytesPerPixel, _RGBAfmt.Rmask,
_RGBAfmt.Gmask, _RGBAfmt.Bmask);
// PG_LogMSG("%s[%s:%i]: bpp %i rmask %x gmask %x bmask %x",
__FUNCTION__, __FILE__, __LINE__, pf->BytesPerPixel, pf->Rmask, pf->Gmask,
pf->Bmask);
! if (pf->BytesPerPixel != _RGBfmt.BytesPerPixel) goto fail;
! if (pf->Rmask != _RGBfmt.Rmask) goto fail;
! if (pf->Gmask != _RGBfmt.Gmask) goto fail;
! if (pf->Bmask != _RGBfmt.Bmask) goto fail;
}
+
+ pass:
return 1;
+
+ fail:
+ PG_LogMSG("%s[%s:%i]: bpp %i rmask %x gmask %x bmask %x amask %x",
__FUNCTION__, __FILE__, __LINE__, _RGBAfmt.BytesPerPixel, _RGBAfmt.Rmask,
_RGBAfmt.Gmask, _RGBAfmt.Bmask, _RGBAfmt.Amask);
+ PG_LogMSG("%s[%s:%i]: bpp %i rmask %x gmask %x bmask %x amask %x",
__FUNCTION__, __FILE__, __LINE__, pf->BytesPerPixel, pf->Rmask, pf->Gmask,
pf->Bmask, pf->Amask);
+ return 0;
}
***************
*** 448,455 ****
--- 464,506 ----
};
+ PG_DrawableSurface* PG_GLDraw::AccelerateSurface(PG_DrawableSurface* srf,
+ bool hasalpha) {
+ if (srf == NULL) return NULL;
+ /* bool hasalpha;
+ hasalpha = ((srf->ref->flags & SDL_SRCALPHA) ||
+ (srf->ref->flags & SDL_SRCCOLORKEY) ||
+ srf->ref->format->Amask);
+ PG_LogMSG("create accelerated surface(alpha=%s)",
hasalpha?"true":"false");
+ */
+ return AccelDrawableSurface(srf->SDL(), true /*hasalpha*/);
+ };
+
PG_DrawableSurface* PG_GLDraw::CreateSDLSurface(SDL_Surface* s) {
PG_GLDrawableSurface* surf;
if (s == NULL) { PG_LogERR("invalid SDL surface!"); return NULL; }
surf = new PG_GLDrawableSurface(this, s);
+ #if 0
+ {
+ SDL_PixelFormat *pf;
+ pf = s->format;
+ PG_LogMSG("%s[%s:%i]: bpp %i rmask %x gmask %x bmask %x amask %x",
__FUNCTION__, __FILE__, __LINE__, pf->BytesPerPixel, pf->Rmask, pf->Gmask,
pf->Bmask, pf->Amask);
+ };
+ #endif
+
+ PG_GLDrawableSurface *ts;
+ bool talph = true;
+ #if 1
+ talph = ((surf->GetSDLFlags() & SDL_SRCALPHA) ||
+ (surf->GetSDLFlags() & SDL_SRCCOLORKEY) ||
+ surf->GetFormat()->Amask) || true;
+ // PG_LogMSG("create accelerated surface from SDL(alpha=%s)",
talph?"true":"false");
+ #endif
+ ts = (PG_GLDrawableSurface*)AccelerateSurface(surf, talph);
+ if (ts != NULL) {
+ delete surf;
+ surf = ts;
+ };
+ // PG_LogDBG("ParaGUI[%s]: %s:%i accelerated surface %p", __FILE__,
__FUNCTION__, __LINE__, surface->SDL());
+
attach(surf);
if (surf == NULL) { PG_LogERR("failed to create window"); exit(-1); }
***************
*** 466,469 ****
--- 517,527 ----
t = SDL_CreateRGBSurface(flags,width,height,depth,Rmask,Gmask,Bmask,Amask);
if (t == NULL) { PG_LogERR("SDL: %s", SDL_GetError()); exit(-1); }
+ #if 0
+ {
+ SDL_PixelFormat *pf;
+ pf = t->format;
+ PG_LogMSG("%s[%s:%i]: bpp %i rmask %x gmask %x bmask %x amask %x",
__FUNCTION__, __FILE__, __LINE__, pf->BytesPerPixel, pf->Rmask, pf->Gmask,
pf->Bmask, pf->Amask);
+ };
+ #endif
GLSDL_FIX_SURFACE(t);
surf = new PG_GLDrawableSurface(this, t);
***************
*** 477,483 ****
--- 535,557 ----
PG_GLDrawableSurface* surf;
SDL_Surface* t;
+ #if 0
t = SDL_CreateRGBSurface(SDL_SWSURFACE,width,height,
_RGBfmt.BitsPerPixel,
_RGBfmt.Rmask,_RGBfmt.Gmask,_RGBfmt.Bmask,_RGBfmt.Amask);
+ #endif
+ t = _CreateRGBSurface(width, height);
+ if (t == NULL) { PG_LogERR("SDL: %s", SDL_GetError()); exit(-1); }
+ GLSDL_FIX_SURFACE(t);
+ surf = new PG_GLDrawableSurface(this, t);
+ attach(surf);
+ if (surf == NULL) { PG_LogERR("failed to create window"); exit(-1); }
+ // PG_LogMSG("%s[%s:%i]: bpp %i rmask %x gmask %x bmask %x", __FUNCTION__,
__FILE__, __LINE__, surf->GetFormat()->BytesPerPixel, surf->GetFormat()->Rmask,
surf->GetFormat()->Gmask, surf->GetFormat()->Bmask);
+ return surf;
+ };
+
+ PG_DrawableSurface* PG_GLDraw::CreateDrawableSurfaceAlpha(int width, int
height) {
+ PG_GLDrawableSurface* surf;
+ SDL_Surface* t;
+ t = _CreateRGBASurface(width, height);
if (t == NULL) { PG_LogERR("SDL: %s", SDL_GetError()); exit(-1); }
GLSDL_FIX_SURFACE(t);
***************
*** 501,504 ****
--- 575,583 ----
if (t == NULL) { PG_LogERR("SDL: %s", SDL_GetError()); exit(-1); }
GLSDL_FIX_SURFACE(t);
+ {
+ SDL_PixelFormat *pf;
+ pf = t->format;
+ PG_LogMSG("%s[%s:%i]: bpp %i rmask %x gmask %x bmask %x amask %x",
__FUNCTION__, __FILE__, __LINE__, pf->BytesPerPixel, pf->Rmask, pf->Gmask,
pf->Bmask, pf->Amask);
+ };
surf = new PG_GLDrawableSurface(this, t);
attach(surf);
Index: pgglmem.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/draw/opengl/Attic/pgglmem.cpp,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -r1.1.2.2 -r1.1.2.3
*** pgglmem.cpp 31 Oct 2002 10:38:04 -0000 1.1.2.2
--- pgglmem.cpp 4 Nov 2002 10:58:32 -0000 1.1.2.3
***************
*** 82,99 ****
/* Get texinfo for a surface. */
glSDL_TexInfo *PG_GLDraw::GetTexInfo(SDL_Surface *surface) {
! // DBG2(PG_LogMSG("GetTexInfo 1:handle %p", surface));
if(!surface)
return NULL;
! // DBG2(PG_LogMSG("GetTexInfo 2:handle %p -- not null", surface));
if(!texinfotab)
return NULL;
! // DBG2(PG_LogMSG("GetTexInfo 3:handle %p -- texinfotab exists", surface));
! // DBG2(PG_LogMSG("GetTexInfo 4:handle %p -- ref %i/%i", surface,
surface->unused1, MAX_TEXINFOS));
if(surface->unused1 >= MAX_TEXINFOS)
return NULL;
// DBG2(PG_LogMSG("%s:%s:%i %p %u\n", __FILE__, __FUNCTION__, __LINE__,
surface, surface->unused1));
/* DBG2(PG_LogMSG("GetTexInfo 4:handle %p %u %p", surface,
surface->unused1, texinfotab[surface->unused1])); */
! // DBG2(PG_LogMSG("GetTexInfo 4:handle %p %u", surface, surface->unused1));
! // DBG2(PG_LogMSG("GetTexInfo 5:handle %p %p", surface,
texinfotab[surface->unused1]));
return texinfotab[surface->unused1];
--- 82,99 ----
/* Get texinfo for a surface. */
glSDL_TexInfo *PG_GLDraw::GetTexInfo(SDL_Surface *surface) {
! DBG2(PG_LogMSG("GetTexInfo 1:handle %p", surface));
if(!surface)
return NULL;
! DBG2(PG_LogMSG("GetTexInfo 2:handle %p -- not null", surface));
if(!texinfotab)
return NULL;
! DBG2(PG_LogMSG("GetTexInfo 3:handle %p -- texinfotab exists", surface));
! DBG2(PG_LogMSG("GetTexInfo 4:handle %p -- ref %i/%i", surface,
surface->unused1, MAX_TEXINFOS));
if(surface->unused1 >= MAX_TEXINFOS)
return NULL;
// DBG2(PG_LogMSG("%s:%s:%i %p %u\n", __FILE__, __FUNCTION__, __LINE__,
surface, surface->unused1));
/* DBG2(PG_LogMSG("GetTexInfo 4:handle %p %u %p", surface,
surface->unused1, texinfotab[surface->unused1])); */
! DBG2(PG_LogMSG("GetTexInfo 4:handle %p %u", surface, surface->unused1));
! DBG2(PG_LogMSG("GetTexInfo 5:handle %p %p", surface,
texinfotab[surface->unused1]));
return texinfotab[surface->unused1];
Index: pggloper.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/draw/opengl/Attic/pggloper.cpp,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -C2 -r1.1.2.4 -r1.1.2.5
*** pggloper.cpp 1 Nov 2002 00:43:11 -0000 1.1.2.4
--- pggloper.cpp 4 Nov 2002 10:58:32 -0000 1.1.2.5
***************
*** 155,169 ****
void PG_GLDraw::gl_reset(void) {
- DBGLINE();
glstate.do_blend = -1;
- DBGLINE();
- glstate.do_blend = -1;
- DBGLINE();
glstate.texture = GLSDL_NOTEX;
- DBGLINE();
glstate.sfactor = 0xffffffff;
- DBGLINE();
glstate.dfactor = 0xffffffff;
- DBGLINE();
}
--- 155,162 ----
***************
*** 207,211 ****
if(GLSDL_NOTEX == txi->texture[0]) return;
gl_texture(txi->texture[0]);
!
glBegin(GL_QUADS);
glColor4ub(255, 255, 255, alpha);
--- 200,204 ----
if(GLSDL_NOTEX == txi->texture[0]) return;
gl_texture(txi->texture[0]);
! // PG_LogMSG("ParaGUI[%s](%f,%f)-(%f,%f,) (%i,%i)-(%i,%i) alpha %i scale
%f", __FUNCTION__,x1,y1,x2,y2,dx1,dy1,dx2,dy2,alpha,texscale);
glBegin(GL_QUADS);
glColor4ub(255, 255, 255, alpha);
***************
*** 460,463 ****
--- 453,457 ----
glSDL_TexInfo *txi, int tex) {
int bpp;
+ Uint32 rowlength;
bpp = datasurf->format->BytesPerPixel;
if (datasurf->pixels == NULL) {
***************
*** 474,479 ****
// DBG5(DBGLINE());
glBindTexture(GL_TEXTURE_2D, txi->texture[tex]);
// PG_LogDBG("ParaGUI[%s]: %s:%i pitch %i bpp %i", __FILE__, __FUNCTION__,
__LINE__, datasurf->pitch, bpp);
! glPixelStorei(GL_UNPACK_ROW_LENGTH, datasurf->pitch / bpp);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
--- 468,474 ----
// DBG5(DBGLINE());
glBindTexture(GL_TEXTURE_2D, txi->texture[tex]);
+ rowlength = datasurf->pitch / bpp;
// PG_LogDBG("ParaGUI[%s]: %s:%i pitch %i bpp %i", __FILE__, __FUNCTION__,
__LINE__, datasurf->pitch, bpp);
! glPixelStorei(GL_UNPACK_ROW_LENGTH, rowlength);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
***************
*** 505,540 ****
if (thistw > txi->tilew) thistw = txi->tilew;
else if (thistw <= 0) break;
-
#if 0
! DBG5(DBGLINE());
! DBG5(PG_LogMSG("yoff %i w %i h %i mask %s %p",
! toy, thistw, txi->tileh,
! datasurf->format->Amask ? "GL_RGBA" : "GL_RGB",
! (Uint8 *)datasurf->pixels + bpp * fromx));
! #endif
! #if 0
! DBG5(DBGLINE());
! DBG5(dumpimg(datasurf));
! {
! #if 0
! Uint8* ptr;
! ptr = (Uint8*)datasurf->pixels;
! ptr += bpp*fromx;
! GLenum xform = datasurf->format->Amask ? GL_RGBA : GL_RGB;
!
! DBG5(PG_LogMSG("h %i %p", txi->tileh, ptr));
! glTexSubImage2D(GL_TEXTURE_2D, 0, 0,toy, thistw, txi->tileh, xform,
GL_UNSIGNED_BYTE, ptr);
! // glTexSubImage2D(GL_TEXTURE_2D, 0, 0,toy, thistw, 1, xform,
GL_UNSIGNED_BYTE, ptr);
! #else
! glTexSubImage2D(GL_TEXTURE_2D, 0,
! 0, toy, /* offset */
! thistw, txi->tileh, /* width, height */
! datasurf->format->Amask ? GL_RGBA : GL_RGB,
! GL_UNSIGNED_BYTE,
! ((Uint8 *)datasurf->pixels) + (bpp * fromx));
! #endif
! DBG5(DBGLINE());
! };
#endif
// PG_LogDBG("ParaGUI[%s]: %s:%i", __FILE__, __FUNCTION__, __LINE__);
DBG4(_print_glerror(2));
--- 500,516 ----
if (thistw > txi->tilew) thistw = txi->tilew;
else if (thistw <= 0) break;
#if 0
! glBindTexture(GL_TEXTURE_2D, txi->texture[tex]);
! glPixelStorei(GL_UNPACK_ROW_LENGTH, rowlength);
! /* glPixelStorei(GL_UNPACK_SKIP_ROWS, toy ); */
! /* glPixelStorei(GL_UNPACK_SKIP_PIXELS, textures[i].skip_pixels ); */
#endif
+ glTexSubImage2D(GL_TEXTURE_2D, 0,
+ 0, toy, /* offset */
+ thistw, txi->tileh, /* width, height */
+ datasurf->format->Amask ? GL_RGBA : GL_RGB,
+ GL_UNSIGNED_BYTE,
+ (Uint8 *)datasurf->pixels + bpp * fromx);
+ /* ((Uint8 *)datasurf->pixels) + (bpp * fromx)); */
// PG_LogDBG("ParaGUI[%s]: %s:%i", __FILE__, __FUNCTION__, __LINE__);
DBG4(_print_glerror(2));
***************
*** 558,561 ****
--- 534,543 ----
else if(thisth <= 0)
break;
+ #if 0
+ glBindTexture(GL_TEXTURE_2D, txi->texture[tex]);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, rowlength);
+ /* glPixelStorei(GL_UNPACK_SKIP_ROWS, toy ); */
+ /* glPixelStorei(GL_UNPACK_SKIP_PIXELS, textures[i].skip_pixels ); */
+ #endif
glTexSubImage2D(GL_TEXTURE_2D, 0, tox, 0,
txi->tilew, thisth,
***************
*** 640,643 ****
--- 622,633 ----
datasurf = surface;
else {
+ // PG_LogDBG("ParaGUI[%s]: %s:%i accelerated surface?? %p", __FILE__,
__FUNCTION__, __LINE__, surface);
+ /*
+ {
+ SDL_PixelFormat *pf;
+ pf = surface->format;
+ PG_LogMSG("%s[%s:%i]: bpp %i rmask %x gmask %x bmask %x amask %x",
__FUNCTION__, __FILE__, __LINE__, pf->BytesPerPixel, pf->Rmask, pf->Gmask,
pf->Bmask, pf->Amask);
+ };
+ */
DBG(PG_LogWRN("ParaGUI GLcore: WARNING: On-the-fly conversion
performed!"));
tmp = AccelDrawableSurface(surface, surface->format->Amask);
Index: pgglroot.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/draw/opengl/Attic/pgglroot.cpp,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -C2 -r1.1.2.5 -r1.1.2.6
*** pgglroot.cpp 1 Nov 2002 00:43:11 -0000 1.1.2.5
--- pgglroot.cpp 4 Nov 2002 10:58:32 -0000 1.1.2.6
***************
*** 194,200 ****
xscale = 1.0;
yscale = 1.0;
glOrtho( xscale*(float)trect->x,
! xscale*(float)(trect->w+trect->x),
! yscale*(float)(trect->h+trect->y),
yscale*(float)trect->y,
-1.0, 1.0);
--- 194,202 ----
xscale = 1.0;
yscale = 1.0;
+ // xscale = (float)txi->lw / (float)surface->w;
+ // yscale = (float)txi->lh / (float)surface->h;
glOrtho( xscale*(float)trect->x,
! xscale*(float)(trect->w + trect->x),
! yscale*(float)(trect->h + trect->y),
yscale*(float)trect->y,
-1.0, 1.0);
***************
*** 231,242 ****
void PG_GLRootDrawableSurface::SetPixel(int x, int y, const SDL_Color& color)
{
DBG5(DBGLINE());
! return; // DEBUG
! PG_DrawableSurface::SetPixel(x,y,color);
};
void PG_GLRootDrawableSurface::DrawLine(Uint32 x0, Uint32 y0, Uint32 x1,
Uint32 y1, const SDL_Color& color, Uint8 width) {
DBG5(DBGLINE());
! return; // DEBUG
! PG_DrawableSurface::DrawLine(x0,y0,x1,y1,color,width);
};
--- 233,253 ----
void PG_GLRootDrawableSurface::SetPixel(int x, int y, const SDL_Color& color)
{
DBG5(DBGLINE());
! host->gl_do_texture(0);
! glBegin(GL_POINTS);
! glColor4ub(color.r, color.g, color.b, 255);
! glVertex2i(x, y);
! glEnd();
};
void PG_GLRootDrawableSurface::DrawLine(Uint32 x0, Uint32 y0, Uint32 x1,
Uint32 y1, const SDL_Color& color, Uint8 width) {
DBG5(DBGLINE());
! host->gl_do_texture(0);
! glBegin(GL_LINES);
! glLineWidth(width);
! glColor4ub(color.r, color.g, color.b, 255);
! glVertex2i(x0, y0);
! glVertex2i(x1, y1);
! glEnd();
! glLineWidth(1.0);
};
***************
*** 509,528 ****
//Is host->my_charSurface big enough ??
! if (host->my_charSurface != NULL) {
! if ((host->my_charSurface->GetWidth() < BitmapRealWidth) ||
! (host->my_charSurface->GetHeight() < Bitmap->rows)) {
! delete host->my_charSurface; // SDL_FreeSurface(host->my_charSurface);
! host->my_charSurface = NULL;
}
- }
- if (host->my_charSurface == NULL) {
- host->my_charSurface = host->CreateDrawableSurface(SDL_SRCALPHA,
BitmapRealWidth, Bitmap->rows, 32, 0xff0000, 0xff00, 0xff, 0xff000000);
if (host->my_charSurface == NULL) {
! PG_LogWRN("Can`t get char surface : %s",SDL_GetError());
! return false;
}
! }
!
if (Param->GetStyle() & PG_FSTYLE_ITALIC) {
PG_Rect emptyrect;
--- 520,558 ----
//Is host->my_charSurface big enough ??
! {
! Uint32 hx, hy;
! hx = BitmapRealWidth;
! hy = Bitmap->rows;
! /* minimum reasonable size for a character buffer
! * ... actually 16x16 covers most characters happily but.. :)
! */
! if (hx < 16) hx=32;
! if (hy < 16) hy=32;
!
! if (host->my_charSurface != NULL) {
! if (hx < host->my_charSurface->GetWidth()) hx =
host->my_charSurface->GetWidth();
! if (hy < host->my_charSurface->GetHeight()) hy =
host->my_charSurface->GetHeight();
!
! if ((host->my_charSurface->GetWidth() < hx) ||
! (host->my_charSurface->GetHeight() < hy)) {
! PG_LogWRN("need : (%i,%i) have (%i,%i)",
! hx, hy, host->my_charSurface->GetWidth(),
host->my_charSurface->GetHeight());
! delete host->my_charSurface; // SDL_FreeSurface(host->my_charSurface);
! host->my_charSurface = NULL;
! }
}
if (host->my_charSurface == NULL) {
! #if 0
! host->my_charSurface = host->CreateDrawableSurface(SDL_SRCALPHA,
BitmapRealWidth, Bitmap->rows, 32, 0xff0000, 0xff00, 0xff, 0xff000000);
! #endif
! host->my_charSurface = host->CreateDrawableSurfaceAlpha(hx, hy);
! if (host->my_charSurface == NULL) {
! PG_LogWRN("Can`t get char surface : %s",SDL_GetError());
! return false;
! }
}
! };
!
if (Param->GetStyle() & PG_FSTYLE_ITALIC) {
PG_Rect emptyrect;
***************
*** 565,569 ****
Uint8 *SrcPix = Bitmap->buffer;
int a;
-
if (Param->GetStyle() & PG_FSTYLE_ITALIC) {
--- 595,598 ----
Index: pgglsurf.cpp
===================================================================
RCS file: /cvsroot/paragui/paragui/src/draw/opengl/Attic/pgglsurf.cpp,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -C2 -r1.1.2.6 -r1.1.2.7
*** pgglsurf.cpp 31 Oct 2002 22:43:32 -0000 1.1.2.6
--- pgglsurf.cpp 4 Nov 2002 10:58:32 -0000 1.1.2.7
***************
*** 456,474 ****
//Is host->my_charSurface big enough ??
! if (host->my_charSurface != NULL) {
! if ((host->my_charSurface->GetWidth() < BitmapRealWidth) ||
! (host->my_charSurface->GetHeight() < Bitmap->rows)) {
! delete host->my_charSurface; // SDL_FreeSurface(host->my_charSurface);
! host->my_charSurface = NULL;
}
- }
- if (host->my_charSurface == NULL) {
- host->my_charSurface = host->CreateDrawableSurface(SDL_SRCALPHA,
BitmapRealWidth, Bitmap->rows, 32, 0xff0000, 0xff00, 0xff, 0xff000000);
if (host->my_charSurface == NULL) {
! PG_LogWRN("Can`t get char surface : %s",SDL_GetError());
! return false;
}
! }
if (Param->GetStyle() & PG_FSTYLE_ITALIC) {
--- 456,493 ----
//Is host->my_charSurface big enough ??
! {
! Uint32 hx, hy;
! hx = BitmapRealWidth;
! hy = Bitmap->rows;
! /* minimum reasonable size for a character buffer
! * ... actually 16x16 covers most characters happily but.. :)
! */
! if (hx < 16) hx=32;
! if (hy < 16) hy=32;
!
! if (host->my_charSurface != NULL) {
! if (hx < host->my_charSurface->GetWidth()) hx =
host->my_charSurface->GetWidth();
! if (hy < host->my_charSurface->GetHeight()) hy =
host->my_charSurface->GetHeight();
!
! if ((host->my_charSurface->GetWidth() < hx) ||
! (host->my_charSurface->GetHeight() < hy)) {
! PG_LogWRN("need : (%i,%i) have (%i,%i)",
! hx, hy, host->my_charSurface->GetWidth(),
host->my_charSurface->GetHeight());
! delete host->my_charSurface; // SDL_FreeSurface(host->my_charSurface);
! host->my_charSurface = NULL;
! }
}
if (host->my_charSurface == NULL) {
! #if 0
! host->my_charSurface = host->CreateDrawableSurface(SDL_SRCALPHA,
BitmapRealWidth, Bitmap->rows, 32, 0xff0000, 0xff00, 0xff, 0xff000000);
! #endif
! host->my_charSurface = host->CreateDrawableSurfaceAlpha(hx, hy);
! if (host->my_charSurface == NULL) {
! PG_LogWRN("Can`t get char surface : %s",SDL_GetError());
! return false;
! }
}
! };
if (Param->GetStyle() & PG_FSTYLE_ITALIC) {
***************
*** 560,564 ****
// Final blit
PG_Rect BoldTarget = TargetPos;
! host->BlitSurface(host->my_charSurface, SourcePos, TargetPos);
#if 0 /* FIXME - this is private data */
--- 579,583 ----
// Final blit
PG_Rect BoldTarget = TargetPos;
! BlitSurface(host->my_charSurface, SourcePos, TargetPos);
#if 0 /* FIXME - this is private data */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [paragui-cvs] CVS: paragui/src/draw/opengl pgglcore.cpp,1.1.2.3,1.1.2.4 pgglmem.cpp,1.1.2.2,1.1.2.3 pggloper.cpp,1.1.2.4,1.1.2.5 pgglroot.cpp,1.1.2.5,1.1.2.6 pgglsurf.cpp,1.1.2.6,1.1.2.7,
Teunis Peters <address@hidden> <=