Skip to main content
gamedev.net
🔒 Locked

[2d array question]

Started by aDasTRa 1 reply 400+ views
Original Post
aDasTRa
aDasTRa
how do you go about dynamically allocating a 2-dimensional array (in c++)... here''s my problem: i am making a model class that will have an array of vertices, which is itself an array of three elements. so this array of vertices would be: float vertices[x][3], where x is the number of vertices in the model. the problem i am facing is i want this ''x'' to be arbitrary, so some models can have more or less vertices than others. i know how to do this with a 1-d array, with a single pointer (ie ''float *vertices, and then vertices = new float[x]), but i don''t know how for 2d... any suggestions? thanks <(o)>
<(o)>
aDasTRa
aDasTRa
thanks man


<(o)>
<(o)>

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.