I think it's time to add a (new) "GLX section" under the PROGRAMMING section of the forum, don't you think?
I think it's time to add a (new) "GLX section" under the PROGRAMMING section of the forum, don't you think?
What echoes in Eternity has been done in someone's life...
DrawRotate, has a bug that contaminated DrawRotateAdd. It follows the correction:
//------------------------------------------------------------------------
procedure TGLXImageItem.DrawRotate(X, Y, Width, Height, PatternIndex: Integer;
CenterX, CenterY: Double; Angle: Integer);
var Rect: TRect;
RenderState: TGLXRenderState;
begin
glPushMatrix();
glLoadIdentity();
Rect.Left :=-Round( CenterX * Width );
Rect.Top :=-Round( CenterY * Height);
Rect.Right := Round((1-CenterX) * Width );
Rect.Bottom:= Round((1-CenterY) * Height);
glPopMatrix();
RenderState:= GLXDraw.RenderState;
GLXDraw.RenderState:=rs2D;
glPushAttrib(GL_TEXTURE_BIT);
glEnable(GL_TEXTURE_2D);
Bind;
glTranslate(X,Y,0);
glRotate (Angle, 0,0,1);
glBegin(GL_QUADS);
with FPatterns[PatternIndex] do begin
glTexCoord2f(Left , Bottom); glVertex2i(Rect.Left , Rect.Top);
glTexCoord2f(Right, Bottom); glVertex2i(Rect.Right, Rect.Top);
glTexCoord2f(Right, Top ); glVertex2i(Rect.Right, Rect.Bottom);
glTexCoord2f(Left , Top ); glVertex2i(Rect.Left , Rect.Bottom);
end;
glEnd();
glPopAttrib();
GLXDraw.RenderState:=RenderState
end;
//------------------------------------------------------------------------
procedure TGLXImageItem.DrawRotateAdd(X, Y, Width, Height, PatternIndex: Integer;
CenterX, CenterY: Double; Angle: Integer; Alpha: Single);
var Rect: TRect;
RenderState: TGLXRenderState;
begin
glPushMatrix();
glLoadIdentity();
Rect.Left :=-Round( CenterX * Width );
Rect.Top :=-Round( CenterY * Height);
Rect.Right := Round((1-CenterX) * Width );
Rect.Bottom:= Round((1-CenterY) * Height);
glPopMatrix();
glEnable(GL_BLEND);
glColor4f(1.0,1.0,1.0,Alpha);
glBlendFunc(GL_SRC_ALPHA,GL_ONE);;
RenderState:= GLXDraw.RenderState;
GLXDraw.RenderState:=rs2D;
glPushAttrib(GL_TEXTURE_BIT);
glEnable(GL_TEXTURE_2D);
Bind;
glTranslate(X,Y,0);
glRotate (Angle, 0,0,1);
glBegin(GL_QUADS);
with FPatterns[PatternIndex] do begin
glTexCoord2f(Left , Bottom); glVertex2i(Rect.Left , Rect.Top);
glTexCoord2f(Right, Bottom); glVertex2i(Rect.Right, Rect.Top);
glTexCoord2f(Right, Top ); glVertex2i(Rect.Right, Rect.Bottom);
glTexCoord2f(Left , Top ); glVertex2i(Rect.Left , Rect.Bottom);
end;
glEnd();
glPopAttrib();
GLXDraw.RenderState:=RenderState;
glDisable(GL_BLEND);
end;
SuperEly, wasn't the code:
Rect.Left :=-Round( CenterX * PatternWidth );
Rect.Top :=-Round( CenterY * PatternHeight);
Rect.Right := Round((1-CenterX) * PatternWidth );
Rect.Bottom:= Round((1-CenterY) * PatternHeight);
from the beginning, what's the bug with that ??
I have started rewritten the homepage is approx 40% done, when the page is ready the new version is released.
Edit:
Found what bug you ment, it's when the patternwidth or patternheight is 0 but the drawrotate funktion is correct, it in UpdatePatterns the bug was..
Amnoxx
Oh, and this code appears to be an approximate replacement for return(random() & 0x01);
Phoenix Wiki
http://www.phoenixlib.net/
Phoenix Forum
http://www.pascalgamedevelopment.com/viewforum.php?f=71
See the parameters of the procedure:
DrawRotate(X, Y, Width, Height, PatternIndex: Integer;
CenterX, CenterY: Double; Angle: Integer);
Width and Height are not used like this:
Rect.Left :=-Round( CenterX * PatternWidth );
Rect.Top :=-Round( CenterY * PatternHeight);
Rect.Right := Round((1-CenterX) * PatternWidth );
Rect.Bottom:= Round((1-CenterY) * PatternHeight);
But they are used like this:
Rect.Left :=-Round( CenterX * Width );
Rect.Top :=-Round( CenterY * Height );
Rect.Right := Round((1-CenterX) * Width );
Rect.Bottom:= Round((1-CenterY) * Height );
:roll:
Well, what can i say, stupid me =)
Amnoxx
Oh, and this code appears to be an approximate replacement for return(random() & 0x01);
Phoenix Wiki
http://www.phoenixlib.net/
Phoenix Forum
http://www.pascalgamedevelopment.com/viewforum.php?f=71
I wouldn't mind, but it's up to the moderators =)Originally Posted by BojZ
Amnoxx
Oh, and this code appears to be an approximate replacement for return(random() & 0x01);
Phoenix Wiki
http://www.phoenixlib.net/
Phoenix Forum
http://www.pascalgamedevelopment.com/viewforum.php?f=71
Yeah just start a thread in the 'Forums' forum :? and see if anyone has any objections. If not.... no problemOriginally Posted by AndreasL
I have finished the new page and uploaded the new version of glx. Download and have fun =)
Amnoxx
Oh, and this code appears to be an approximate replacement for return(random() & 0x01);
Phoenix Wiki
http://www.phoenixlib.net/
Phoenix Forum
http://www.pascalgamedevelopment.com/viewforum.php?f=71
:lol: :lol: :lol:
An error happens when compiling Demo of GLXImageList, in GLXImageList.pas:
Code:
var glMultiTexCoord1fARB : PFNGLMULTITEXCOORD1FARBPROC = nil;
var glMultiTexCoord2fARB : PFNGLMULTITEXCOORD2FARBPROC = nil;
var glMultiTexCoord3fARB : PFNGLMULTITEXCOORD3FARBPROC = nil;
var glMultiTexCoord4fARB : PFNGLMULTITEXCOORD4FARBPROC = nil;
var glActiveTextureARB : PFNGLACTIVETEXTUREARBPROC = nil;
var glClientActiveTextureARB : PFNGLCLIENTACTIVETEXTUREARBPROC = nil;
The errors:
[Error] GLXImageList.pas(25: Undeclared identifier: 'PFNGLMULTITEXCOORD1FARBPROC'
[Error] GLXImageList.pas(25: Cannot initialize multiple variables
[Error] GLXImageList.pas(259): Undeclared identifier: 'PFNGLMULTITEXCOORD2FARBPROC'
[Error] GLXImageList.pas(259): Cannot initialize multiple variables
[Error] GLXImageList.pas(260): Undeclared identifier: 'PFNGLMULTITEXCOORD3FARBPROC'
[Error] GLXImageList.pas(260): Cannot initialize multiple variables
[Error] GLXImageList.pas(261): Undeclared identifier: 'PFNGLMULTITEXCOORD4FARBPROC'
[Error] GLXImageList.pas(261): Cannot initialize multiple variables
[Error] GLXImageList.pas(262): Undeclared identifier: 'PFNGLACTIVETEXTUREARBPROC'
[Error] GLXImageList.pas(262): Cannot initialize multiple variables
[Error] GLXImageList.pas(263): Undeclared identifier: 'PFNGLCLIENTACTIVETEXTUREARBPROC'
[Error] GLXImageList.pas(263): Cannot initialize multiple variables
[Fatal Error] GLXImageList.pas(1: Could not compile used unit 'GLXImageList'
Delphi 7 Enterprise
??
Bookmarks