Xgl question
Matthew`
roguestar191 at comcast.net
Tue May 10 14:10:02 PDT 2005
I've been playing with an sdl/opengl 3d engine lately, and have got it to
the point where adding a new renderer is as simple as creating a new
object that overloads the existing object, and overloading renderthis().
So my question is, can I use Xgl just like any other object inside my
application, or am I just dreaming??
Ex:
class XGLObject : public RText //special console and keyboard input
{
private:
XGL *xglsession; //store the pointer to the xgl session
public:
myObject(){xglsession = new XGL();/*create an XGL object*/type =
SOME_TYPE/*for renderer call*/;
void renderthis(float x, float y, float z, float yaw, float pitch, float
roll) {
glPushMatrix();
glTranslatef(x, y, z);
glRotatef(roll, ...);0f)
glRotatef(pitch, ....);
glRotatef(yaw, ....);
xglsession->DrawItRightHere();
// or perhaps:
glBindTexture(GL_TEXTURE_2D, xglsession->Texture());
glBegin(GL_QUADS)
glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f)
glEnd();
glPopMatrix();
}
bool collideMe(...){return;};//optional collision detection
void keyboardInputI(SDL_Event &event) //process SDL Events
}; //every object in the engine looks kind of like this, can process
keyboard input on it's own, and is responsible for it's own rendering and
collision detection/response. Mouse input can be routed to the object just
as easily as keyboard input is.
I could create the XGL object before I have the rest of the program runs
to initialize the Xserver the application needs to draw to initialize gl
and all that great stuff, and make it optional so the engine can be used
in regular X11, along with XGL, and in windowz if anyone ever bothers
compiling it for that.
I'll be releasing the source soon.. But I want to do occullusion first
because it's a good learning experience.(I'll set up a private cvs for any
developers interested even slightly, under an open source licsense that
should protect everyones interests.)
--
namc.sf.net
More information about the xorg
mailing list