Horde3D
http://horde3d.org/forums/

Converting code over to H3D..
http://horde3d.org/forums/viewtopic.php?f=2&t=279
Page 1 of 1

Author:  spindiggy [ 12.04.2008, 06:04 ]
Post subject:  Converting code over to H3D..

Hello,

I have a small example that I am trying to get working with horde. The problem I am having is that I initialize opengl myself and setup all of the extentions that I need. I have not found horde's versions of these. I use gl.h, glu.h and glext.h.

Should I still be using those?

Basicly, it's a 3 step process, Create window, initialize opengl and then render the scene.

Here is one part.. InitializeGL()

Code:
bool InitializeGL()
{
   glClearColor(0.0f, 0.0f, 0.0f, 1.0f);

   glEnable(GL_DEPTH_TEST);
   glEnable(GL_TEXTURE_2D);

   // With this we will load the list of extensions the hardware supports.
   char *extension = (char*)glGetString(GL_EXTENSIONS);

   // Check for multitexture support.
   if(strstr(extension, "GL_ARB_multitexture") == 0) return false;

   // Load the multitexture funtion and test if all went well.
    glActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)wglGetProcAddress("glActiveTextureARB");
    glMultiTexCoord2fARB   = (PFNGLMULTITEXCOORD2FARBPROC)wglGetProcAddress("glMultiTexCoord2fARB");

   // Error checking to make sure functions loaded.
   if(!glActiveTextureARB || !glMultiTexCoord2fARB) return false;

..then my level loading code..
}


And now the code to render the scene..

Code:
void RenderScene()
{
   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);   // Clears the screen.
   glLoadIdentity();                   //Reset modelview matrix for new frame.

   // Set the camera.
   gluLookAt(Camera.mPos.x, Camera.mPos.y, Camera.mPos.z,
             Camera.mView.x, Camera.mView.y, Camera.mView.z,
             Camera.mUp.x, Camera.mUp.y, Camera.mUp.z);

   // Grab the model view matrix and the projection matrix and store them in our arrays.
   float model[16] = {0};
   float proj[16] = {0};
   glGetFloatv(GL_PROJECTION_MATRIX, proj);
   glGetFloatv(GL_MODELVIEW_MATRIX, model);

....rendering level code..
}


If someone can tell me how I need to do both of those parts with horde. or show me an example, that should be good enough. Looking in the examples isn't of much help as there is no such code like that in there. I've done all of this in c before but I'm still not great with c++.

Any ideas?

Thanks,
Chris

Author:  swiftcoder [ 12.04.2008, 15:22 ]
Post subject:  Re: Converting code over to H3D..

Horde is a rendering engine, not a windowing framework. The idea is that you never have to touch low-level window initialisation code or OpenGL rendering code, because that is all abstracted away from you.

Everything you are trying to do is already done for you internally by Horde (or GLFW for the window initialisation code). Take another look at the examples and the documentation - they show you how to get a window, control the camera, and load up models to be rendered.

Author:  spindiggy [ 13.04.2008, 10:03 ]
Post subject:  Re: Converting code over to H3D..

Hello,

Thanks for the reply.. The code above was what I finally got working to load quake 3 files, bsp + pvs. That was where I was getting confused since I only needed the bsp/pvs code and not the opengl code as you had mentioned.

I'm getting the hang of it now. I like the xml file usage and after noticing the terrain sample, I am going to try and see about reworking the terrain loader to load the default exported xml files from IrrEdit (Free). http://www.ambiera.com/irredit/

Thanks again,
Chris

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/