This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 »
1741
Function Peer Review / Re: NEEDED FUNCTION LIST
« on: December 10, 2010, 05:14:00 pm »
Damn, I don't have Linux. I could use cygwin, but I had problems with it before, so no thanks.
1742
Function Peer Review / Re: NEEDED FUNCTION LIST
« on: December 10, 2010, 02:37:46 pm »
What did you use to match up thous two lists?
I have added the missing shape drawing functions, as well as adding some sprite functions to the header. So they will show up in the list now. Also, as I said, all draw_text functions are done. Its just that ENIGMA doesn't load font texture from LGM right now, and so until that is done they will not be added (at least Josh said so). So lets wait.
I will go trough the list and see what I can add.
I have added the missing shape drawing functions, as well as adding some sprite functions to the header. So they will show up in the list now. Also, as I said, all draw_text functions are done. Its just that ENIGMA doesn't load font texture from LGM right now, and so until that is done they will not be added (at least Josh said so). So lets wait.
I will go trough the list and see what I can add.
1743
Function Peer Review / Re: NEEDED FUNCTION LIST
« on: December 07, 2010, 05:09:56 pm »Quote
Let me reiterate (again) that I have no idea why those damn GM*.h headers are still in there. I wrote most of them when I was fourteen. It's time to remove them.Yeah, I hate them too. I wanted to ask you about that but I am sure I already did in the past. Basically, Enigma needs some cleanup. Lots of useless files should be removed, including the GM* ones.
1744
Function Peer Review / Re: NEEDED FUNCTION LIST
« on: December 07, 2010, 01:07:44 pm »
All draw_text functions are done.
Also, I did implement c_orange for the curve example, but I haven't had time to merge any of this. I am quite new to this rev thing, and so I don't want to break anything.
Also, I did implement c_orange for the curve example, but I haven't had time to merge any of this. I am quite new to this rev thing, and so I don't want to break anything.
1745
Function Peer Review / Re: NEEDED FUNCTION LIST
« on: December 06, 2010, 09:41:57 am »Quote
Note that not some things on this list might already be made.Yeah, all text and sprite drawing functions are done. And many of thous functions can be made quite easily. When I finish my curve thing (which is not in GM, so the list is bigger than the GM one), then I will check into doing these. Of course others should pitch in too.
1746
General ENIGMA / Re: variable_* Functions
« on: December 05, 2010, 03:49:12 pm »
Yeah, I have used them too. There are always ways to not use them and make that particular piece of code another way. But it is still nice to use them, for example, in translations. You could have a file like so:
introduction="This is blah blah"
And in the game you could have something like:
variable_global_set("str_"+variable,string);
And then just use str_introduction anywhere where you want to use your string. Its better than to save them inside arrays or something because you can more easily get the correct string. Arrays and such of course would be faster.
edit: Also, my example works only if variable_global_set actually creates the variable as well. I haven't tested so I don't know. In GM I actually used execute_string() to do this. I used variable_ functions for other things, like setting correct values to checkboxes with names etc.
introduction="This is blah blah"
And in the game you could have something like:
variable_global_set("str_"+variable,string);
And then just use str_introduction anywhere where you want to use your string. Its better than to save them inside arrays or something because you can more easily get the correct string. Arrays and such of course would be faster.
edit: Also, my example works only if variable_global_set actually creates the variable as well. I haven't tested so I don't know. In GM I actually used execute_string() to do this. I used variable_ functions for other things, like setting correct values to checkboxes with names etc.
1747
Function Peer Review / Re: Custom: Curve drawing functions (Bezier and Spline)
« on: December 04, 2010, 04:26:43 pm »
Ou, ok. Thought that suggestion was pointed at me.
I released the current source. Added new functions and changed the _begin() spline functions to use stacks and vectors. The speed seems identical, but the memory usage could be down. Also now it allows nesting.
I added anti-aliasing function, which makes the splines look a lot better. Thou I have a decision on how to implement it. What I did for now is make curves totally independent from the rest of the system. So you can change color, alpha, aa, drawing mode etc. totally independent from other functions. And I am not sure if that is the best idea. For example, I could have aa code like this:
And testing speed is extremely hard because FPS jumps like crazy. I think that number is updated several times too much. Maybe it should be updated once per second or once per half a second. Maybe its normal like this, but I never seen it jump like that in GM.
I released the current source. Added new functions and changed the _begin() spline functions to use stacks and vectors. The speed seems identical, but the memory usage could be down. Also now it allows nesting.
I added anti-aliasing function, which makes the splines look a lot better. Thou I have a decision on how to implement it. What I did for now is make curves totally independent from the rest of the system. So you can change color, alpha, aa, drawing mode etc. totally independent from other functions. And I am not sure if that is the best idea. For example, I could have aa code like this:
Code: (C++) [Select]
void draw_set_antialiasing(bool enable, int qual)
{
if (enable==1){
glEnable(GL_LINE_SMOOTH);
glHint(GL_LINE_SMOOTH_HINT, qual);
}else{
glDisable(GL_LINE_SMOOTH);
}
}
But that will enable aa for every primitive (circles etc.). I ended up doing this:Code: (C++) [Select]
pr_curve_aa = enable;
pr_curve_aa_qual = qual;
With having this in every drawing function (which of course can slow down the function):Code: (C++) [Select]
if (pr_curve_aa==1){
glEnable(GL_LINE_SMOOTH);
glHint(GL_LINE_SMOOTH_HINT, pr_curve_aa_qual);
}else{
glDisable(GL_LINE_SMOOTH);
}
Of course it is needed only once per function call, and compared to all the trig going on just to draw thous splines and curves, I think this doesn't impact the speed at all. It just seems wrong..And testing speed is extremely hard because FPS jumps like crazy. I think that number is updated several times too much. Maybe it should be updated once per second or once per half a second. Maybe its normal like this, but I never seen it jump like that in GM.
1748
Function Peer Review / Re: Custom: Curve drawing functions (Bezier and Spline)
« on: December 04, 2010, 02:53:33 pm »
As far as I know* vectors are better for inserting at the end and iterating trough.** Lists are better for inserting and deleting in the middle (or anywhere). So in my case I think vectors could be better.
*And I know little, as 2 days ago I didn't know that in C++ vectors were arrays.
** http://www.gamedev.net/community/forums/topic.asp?topic_id=211458
*And I know little, as 2 days ago I didn't know that in C++ vectors were arrays.
** http://www.gamedev.net/community/forums/topic.asp?topic_id=211458
1749
Function Peer Review / Re: Custom: Curve drawing functions (Bezier and Spline)
« on: December 04, 2010, 01:03:33 pm »
So this is how the code looks like right now:
Code: (C++) [Select]
#include <stack>
#include <vector>
struct splinePoint {
float x,y,al;
int col;
};
typedef std::vector< splinePoint > spline;
static std::stack< spline, std::vector<spline*> > startedSplines;
static std::stack< int > startedSplinesMode;
void draw_spline_begin(int mode)
{
startedSplinesMode.push(mode);
startedSplines.push(new spline);
}
int draw_spline_vertex(float x, float y)
{
splinePoint point={x,y,pr_curve_alpha1,pr_curve_color1};
startedSplines.top()->push_back(point);
return startedSplines.top()->size()-2;
}
int draw_spline_vertex_color(float x, float y, int col, float alpha)
{
splinePoint point={x,y,alpha,col};
startedSplines.top()->push_back(point);
return startedSplines.top()->size()-2;
}
void draw_spline_end()
{
untexture();
glPushAttrib(GL_LINE_BIT);
glLineWidth(pr_curve_width);
glBegin(startedSplinesMode.top());
spline &arr = *startedSplines.top();
if (arr.size()>4){
for (int i = 3; i < arr.size(); i++)
{
draw_spline_part(arr[i-3].x, arr[i-3].y, arr[i-2].x, arr[i-2].y, arr[i-1].x, arr[i-1].y, arr[i].x, arr[i].y, arr[i-2].col, arr[i-1].col, arr[i-2].al, arr[i-1].al);
}
}
glEnd();
glPopAttrib();
glColor4ubv(enigma::currentcolor);
delete &arr;
startedSplines.pop();
startedSplinesMode.pop();
}
This code works, and nesting works too. Thou how did you thought of overwriting vectors? I can't find a way to make vectors start writing from 0 again without clearing the vector list. But now it is destroyed with pop() so I see no reason to clear it at all.
1750
Function Peer Review / Re: Custom: Curve drawing functions (Bezier and Spline)
« on: December 04, 2010, 06:33:31 am »
I actually had trouble making your sample code to run, so I ditched the list. I will try to make it work thou.
Quote
Instead of clearing it, it would be more efficient (speed wise, not memory wise) to keep your own static index, and only push back if index >= vector::size(). That way, you can just reset the index when begin() is called, and the system doesn't need to waste time on allocation otherwise (especially for repetitive spline drawing).So overwriting vectors? Like I have 10 points, and after _end I just make it insert from 0 over the 10 already there? But first, isn't vectors slow at that kind of thing? Like inserting and removing? And what if in the next step I add only 9 points, then the tenth with still be there and draw? Or I just simply didn't understand your idea. Mostly because I think in arrays, not vectors (which is kind of the same, but still).
Quote
Question: Why do they all have the type int if you're just returning 0? In what case would they be non-zero? Lack of a graphics card? I mean, I can't think of anything.As Josh pointed out, GM has return values for everything. I am not sure if it impacts speed in any way thou. If it is slower then of course it would be better to ditch them for most part. Thou functions like spline_vertex can return the number of points and so on. I actually did make it return that when I did this with arrays.
1751
Issues Help Desk / Re: Can't draw anything inside _begin _end
« on: December 04, 2010, 06:25:25 am »
RetroX: Wouldn't it connect the last point to the circle? And then connect the circles last point to the next one? Also, the circle will the draw with the currently selected mode, which cause problems (in my case it connected all of the points in the circle). I would be almost better to do something like glend and glbegin before and after the circle. Of course that could be slow thou. So drawing in _end is still the best thing I can come up with. Its also the best thing Mark could come up with. And this actually allows some neat effects like transforming before drawing. So you can add all points, then rotate it 45 degrees, scale 2 times and then draw.
1752
Function Peer Review / Re: Custom: Curve drawing functions (Bezier and Spline)
« on: December 03, 2010, 04:30:24 pm »
I am having trouble with vectors and structs. This is how I ended up doing it:
Also, code=C++ doesn't work for me.. How exactly do you enabled highlighting?
edit: Never mind it seems to need some time to do that.
Code: (C++) [Select]
struct splinePoint {
float x,y,al;
int col;
};
std::vector<splinePoint> spline;
int draw_spline_begin(int mode)
{
pr_curve_begin = mode;
return 0;
}
int draw_spline_vertex(float x, float y)
{
splinePoint point={x,y,pr_curve_alpha1,pr_curve_color1};
spline.push_back(point);
return 0;
}
int draw_spline_vertex_color(float x, float y, int col, float alpha)
{
splinePoint point={x,y,alpha,col};
spline.push_back(point);
return 0;
}
int draw_spline_end()
{
untexture();
glPushAttrib(GL_LINE_BIT);
glLineWidth(pr_curve_width);
glBegin(pr_curve_begin);
if (spline.size()>4){
for (int i = 3; i < spline.size(); i++)
{
draw_spline_part(spline[i-3].x, spline[i-3].y, spline[i-2].x, spline[i-2].y, spline[i-1].x, spline[i-1].y, spline[i].x, spline[i].y, spline[i-2].col, spline[i-1].col, spline[i-2].al, spline[i-1].al);
}
}
glEnd();
glPopAttrib();
glColor4ubv(enigma::currentcolor);
spline.clear();
return 0;
}
I have a feeling I have some massive memory leak in there. I basically create the vector at the beginning, add points to it with the vertex functions, draw it in the _end function as well as clearing it so the next time it is empty again. I have a question about that vector declaration and the point adding. The vector will be declared once if its in the beginning right? And the "splinePoint point" will be added to the vector, but when it is cleared the point itself will remain, its just the vector that is cleared right? And so, how can I remove thous points from memory in _end function?Also, code=C++ doesn't work for me.. How exactly do you enabled highlighting?
edit: Never mind it seems to need some time to do that.
1753
Function Peer Review / Re: Custom: Curve drawing functions (Bezier and Spline)
« on: December 02, 2010, 03:43:18 pm »
I can't really get why you used lists in that code. I am readying about vectors now and I think I could just use one vector, then clear it when _begin is called and then push_back with every point.
1754
Function Peer Review / Re: Custom: Curve drawing functions (Bezier and Spline)
« on: December 02, 2010, 11:14:29 am »
No I am not. I just registered. HaRRiKiRi was taken (as a username), so its thedeusex.
Also, I thought the point of SVN was not to be able to break anything. As every change is saved, then it should be possible to revert back.. Anyway, I will commit only the few files I myself make. So only functions, not systems as a whole.
Also, I thought the point of SVN was not to be able to break anything. As every change is saved, then it should be possible to revert back.. Anyway, I will commit only the few files I myself make. So only functions, not systems as a whole.
1755
Function Peer Review / Re: Custom: Curve drawing functions (Bezier and Spline)
« on: December 02, 2010, 11:03:21 am »
This is something I was looking for. I guess speed hit is minimal or none? Or even a gain? Anyway, thanks for the example.
Also, don't really want to get into all that committing, as I can break more things than I can fix. That is why I post it here so more knowledgeable people can look at it and at some point implement if considered good enough. But I will consider it.
Also, don't really want to get into all that committing, as I can break more things than I can fix. That is why I post it here so more knowledgeable people can look at it and at some point implement if considered good enough. But I will consider it.
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 »