Jump to content
  • Advertisement

Archived

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

Bruno

OpenGL opengl 3d loader

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

Hi I''m tryng to make my own format to load 3d objects into opengl.., i''m tryng to read asc file format into memory, and then write my own format to the disk.., but i''m having some problems with memory allocation. Anyone can help me with this error?? I''m defining the structute like this: typedef struct estrutura { GLfloat x; GLfloat y; GLfloat z; struct estrutura *next,*before; }*apontador; apontador begining; apontador actual; and then later in the code, i have i cicle that reads every line of the asc file, and in each line a new memory block should be allocated like this The first malloc looks like this: begining=malloc(sizeof(struct estrutura)); When i try to compile i get this error... D:\opengl\gl\gl3.cpp(83) : error C2440: ''='' : cannot convert from ''void *'' to ''struct estrutura *'' Conversion from ''void*'' to pointer to non-''void'' requires an explicit cast Can anyone help me?? I use to program like this in the old Borland C, make probably the syntax is diferent in Visual C++... Thanks Bruno

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
try this:

begining=(struct estrutura *)malloc(sizeof(struct estrutura));

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!