Jump to content
  • Advertisement
Sign in to follow this  
broady

tessellation

This topic is 3625 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello guys, i am going in crazy trying to run the tess.c example from the redbook: http://www.opengl.org/resources/code/samples/redbook/tess.c" I am using the last CB+minGW compiler. The compiler is returning many errors all of the same kind. invalid conversion from `GLvoid*' to `const GLdouble*'. Seems this is a khnown error; maybe someone has already met this problem and khnows how to solve it. Thanks guys

Share this post


Link to post
Share on other sites
Advertisement
i found the solution on a russian server.

Instead of

gluTessCallback(tobj, GLU_TESS_BEGIN, beginCallback);


use

gluTessCallback(tobj, GLU_TESS_BEGIN, (GLvoid (CALLBACK *) ()) & beginCallback);


and i had to change a line adding a cast (i am proud of this :D):

glVertex3dv((GLdouble*)  vertex);


It is needed since vertex is a void*.

Something strange is happening but. If i build and run i got a crash. If i just debug i got the window with the proper shapes -.- Anyone can help?



Share this post


Link to post
Share on other sites
It seems me that vertexCallback function should be

void vertexCallback(GLvoid *vertex)
{
const GLdouble *pointer;

pointer = (const GLdouble *) vertex; // see the extra const here
glColor3dv(pointer+3);
glVertex3dv(pointer); // see the use of "pointer" instead of "vertex"
}
I expect a compiler grumbling at the line where the non-const pointer is assigned to the const pointer. Isn't it? If not, you should check your compiler settings. However, this presumbly doesn't cause a runtime error.

What notifications are given when the program crashes? Any hints about where something strange happens?

Share this post


Link to post
Share on other sites
Quote:
Original post by haegarr
It seems me that vertexCallback function should be

void vertexCallback(GLvoid *vertex)
{
const GLdouble *pointer;

pointer = (const GLdouble *) vertex; // see the extra const here
glColor3dv(pointer+3);
glVertex3dv(pointer); // see the use of "pointer" instead of "vertex"
}
I expect a compiler grumbling at the line where the non-const pointer is assigned to the const pointer. Isn't it? If not, you should check your compiler settings. However, this presumbly doesn't cause a runtime error.

What notifications are given when the program crashes? Any hints about where something strange happens?


What i recieve is the generic vista error message (like CMOS surrogate i.e.): Windows: an error occurred....will be closed and an automatic warning will be sent. No hints.

Moreover, i can't check where the code is giving problems since using gdb it works fine. I can see the shapes and the return value is 0! Really strange.

Tbh my code hasn't the const:


void CALLBACK vertexCallback(GLvoid *vertex)
{
const GLdouble *pointer;

pointer = (GLdouble *) vertex;
glColor3dv(pointer+3);
glVertex3dv((GLdouble* ) vertex); //cast added by me
}




Ah, to be exact the code i added to succesfuly compile the project is just needed by minGW. I am reading just now that tess.c works perfectly in VC.

Thanks haegarr :D

EDIT: the other example "tesswind.c" works correctly.

[Edited by - broady on July 23, 2008 4:22:15 AM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!