Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

GluNewtess...

This topic is 5966 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

Advertisement
Here''s an example, but it is in C, not VB.
I''m not planning to translate it. Sorry.

  
#define NB_POINTS 100
GLdouble points[NB_POINTS][3] = { ... }; // Set your vertex data here

GLUtesselatorObj* t_obj;
int i;
t_obj = gluNewTess(); // Create The Tesselator Object

if
(t_obj == NULL) // Could we Create a Tesselator ?

{
return; // If No, then Return

}
// Prepare the Tesselator''s Callbacks.

gluTessCallback(t_obj, GLU_BEGIN, (void (*)())glBegin);
gluTessCallback(t_obj, GLU_VERTEX, (void (*)())glVertex3dv); // Set the glVertex function you need

gluTessCallback(t_obj, GLU_END, (void (*)())glEnd);
// Begin drawing

gluTessBeginPolygon(t_obj, NULL);
gluTessBeginContour(t_obj);
// Draw all points

for
(i = 0; i < NB_POINTS; i++)
{
gluTessVertex(t_obj, points[i], points[i]); // Draw one Vertex.

}
// Finish drawing

gluTessEndContour(t_obj);
gluTessEndPolygon(t_obj);
// Delete the Tesselator Object

gluDeleteTess(t_obj);

Share this post


Link to post
Share on other sites
Salut et merci...

Je possède un polygone (collection de point x,y) non convexe... l''utilisation de GLU permet-ele vraiment de dessiner ce genre de polygones ?

Share this post


Link to post
Share on other sites
Fallait l''dire toud''suite

Essaye plutôt ça, c''est du sur-mesure :

  
// The Number of the Vertices in the Polygon.

const int count = 4;
// Index used to Draw the Polygon.

int i;
// Data to Draw. These are the Vertices 2D Coordinates.

GLfloat data[count][2] =
{
{ -1.f, -1.f },
{ 0.f, +1.f },
{ 1.f, -1.f },
{ 0.f, 0.f }
};
// Array for use in gluTessVertex().

GLdouble vertex[3];
// Tesselator.

GLUtesselatorObj* t_obj;
t_obj = gluNewTess(); // If No, then try to Create it.

if
(t_obj != NULL) // Could we Create a Tesselator ?

{
/**
* Prepare the Tesselator''s Callbacks.
*/
gluTessCallback(t_obj, GLU_BEGIN, (void (__stdcall*)())glBegin);
gluTessCallback(t_obj, GLU_VERTEX, (void (__stdcall*)())glVertex2fv);
gluTessCallback(t_obj, GLU_END, (void (__stdcall*)())glEnd);
/**
* Draw the 2D Polygon.
*/
gluBeginPolygon(t_obj); // Begin to Draw.
for
(i = 0; i < count; i++)
{
vertex[0] = data[i][0];
vertex[1] = data[i][1];
vertex[2] = 0.;
gluTessVertex(t_obj, vertex, data[i]); // Draw one more Vertex.
}
gluEndPolygon(t_obj); // Stop Drawing.
/**
* Delete the tesselator.
*/

gluDeleteTess(t_obj);
}

C''est un peu plus du C++ que du C, mais la traduction est immédiate.

Share this post


Link to post
Share on other sites
Hello, I must use VB to make a engine 3d...

How can I declare the object GLUtesslatorobj with VB ?
This code isn''t correct :
dim t_obj as GLUtesslatorobj
set t_obj = new gluNewTess

And, how coding Callback in VB. Someone can mayby Help me ?
Many thanks

Share this post


Link to post
Share on other sites

  • 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!