• What do you need help with? Version 1
    5,001 replies, posted
[QUOTE=ROBO_DONUT;25245567]They don't exist, sadly. You kind of have to google around for each thing individually, using the OGL3/4 reference as a guide. The general process goes something like this: [LIST=1] [*]Create an OpenGL context (SDL can do this for you) [*]Create a default shader program. The most basic vertex shader takes a vertex position and multiplies it by the model/view/projection matrices. The most basic fragment shader outputs a constant color. (The [URL="http://en.wikipedia.org/wiki/GLSL"]wikipedia article on GLSL[/URL] actually lists examples of these "trivial" shaders) [*]Create a projection matrix (and model/view if you use them). In OpenGL 2.x, built-in matrix functions are still available. In >=3.0, you need to write your own matrix routines or use external math libraries. (This sounds stupid, but it actually simplifies the API greatly and makes things a lot more flexible. You'll learn to like it.) [*]Load vertex data with glVertexPointer. [*]Enable vertex arrays with glEnableClientState. [*]Render directly: [LIST=a] [*]Execute glDrawArrays. [/LIST] or by index: [LIST=a] [*]Load vertex indices with glIndexPointer [*]Execute glDrawElements [/LIST] [/LIST] There are more advanced topics, such as texture mapping, VBO/FBOs, blending, etc., but the basic outline listed above applies to [I]everything[/I].[/QUOTE] That looks like a hell of a lot of fun. I think I'll be frequenting this thread soon. :v:
I thought we were talking specifically OpenGL 3+ context.
[QUOTE=esalaka;25245764]I thought we were talking specifically OpenGL 3+ context.[/QUOTE] I'm like 90% sure it doesn't make a difference. [editline]13:37[/editline] Whoa. Nevermind. Google says you're right. That's an issue I've never run into before.
[IMG]http://www.mimicprod.net/wp-content/uploads/2009/01/editor-01.png[/IMG] Unrelated to the above problem, but how would I go about doing this in C# and Winforms. I mean drawing the map on the right panel. Apparently this uses OpenGL, but is there a way to use SDL? Edit: Just found SDL.net. That'd do it, right?
I did a similar thing recently. If it's that simple you don't need OpenGL or SDL, just use a picturebox and draw on it with GDI.
[QUOTE=Darwin226;25245943]I did a similar thing recently. If it's that simple you don't need OpenGL or SDL, just use a picturebox and draw on it with GDI.[/QUOTE] Well, it needs to draw several layers on top of each other, taking into account transparency. Edit: Actually, probably not even that...
[QUOTE=BlkDucky;25245880]Unrelated to the above problem, but how would I go about doing this in C# and Winforms. I mean drawing the map on the right panel. Apparently this uses OpenGL, but is there a way to use SDL? Edit: Just found SDL.net. That'd do it, right?[/QUOTE] SDL will only give you a window with a GL context and nothing else (aside from input, sound, etc.). If you want to put GL in an editor like that, you'll need to use whatever means are provided by your widget toolkit.
[QUOTE=BlkDucky;25245995]Well, it needs to draw several layers on top of each other, taking into account transparency. Edit: Actually, probably not even that...[/QUOTE] I use multiple layers too. It's just a matter of how you handle shapes. The ones that are last in the render list get drawn on top of everything. It works well. On the other hand, if you want to use OpenGL, OpenTK has a GLControl that you can put into a form.
[QUOTE=Darwin226;25245437]I want to add C# scripting to my game that would work kinda like shaders do. A few input variables and a few output variables. The script would take the input, run the code and return the output. How would I do that? Googling "c# runtime compilation" and "c# scripting" didn't really show me anything useful. At least I didn't think it was.[/QUOTE] If you like to learn by example, [url=http://www.linqpad.net/]LINQPad[/url] is probably the closest you'll get to C# run-time compilation. They have one of my favourite licenses: [quote] LINQPad is not an open-source product and the source code is protected by standard copyright laws. Nonetheless, you are free to disassemble the executable to satisfy your curiosity. The author provides no warranties, and accepts no liability for direct or consequential damages. [/quote]
[QUOTE=arienh4;25246631]If you like to learn by example, [URL="http://www.linqpad.net/"]LINQPad[/URL] is probably the closest you'll get to C# run-time compilation. They have one of my favourite licenses:[/QUOTE] So, uh, why don't they just release it open source? They obviously don't mind people having a look.
[QUOTE=BlkDucky;25246690]So, uh, why don't they just release it open source? They obviously don't mind people having a look.[/QUOTE] Because open-sourcing means relinquishing copyright in some way. This way they still maintain full exclusive rights over the code. Open-source doesn't mean "feel free to look at the source", it means "feel free to do whatever you want with the source (as long as you stick to these conditions)"
[QUOTE=Darwin226;25245437]I want to add C# scripting to my game that would work kinda like shaders do. A few input variables and a few output variables. The script would take the input, run the code and return the output. How would I do that? Googling "c# runtime compilation" and "c# scripting" didn't really show me anything useful. At least I didn't think it was.[/QUOTE] That's interesting, because the first result when searching for "c# scripting" is exactly what you want. [url]http://www.csscript.net/[/url] I've used it before in a few projects. It's pretty much your best bet.
I was actually thinking of doing it my self with .NET without using an external API.
[QUOTE=Darwin226;25247937]I was actually thinking of doing it my self with .NET without using an external API.[/QUOTE] [url]http://www.trelford.com/blog/post/C-Scripting.aspx[/url] Hmmm....
[QUOTE=arienh4;25247598]Because open-sourcing means relinquishing copyright in some way. This way they still maintain full exclusive rights over the code. Open-source doesn't mean "feel free to look at the source", it means "feel free to do whatever you want with the source (as long as you stick to these conditions)"[/QUOTE] Oh okay, that makes sense, I guess. Clever way to do it, actually.
[QUOTE=arienh4;25247598]Because open-sourcing means relinquishing copyright in some way.[/QUOTE] No. You aren't "relinquishing copyright" in [i]any[/i] way.
Here we go again.
[QUOTE=ROBO_DONUT;25248029]No. You aren't "relinquishing copyright" in [i]any[/i] way.[/QUOTE] I explained what I meant right below. English isn't a programming language, you don't stop reading at the first error you spot. You relinquish (some) of the [b]exclusive[/b] rights copyright entails, which are the right to copy, distribute and adapt the work. Give me one F/OSS licence that doesn't grant the user the right to copy, distribute or adapt the code.
[QUOTE=ROBO_DONUT;25248029]No. You aren't "relinquishing copyright" in [I]any[/I] way.[/QUOTE] So it... doesn't make sense? [editline]07:31PM[/editline] Wait. So it does? Damn. I'm just going to leave this conversation before I get even more confused.
[QUOTE=arienh4;25248485]You relinquish (some) of the [b]exclusive[/b] rights copyright entails, which are the right to copy, distribute and adapt the work. Give me one F/OSS licence that doesn't grant the user the right to copy, distribute or adapt the code.[/QUOTE] There are none, since the whole point of F/OSS is to make source code redistributable and adaptable!
[QUOTE=arienh4;25248485]Give me one F/OSS licence that doesn't grant the user the right to copy, distribute or adapt the code.[/QUOTE] iirc the Source SDK code is under a license that prohibits distribution. There was a thread about it on the Steam forums once, I'll look it up. [editline]09:06PM[/editline] [url]http://forums.steampowered.com/forums/showthread.php?p=8583777#post8583777[/url]
[QUOTE=ZeekyHBomb;25249132]iirc the Source SDK code is under a license that prohibits distribution. There was a thread about it on the Steam forums once, I'll look it up. [/QUOTE] It's not a Free/Open Source Software license, though.
[QUOTE=esalaka;25248564]There are none, since the whole point of F/OSS is to make source code redistributable and adaptable![/QUOTE] That's exactly my point. Thank you.
[QUOTE=arienh4;25248485]I explained what I meant right below. English isn't a programming language, you don't stop reading at the first error you spot.[/QUOTE] I read it. [QUOTE=arienh4;25248485]You relinquish (some) of the [b]exclusive[/b] rights copyright entails, which are the right to copy, distribute and adapt the work.[/QUOTE] You need to look up the definition of "relinquish". You are still the sole copyright owner(s) of that code and you maintain every right that comes with it. No rights are relinquished. IANAL, but I believe you can even change the license later, if you want. It just won't prevent people from using the old code under the old license. [QUOTE=arienh4;25248485]Give me one F/OSS licence that doesn't grant the user the right to copy, distribute or adapt the code.[/QUOTE] This isn't relevant. What rights are being "relinquished" here?
Well, it is not free, but open source. And open source was what this was originally about: [QUOTE=BlkDucky;25246690]So, uh, why don't they just release it open source? They obviously don't mind people having a look.[/QUOTE] Unless the topic did carry away from that statement.
[QUOTE=ROBO_DONUT;25249517]IANAL, but I believe you can even change the license later, if you want. It just won't prevent people from using the old code under the old license.[/QUOTE] Neither am I, but you totally hit the nail on the head :D It is actually a well known tactic by larger companies to release their libraries and such under the GPL, and then charge money for a license exclusion. Intel does this on a regular basis. You can also change your license to whatever you want at any time. You can even change it to a dual license. (Some projects have had to do this because fun fact: the GPL v3 is not compatible with anything other than the LGPL, AGPL, and Apache 2.0 license. Which means BSD, MIT, and such are incompatible. So you can't release source under a GPL v3, if you also have a BSD licensed product within it. Fun times, but no one enforces it. Shocker.)
If anyone is interested, [URL="http://www.mattephraim.com/blog/2009/01/02/treating-c-like-a-scripting-language/"]this[/URL] is finally what I was looking for.
[QUOTE=ROBO_DONUT;25249517]I read it. You need to look up the definition of "relinquish". You are still the sole copyright owner(s) of that code and you maintain every right that comes with it. No rights are relinquished. IANAL, but I believe you can even change the license later, if you want. It just won't prevent people from using the old code under the old license. This isn't relevant. What rights are being "relinquished" here?[/QUOTE] The exclusive rights to copy, distribute and adapt the work. Regardless of whether a new version is released under a new licence, you can never get back full exclusive rights (exclusive meaning "shutting out all others") to that particular version of the work. Relinquish means "to give up; put aside or desist from". In providing something under an F/OSS licence, you give up your exclusive rights to the work, as I've said many times before.
I'm having some trouble plotting lines. [img]http://img178.imageshack.us/img178/4271/problemoi.png[/img] It should draw the lines evenly around the center. Here's the test code [cpp] #define PI 3.14159265 for (float f=0;f<PI+PI;f+=(PI/100.f)) { line(&i,&Vector2f(200.f,200.f),&Vector2f(200.f+cos(f)*199.f,200.f+sin(f)*199.f)); } [/cpp] And the line function [cpp] void line(sf::Image* img,sf::Vector2f* p1,sf::Vector2f* p2) { int x1 = p1->x; int y1 = p1->y; int x2 = p2->x; int y2 = p2->y; int dx = x2-x1; int dy = y2-y1; int inc; if (abs(dx)>abs(dy)) { inc = abs(dy!=0?dx/dy:dx); int y = y1; for (int x=x1;x!=x2;x+=sign(dx)) { if (abs(x-x1)%inc == 0) y+=sign(dy); img->SetPixel(x,y,sf::Color::Blue); } } else { inc = abs(dx!=0?dy/dx:dy); int x = x1; for (int y=y1;y!=y2;y+=sign(dy)) { if (abs(y-y1)%inc == 0) x+=sign(dx); img->SetPixel(x,y,sf::Color::Blue); } } } [/cpp]
Can someone please suggest me a book to learn C++ from thats for a complete beginner with explanations of each code segment and what it does? Or if there is none the best beginner on there is. Thanks.
Sorry, you need to Log In to post a reply to this thread.