Sign in to follow this  
jor1980

Help with this dll project

Recommended Posts

Hi am trying to create a .net dll with the static library nvtrsistrip, my problem is that i don´t know c++ i have tried and it gives me 3 errors, could anyone take a look to my project to tell what i have to do? http://rapidshare.com/files/358865335/MYtristrip.rar Thank´s

Share this post


Link to post
Share on other sites
My project is named Prc++ and it has the code of the nvtristrip that i need to compile into a dll for visual basic, i don´t know c++ i have read some tutorials and i made this:

i have added into the folder nvstrip.lib and in Prc.h i have put the code of nvstrip.h:


#ifndef NVTRISTRIP_H
#define NVTRISTRIP_H

#ifndef NULL
#define NULL 0
#endif

#pragma comment(lib, "nvtristrip")

////////////////////////////////////////////////////////////////////////////////////////
// Public interface for stripifier
////////////////////////////////////////////////////////////////////////////////////////

//GeForce1 and 2 cache size
#define CACHESIZE_GEFORCE1_2 16

//GeForce3 cache size
#define CACHESIZE_GEFORCE3 24

enum PrimType
{
PT_LIST,
PT_STRIP,
PT_FAN
};

struct PrimitiveGroup
{
PrimType type;
unsigned int numIndices;
unsigned short* indices;

////////////////////////////////////////////////////////////////////////////////////////

PrimitiveGroup() : type(PT_STRIP), numIndices(0), indices(NULL) {}
~PrimitiveGroup()
{
if(indices)
delete[] indices;
indices = NULL;
}
};


////////////////////////////////////////////////////////////////////////////////////////
// EnableRestart()
//
// For GPUs that support primitive restart, this sets a value as the restart index
//
// Restart is meaningless if strips are not being stitched together, so enabling restart
// makes NvTriStrip forcing stitching. So, you'll get back one strip.
//
// Default value: disabled
//
void EnableRestart(const unsigned int restartVal);

////////////////////////////////////////////////////////////////////////////////////////
// DisableRestart()
//
// For GPUs that support primitive restart, this disables using primitive restart
//
void DisableRestart();


////////////////////////////////////////////////////////////////////////////////////////
// SetCacheSize()
//
// Sets the cache size which the stripfier uses to optimize the data.
// Controls the length of the generated individual strips.
// This is the "actual" cache size, so 24 for GeForce3 and 16 for GeForce1/2
// You may want to play around with this number to tweak performance.
//
// Default value: 16
//
void SetCacheSize(const unsigned int cacheSize);


////////////////////////////////////////////////////////////////////////////////////////
// SetStitchStrips()
//
// bool to indicate whether to stitch together strips into one huge strip or not.
// If set to true, you'll get back one huge strip stitched together using degenerate
// triangles.
// If set to false, you'll get back a large number of separate strips.
//
// Default value: true
//
void SetStitchStrips(const bool bStitchStrips);


////////////////////////////////////////////////////////////////////////////////////////
// SetMinStripSize()
//
// Sets the minimum acceptable size for a strip, in triangles.
// All strips generated which are shorter than this will be thrown into one big, separate list.
//
// Default value: 0
//
void SetMinStripSize(const unsigned int minSize);


////////////////////////////////////////////////////////////////////////////////////////
// SetListsOnly()
//
// If set to true, will return an optimized list, with no strips at all.
//
// Default value: false
//
void SetListsOnly(const bool bListsOnly);


////////////////////////////////////////////////////////////////////////////////////////
// GenerateStrips()
//
// in_indices: input index list, the indices you would use to render
// in_numIndices: number of entries in in_indices
// primGroups: array of optimized/stripified PrimitiveGroups
// numGroups: number of groups returned
//
// Be sure to call delete[] on the returned primGroups to avoid leaking mem
//
bool GenerateStrips(const unsigned short* in_indices, const unsigned int in_numIndices,
PrimitiveGroup** primGroups, unsigned short* numGroups, bool validateEnabled = false);


////////////////////////////////////////////////////////////////////////////////////////
// RemapIndices()
//
// Function to remap your indices to improve spatial locality in your vertex buffer.
//
// in_primGroups: array of PrimitiveGroups you want remapped
// numGroups: number of entries in in_primGroups
// numVerts: number of vertices in your vertex buffer, also can be thought of as the range
// of acceptable values for indices in your primitive groups.
// remappedGroups: array of remapped PrimitiveGroups
//
// Note that, according to the remapping handed back to you, you must reorder your
// vertex buffer.
//
// Credit goes to the MS Xbox crew for the idea for this interface.
//
void RemapIndices(const PrimitiveGroup* in_primGroups, const unsigned short numGroups,
const unsigned short numVerts, PrimitiveGroup** remappedGroups);

#endif





And here are the errors in the compilation:



Compilando...
Stdafx.cpp
Compilando...
Prc++.cpp
c:\users\jorge\documents\visual studio 2008\projects\prc++\prc++\Prc++.h(125) : error C2061: error de sintaxis : identificador 'PrimitiveGroup'
c:\users\jorge\documents\visual studio 2008\projects\prc++\prc++\Prc++.h(144) : error C4430: falta el especificador de tipo; se presupone int. Nota: C++ no admite default-int
c:\users\jorge\documents\visual studio 2008\projects\prc++\prc++\Prc++.h(144) : error C2143: error de sintaxis : falta ',' delante de '*'
AssemblyInfo.cpp
Generando código...

Share this post


Link to post
Share on other sites
Quote:

bool GenerateStrips(const unsigned short* in_indices, const unsigned int in_numIndices,
PrimitiveGroup** primGroups, unsigned short* numGroups, bool validateEnabled = false);

void RemapIndices(const PrimitiveGroup* in_primGroups, const unsigned short numGroups,
const unsigned short numVerts, PrimitiveGroup** remappedGroups);


Put these on to single lines:

bool GenerateStrips(const unsigned short* in_indices, const unsigned int in_numIndices, PrimitiveGroup** primGroups, unsigned short* numGroups, bool validateEnabled = false);

void RemapIndices(const PrimitiveGroup* in_primGroups, const unsigned short numGroups, const unsigned short numVerts, PrimitiveGroup** remappedGroups);

Share this post


Link to post
Share on other sites
I have put those lines in single lines, but i am still having the 3 same errors.

Now i have changed prc.h:



// Prc++.h

#pragma once

using namespace System;

namespace Prc {




enum PrimType
{
PT_LIST,
PT_STRIP,
PT_FAN
};



struct PrimitiveGroup
{
PrimType type;
unsigned int numIndices;
unsigned short* indices;

////////////////////////////////////////////////////////////////////////////////////////

PrimitiveGroup() : type(PT_STRIP), numIndices(0), indices(NULL) {}
~PrimitiveGroup()
{
if(indices)
delete[] indices;
indices = NULL;
}
};



public ref class Class1
{
// TODO: agregar aquí los métodos de la clase.


#ifndef NVTRISTRIP_H
#define NVTRISTRIP_H

#ifndef NULL
#define NULL 0
#endif

#pragma comment(lib, "nvtristrip")

////////////////////////////////////////////////////////////////////////////////////////
// Public interface for stripifier
////////////////////////////////////////////////////////////////////////////////////////

//GeForce1 and 2 cache size
#define CACHESIZE_GEFORCE1_2 16

//GeForce3 cache size
#define CACHESIZE_GEFORCE3 24






////////////////////////////////////////////////////////////////////////////////////////
// EnableRestart()
//
// For GPUs that support primitive restart, this sets a value as the restart index
//
// Restart is meaningless if strips are not being stitched together, so enabling restart
// makes NvTriStrip forcing stitching. So, you'll get back one strip.
//
// Default value: disabled
//
void EnableRestart(const unsigned int restartVal);

////////////////////////////////////////////////////////////////////////////////////////
// DisableRestart()
//
// For GPUs that support primitive restart, this disables using primitive restart
//
void DisableRestart();


////////////////////////////////////////////////////////////////////////////////////////
// SetCacheSize()
//
// Sets the cache size which the stripfier uses to optimize the data.
// Controls the length of the generated individual strips.
// This is the "actual" cache size, so 24 for GeForce3 and 16 for GeForce1/2
// You may want to play around with this number to tweak performance.
//
// Default value: 16
//
void SetCacheSize(const unsigned int cacheSize);


////////////////////////////////////////////////////////////////////////////////////////
// SetStitchStrips()
//
// bool to indicate whether to stitch together strips into one huge strip or not.
// If set to true, you'll get back one huge strip stitched together using degenerate
// triangles.
// If set to false, you'll get back a large number of separate strips.
//
// Default value: true
//
void SetStitchStrips(const bool bStitchStrips);


////////////////////////////////////////////////////////////////////////////////////////
// SetMinStripSize()
//
// Sets the minimum acceptable size for a strip, in triangles.
// All strips generated which are shorter than this will be thrown into one big, separate list.
//
// Default value: 0
//
void SetMinStripSize(const unsigned int minSize);


////////////////////////////////////////////////////////////////////////////////////////
// SetListsOnly()
//
// If set to true, will return an optimized list, with no strips at all.
//
// Default value: false
//
void SetListsOnly(const bool bListsOnly);


////////////////////////////////////////////////////////////////////////////////////////
// GenerateStrips()
//
// in_indices: input index list, the indices you would use to render
// in_numIndices: number of entries in in_indices
// primGroups: array of optimized/stripified PrimitiveGroups
// numGroups: number of groups returned
//
// Be sure to call delete[] on the returned primGroups to avoid leaking mem
//
bool GenerateStrips(const unsigned short* in_indices, const unsigned int in_numIndices,PrimitiveGroup** primGroups, unsigned short* numGroups, bool validateEnabled = false);


////////////////////////////////////////////////////////////////////////////////////////
// RemapIndices()
//
// Function to remap your indices to improve spatial locality in your vertex buffer.
//
// in_primGroups: array of PrimitiveGroups you want remapped
// numGroups: number of entries in in_primGroups
// numVerts: number of vertices in your vertex buffer, also can be thought of as the range
// of acceptable values for indices in your primitive groups.
// remappedGroups: array of remapped PrimitiveGroups
//
// Note that, according to the remapping handed back to you, you must reorder your
// vertex buffer.
//
// Credit goes to the MS Xbox crew for the idea for this interface.
//
void RemapIndices(const PrimitiveGroup*in_primGroups, const unsigned short numGroups,const unsigned short numVerts, PrimitiveGroup**remappedGroups);

#endif

};
}



but i have this errors compiling:

1>c:\users\jorge\documents\visual studio 2008\projects\prc++\prc++\Prc++.h(29) : error C2065: 'NULL' : identificador no declarado
1>c:\users\jorge\documents\visual studio 2008\projects\prc++\prc++\Prc++.h(34) : error C2065: 'NULL' : identificador no declarado
1>c:\users\jorge\documents\visual studio 2008\projects\prc++\prc++\Prc++.h(146) : error C3222: 'validateEnabled' : no se pueden declarar argumentos predeterminados para las funciones miembro de un tipo administrado o funciones genéricas
1>AssemblyInfo.cpp


[Edited by - jor1980 on March 10, 2010 8:18:39 AM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this