Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 966855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:13:32+00:00 2026-05-16T02:13:32+00:00

I’m using GLUTess to tesselate polygons. After several tests, I realized glu32.lib which links

  • 0

I’m using GLUTess to tesselate polygons. After several tests, I realized glu32.lib which links to glu32.dll, crashes every once in a while. Whereas GLU which I got from the opengl sdk, is solid as a rock. Unfortunately though, by not linking to the windows dll, this means I need to drag around GLU.dll with my app instead of relying on Windows’s GLU32.dll. Is there a version of GLU which is static linkable? I really do not want to have any dll dependencies for his small project.

Thanks

My tesselator code:

#include "StdAfx.h"
#include "CGlTesselator.h"
std::vector<GLdouble*> gluptrvec;
std::vector<GLfloat> tempvct;
std::vector<GLfloat> tempvcttex;
POINTFLOAT CurrentDimensions;
POINTFLOAT CurrentMinima;

void CALLBACK combineCallback(GLdouble coords[3], GLdouble *vertex_data[4],
                              GLdouble weight[4], GLdouble **dataOut)
{
    GLdouble *vertex;

    vertex = (GLdouble *) malloc(6 * sizeof(GLdouble));
    if(vertex == NULL)
    {

        MessageBox(0,0,0,0);
    }
    vertex[0] = coords[0];
    vertex[1] = coords[1];
    //vertex[2] = coords[2];




    *dataOut = vertex;
    gluptrvec.push_back(vertex);

}


void CALLBACK vertexCallback(GLvoid *vertex)
{

    GLdouble *ptr;

    ptr = (GLdouble *) vertex;

    if(ptr == NULL)
    {
        MessageBox(0,0,0,0);
    }
    double x = ptr[0];
    double y = ptr[1];

    double s = (x - CurrentMinima.x) / CurrentDimensions.x;
    double t = (y - CurrentMinima.y) / CurrentDimensions.y;
    tempvct.push_back((GLfloat)x);
    tempvct.push_back((GLfloat)y);
    tempvcttex.push_back((GLfloat)s);
    tempvcttex.push_back((GLfloat)t);
    //glTexCoord2d(s,t);

    //glVertex2dv((GLdouble *) ptr);



}

void CALLBACK edgeflags(int flag)
{

}

CGlTesselator::CGlTesselator(void)
{
    Init();
}
int CGlTesselator::Init(GLvoid)
{
    // Create a new tessellation object 
    tobj = gluNewTess(); 

    // Set callback functions
    gluTessCallback(tobj, GLU_TESS_VERTEX, (GLvoid (_stdcall *)(void) ) &vertexCallback);
    gluTessCallback(tobj, GLU_TESS_BEGIN,  (GLvoid (_stdcall *)(void) ) &glBegin);
    gluTessCallback(tobj, GLU_TESS_END,  (GLvoid (_stdcall *)(void) ) &glEnd);
    gluTessCallback(tobj, GLU_TESS_COMBINE,  (GLvoid (_stdcall *)(void) )&combineCallback);
    gluTessCallback(tobj, GLU_EDGE_FLAG,  (GLvoid (_stdcall *)(void) )&edgeflags);

    return(1);
}

int CGlTesselator::Set_Winding_Rule(GLenum winding_rule)
{
    // Set the winding rule
    gluTessProperty(tobj, GLU_TESS_WINDING_RULE, winding_rule); 

    return(1);
}


int CGlTesselator::Render_Contour(GLdouble obj_data[][6], int num_vertices)

{

    for (int x = 0; x < num_vertices; ++x) //loop through the vertices
    {

        gluTessVertex(tobj, obj_data[x], obj_data[x]); //store the vertex


    }


    return(1);
}


int CGlTesselator::Begin_Polygon(GLvoid)
{
    gluTessBeginPolygon(tobj, NULL);

    return(1);
}

int CGlTesselator::End_Polygon(GLvoid)
{
    try
    {
        gluTessEndPolygon(tobj);
    }
    catch (int ix)
    {

    }



    if(gluptrvec.size() > 0)
    {
        for(unsigned int i = 0; i < gluptrvec.size(); i++)
        {

            free(gluptrvec[i]);
        }
    }
        gluptrvec.clear();

    return(1);
}


int CGlTesselator::Begin_Contour(GLvoid)
{
    gluTessBeginContour(tobj);

    return(1);
}


int CGlTesselator::End_Contour(GLvoid)
{   
    try
    {
        if(tobj == NULL)
        {
            MessageBox(0,0,0,0);
        }
        gluTessEndContour(tobj);
    }
    catch (...)
    {

    }


    return(1);
}


int CGlTesselator::End(GLvoid)
{
    gluDeleteTess(tobj);

    return(1);
}

void CGlTesselator::SetDimensions(POINTFLOAT dims, POINTFLOAT min)
{
    CurrentDimensions = dims;
    CurrentMinima = min;
}

CGlTesselator::~CGlTesselator(void)
{
    End();
}

void CGlTesselator::TransferVerticies(GLuint &polyvbo, GLuint &texvbo,UINT &vbocount, UINT &texcount)
{

    if (tempvct.size() > 0)
    {
        glBindBufferARB(GL_ARRAY_BUFFER_ARB,polyvbo);
        glBufferDataARB(GL_ARRAY_BUFFER_ARB,sizeof(GLfloat) * tempvct.size(),&tempvct[0],GL_STATIC_COPY);

        glBindBufferARB(GL_ARRAY_BUFFER_ARB,texvbo);

        glBufferDataARB(GL_ARRAY_BUFFER_ARB,sizeof(GLfloat) * 
            tempvcttex.size(),&tempvcttex[0],GL_STATIC_COPY);
    }


    vbocount = tempvct.size();
    texcount = tempvcttex.size();

    tempvct.clear();
    tempvcttex.clear();

}

Is there something wrong here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T02:13:33+00:00Added an answer on May 16, 2026 at 2:13 am

    I would propose you use only C++ stuff here and not mix in C malloc/free.

    Instead use a vector<> for all your arrays

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I would like to run a str_replace or preg_replace which looks for certain words

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.