Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 7 of 7

Thread: Multitexure Issues

  1. #1
    Member Regular Contributor
    Join Date
    Sep 2001
    Location
    macedon, ny
    Posts
    289

    Multitexure Issues

    Here is my code, (you can ignore the IL calls, I am using OpenIL to load my images).
    Else where in the code I check for the use availability of the Multitexture, and CVA extensions. Then I set the flags, to true if its supported.

    if(MultiTextureSupport == true && CompiledVertexArraySupport == true)
    {
    ilGenImages(1, &MapImage);
    ilBindImage(MapImage);
    ilLoadImage(MapTextureName);
    glActiveTextureARB(GL_TEXTURE0_ARB);
    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    glTexCoordPointer(3, GL_FLOAT, 0,&Map.Texture1PT);
    ilutGLBindMipmaps();
    glEnable(GL_TEXTURE_2D);
    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
    glColor4f(1,1,1,1);
    ilDeleteImages(1, &MapImage);

    ilGenImages(1, &MapLightImage);
    ilBindImage(MapLightImage);
    ilLoadImage(MapLightTextureName);
    glActiveTextureARB(GL_TEXTURE1_ARB);
    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    glTexCoordPointer(3, GL_FLOAT, 0, &Map.Texture2PT);
    ilutGLBindMipmaps();
    glEnable(GL_TEXTURE_2D);
    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
    glColor4f(1,1,1,1);
    ilDeleteImages(1, &MapLightImage);

    glEnableClientState(GL_VERTEX_ARRAY);
    glEnableClientState(GL_NORMAL_ARRAY);
    glVertexPointer(3, GL_FLOAT, 0, &Map.VertPT);
    glNormalPointer(GL_FLOAT, 0, &Map.NormalPT);

    glLockArraysEXT(0, Map.NumInterleavedVerts);
    glDrawElements(GL_TRIANGLES, 0, GL_UNSIGNED_INT, &Map.VertIndexPT);
    glUnlockArraysEXT();
    }

    Why do I get these errors when I compile??

    'int (__stdcall *)(void)' : too many actual parameters

    I get this error 3 times, once for the lines containing my first glActiveTextureARB, my second glActiveTextureARB, and my glLockArraysEXT. Any ideas why this is happening? I have tried everything to get it to work, and still nothing.??.. Please help..

  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2000
    Location
    Hannover, Germany
    Posts
    1,258

    Re: Multitexure Issues

    Please post the declaration of those function pointers here. You seem to have declared the functions improperly, or you are using them incorrectly.
    - Michael Steinberg

  3. #3
    Member Regular Contributor
    Join Date
    Sep 2001
    Location
    macedon, ny
    Posts
    289

    Re: Multitexure Issues

    Here is all the code dealing with the declaration, and use of the extensions.

    #include <windows.h>
    #include <GL/gl.h>
    #include <GL/glu.h>
    #include <GL/glut.h>
    #include <IL/il.h>
    #include <IL/ilu.h>
    #include <IL/ilut.h>
    #include <math.h>
    #include <iostream.h>
    #include <fstream.h>
    #include <stdlib.h>

    PROC glLockArraysEXT = NULL;
    PROC glUnlockArraysEXT = NULL;

    PROC glActiveTextureARB = NULL;
    PROC glMultiTexCoord2fARB = NULL;

    void CheckExtensions(void)
    {
    glGetString(GL_EXTENSIONS);

    if(strstr((const char *)glGetString(GL_EXTENSIONS), "ARB_multitexture") != NULL)
    {
    glActiveTextureARB = wglGetProcAddress("glActiveTextureARB");
    glMultiTexCoord2fARB = wglGetProcAddress("glMultiTexCoord2fARB");
    MultiTextureSupport = true;
    }

    else
    {
    MultiTextureSupport = false;
    }

    if(strstr((const char *)glGetString(GL_EXTENSIONS), "EXT_compiled_vertex_array") != NULL)
    {
    glLockArraysEXT = wglGetProcAddress("glLockArraysEXT");
    glUnlockArraysEXT = wglGetProcAddress("glUnlockArraysEXT");
    CompiledVertexArraySupport = true;
    }

    else
    {
    CompiledVertexArraySupport = false;
    }
    }

    I first attempted using that PROCGLLOCKARRAYEXT, or something like that, i know thats not it, but its something similar, but that wouldnt compile either. I went to the extension registration page, and got the most current headers, is there something im doing wrong here? Also, how would i get the above to work with Linux, and mac ( if possible? )..

  4. #4
    Member Regular Contributor
    Join Date
    Apr 2001
    Posts
    354

    Re: Multitexure Issues

    your problem is the PROC function pointer type. It is likely to be a generic function pointer type, ie a pointer to a function that has no parameters and that returns an int.

    You need to specify a correct type for each function to reflect its return value and parameters.

    For CVA :
    typedef void (APIENTRY * PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count);
    typedef void (APIENTRY * PFNGLUNLOCKARRAYSEXTPROC) (void);
    PFNGLLOCKARRAYSEXTPROC glLockArraysEXT = NULL;
    PFNGLUNLOCKARRAYSEXTPROC glUnlockArraysEXT = NULL;

    As for portability, no your code won't work for Linux/Mac. It is due to the use of wgl. Under Linux, you have to use glx routines instead to get function pointers (don't know about the Mac situation).

  5. #5
    Intern Newbie
    Join Date
    Apr 2002
    Location
    Split, Croatia
    Posts
    43

    Re: Multitexure Issues

    You have to include glext.h from http://oss.sgi.com/projects/ogl-sample/registry/
    and you dont have to write extension functions prototypes(they are allready in glext.h).
    I dont see in your code that you included glext.h. You only need to write function pointers declarations.
    Hope this helps.

  6. #6
    Member Regular Contributor
    Join Date
    Sep 2001
    Location
    macedon, ny
    Posts
    289

    Re: Multitexure Issues

    Thanks guys, worked like a charm, first time i tried the PFNGLLOCKARRAYSEXTPROC i never included the glext.h header, so i thought it was a syntax error. So i tried the Proc stuff, that didnt work. But now it works, so i thank you. anyone know what the linux, and mac version of wglGetProcAddress is?? I believe this is my only piece of windows code that must be used. So i am looking for the linux and mac equivilant so i can write OPEN code. Thanks for all your help.

    [This message has been edited by dabeav (edited 05-25-2002).]

  7. #7
    Intern Newbie
    Join Date
    Apr 2002
    Location
    Split, Croatia
    Posts
    43

    Re: Multitexure Issues

    On Linux and every OS that uses XWindows it is glXGetProcAddressARB(it is extesion of GLX), on a Mac it is aglGetProcAddress but I'm not 100% sure.
    Check docs for both versions of function.
    Hope this helps.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •