HOWTO: creating small demo from scratch with clarification
category: general [glöplog]
Yo people!
All time I wanted to see just simple example by coders how to create D3D or OpenGL C++ demo step by step with explanation.. for instance several simple scenes with simple effects:
Requirements
1. it should be as simple as possible
2. it should use some sound system, like 4klang or v2
3. at least 2 scenes, to understand how to do a main loop
4. it should explaine how to add simple 2 graphics and text with simple effects (fades, scales)
5. there should be at least one 3d effect, shaders are NEXT STEP
SO what about to make a demo togather right here and show to the rest how it could be simple..
What do you think?
--keen
All time I wanted to see just simple example by coders how to create D3D or OpenGL C++ demo step by step with explanation.. for instance several simple scenes with simple effects:
Requirements
1. it should be as simple as possible
2. it should use some sound system, like 4klang or v2
3. at least 2 scenes, to understand how to do a main loop
4. it should explaine how to add simple 2 graphics and text with simple effects (fades, scales)
5. there should be at least one 3d effect, shaders are NEXT STEP
SO what about to make a demo togather right here and show to the rest how it could be simple..
What do you think?
--keen
@keen :
Nowadays on PC (don't know about oldschool platforms), making a demo has nothing simple, even for the simplest one :
Before lighting your first pixel on screen, or drawing your first 3D cube, it's a lot of work. It's not very hard, but very time consuming, and it's a bit frustrating having so much things to do (window initialization, setting vertex buffers, shaders, etc) before actually displaying something.
But it's totally worth it. Once your system is up and running, the only limit is your creativity.
By the way you are totally right about your approach : make it dead simple. You'll get some results faster, and you will be able to make your code evolve more easily when needed.
Tip : add features only when you need them. Don't plan them in advance. But make it flexible so you can add/extend features easily.
IQ's framework is a very good start.
Nowadays on PC (don't know about oldschool platforms), making a demo has nothing simple, even for the simplest one :
Before lighting your first pixel on screen, or drawing your first 3D cube, it's a lot of work. It's not very hard, but very time consuming, and it's a bit frustrating having so much things to do (window initialization, setting vertex buffers, shaders, etc) before actually displaying something.
But it's totally worth it. Once your system is up and running, the only limit is your creativity.
By the way you are totally right about your approach : make it dead simple. You'll get some results faster, and you will be able to make your code evolve more easily when needed.
Tip : add features only when you need them. Don't plan them in advance. But make it flexible so you can add/extend features easily.
IQ's framework is a very good start.
I held a few talks about that stuff a few years back: http://elsewhere.stc.cx/demoprogramming/.
I think OP needs a Computer Graphics 101 primer before anything else.
(also the drive to find the basic stuff him/herself. The idea of a silver bullet and "everything on a plate" is not a good omen)
(also the drive to find the basic stuff him/herself. The idea of a silver bullet and "everything on a plate" is not a good omen)
in4k
Well, maybe shaders should be the first step.
The IQ framework is kind of outdated if you really want to go crazy regarding size.
There are smaller ways to setup shaders (e.g. glCreateProgramv).
Quote:
shaders are NEXT STEP
Well, maybe shaders should be the first step.
The IQ framework is kind of outdated if you really want to go crazy regarding size.
There are smaller ways to setup shaders (e.g. glCreateProgramv).
Why am I only seeing this thread NOW !? (I'm looking at you, hugi.scene URL).
Quote:
don't know about oldschool platforms
i think as soon as size comes into play, its pretty much the same everywhere. (maybe its a bit less frustrating on sth like c64, because you can get results quicker with minimal or even no setup) i dont think sizecoding is something you should start with though. maybe i misinterpret the original post, but i dont think you should even start with demo coding when you dont know what "main loop" is =P better work your way through a bunch of tutorials, find something that looks nice to you, add some sounds, codercolors, strobo, and voila demo. now you can worry about size =P
Quote:
I think OP needs a Computer Graphics 101 primer before anything else.
(also the drive to find the basic stuff him/herself. The idea of a silver bullet and "everything on a plate" is not a good omen)
Plenty of developers already open sourced their prods. Take for instance proton-k by kewlers, with complete GNU rocket tracks and everything.
One needs to learn using the provided tools and being inventive, instead of following a walkthrough, that's how we started. And the bane of many people trying to start programming and failing, they read everything, but they have a hard time to create something on their own, this is how we all started and one has to break the ice, to sit down there and try to create your own algorithms, it will be hard and slow at the beginning, you will be tempted to copy the solution from the book. If you brake this ice, you start being creative and inventing everything from simple sines/cosines and math and stuff. But how, which language, API? Not sure.. I'd prefer software rendering at the beginning because it's easier to set up and just start writing pixels, instead of setting all the states in OpenGL and still getting a black screen. Maybe even processing to try some algorithms.
But regardless, maybe the idea with little steps you provided is not bad. There is nothing like this on youtube (a demomakers code marathon or something) and maybe some people want to have an idea how some simple things like one/two effects and transition or scripting how effects move would be interesting as a first insight for the newcomer. Maybe I should make a video with simple SDL setup and pixel effects and move on adding music and stuff (but don't when, I like the idea, and think of many demoscene related videos I could do, but busy with other democoding these days). Don't know if it will help, but an insight of what goes on with as simple as possible code, to motivate the newcomer that "hey this is how you can do some simple stuff and improve from there".
But regardless, maybe the idea with little steps you provided is not bad. There is nothing like this on youtube (a demomakers code marathon or something) and maybe some people want to have an idea how some simple things like one/two effects and transition or scripting how effects move would be interesting as a first insight for the newcomer. Maybe I should make a video with simple SDL setup and pixel effects and move on adding music and stuff (but don't when, I like the idea, and think of many demoscene related videos I could do, but busy with other democoding these days). Don't know if it will help, but an insight of what goes on with as simple as possible code, to motivate the newcomer that "hey this is how you can do some simple stuff and improve from there".
if a framework is too daunting for you to start with try processing and shadertoy first.
You don't really need a framework anyway. Just some simple code to do timing and stuff.
Quote:
There are smaller ways to setup shaders (e.g. glCreateProgramv).
what's a glCreateProgramv?
You mean glCreateShaderProgram.
Only Core in >= 4.1, but maybe GetProcAdress can give you a pointer...
Only Core in >= 4.1, but maybe GetProcAdress can give you a pointer...
If you are talking about a 4k/64k-framework, let me tell you it´s part of the fun already to get it working yourself. This is rewarding already, as you did it on your own and its working.
I can give you a small guideline, tho:
-Get a Windows-Window working.
-Get a DirectX- or OpenGL-Window working
-implement crinkler (www.crinkler.net) into your BuildChain (the helpfile has all informations you´ll need...just read carefully!)
---> At this point you can party a bit or two...your basecode is below 4k, yay! :)
-implement 4klang (http://4klang.untergrund.net) (again read the helpfile carefully, comes with copy/paste-able example-code)
-get shaderCompilerAtRuntime-code to work
-?
-profit
It´s a lot about settings in your compiler and stuff alike, so better do it all on your own, so you know why it works in the end! If you cant get this list done, you better only do the first two points on the list and make demos for now, revisit this list once you are less alien to graphics-coding. ;)
Always remember: Demomaking is not all about the endproduct, it´s mostly about the fun of making the product at all. ;)
I can give you a small guideline, tho:
-Get a Windows-Window working.
-Get a DirectX- or OpenGL-Window working
-implement crinkler (www.crinkler.net) into your BuildChain (the helpfile has all informations you´ll need...just read carefully!)
---> At this point you can party a bit or two...your basecode is below 4k, yay! :)
-implement 4klang (http://4klang.untergrund.net) (again read the helpfile carefully, comes with copy/paste-able example-code)
-get shaderCompilerAtRuntime-code to work
-?
-profit
It´s a lot about settings in your compiler and stuff alike, so better do it all on your own, so you know why it works in the end! If you cant get this list done, you better only do the first two points on the list and make demos for now, revisit this list once you are less alien to graphics-coding. ;)
Always remember: Demomaking is not all about the endproduct, it´s mostly about the fun of making the product at all. ;)
yeah hardy, but i did that once, and then be done with it. :) it's tedious and i can understand if ppl take some random framework (or rather base code) out there and just use that.
for that demo thing flure is pretty much right. if you want to do it from scratch it's a lot of boilerplate nowadays. setting up the buffers/shaders and such today vs tell the interface that the following vertices are to be rendered as triangles and just throw in the vertices one by one.
also what tomaes and optimus say. walking someone through this:
is like "build a framework for me and give me example code". be inventive, find out yourself how fading is done (check interpolation maybe? be careful, since you obviously want others to do the hard work: it's math). other than that, use something like sdl to handle all the platform specific setup for open gl for instance. for simple music playback (mp3/ogg) check libfmod or bass. rest is up to you, the little bit of coding to integrate all this is the necessary learning process if you want to change something later. if you don't know anything about linking and such, a walkthrough like this is pointless.
also there was a seminar at breakpoint by navis on how to code demos iirc.
for that demo thing flure is pretty much right. if you want to do it from scratch it's a lot of boilerplate nowadays. setting up the buffers/shaders and such today vs tell the interface that the following vertices are to be rendered as triangles and just throw in the vertices one by one.
also what tomaes and optimus say. walking someone through this:
Quote:
3. at least 2 scenes, to understand how to do a main loop
4. it should explaine how to add simple 2 graphics and text with simple effects (fades, scales)
is like "build a framework for me and give me example code". be inventive, find out yourself how fading is done (check interpolation maybe? be careful, since you obviously want others to do the hard work: it's math). other than that, use something like sdl to handle all the platform specific setup for open gl for instance. for simple music playback (mp3/ogg) check libfmod or bass. rest is up to you, the little bit of coding to integrate all this is the necessary learning process if you want to change something later. if you don't know anything about linking and such, a walkthrough like this is pointless.
also there was a seminar at breakpoint by navis on how to code demos iirc.
Thanks Gargaj ;)
I tried to build first link with vs2012 and I had some minor issues, the second link was blocked by Chrome ;) but I also fixed it and make it run...
thanks... btw, at Revision realtime coding shader compo was with some kind of strange UI, how to setup it, I think it was not vs, am I right?
Quote:
@keen :
Nowadays on PC (don't know about oldschool platforms), making a demo has nothing simple, even for the simplest one :
Before lighting your first pixel on screen, or drawing your first 3D cube, it's a lot of work. It's not very hard, but very time consuming, and it's a bit frustrating having so much things to do (window initialization, setting vertex buffers, shaders, etc) before actually displaying something.
okok.. winapi stuff is hard only from the start, then contexts and CALLBACK functions and changes every new VS make me left it before..
I just want to have something working which could be used as basis for newbies, thus people can use that to move further easy.. it is hard from the begging but it changes too fast and I think there should be simple ways to avoid useless stuff and really hard things..
Quote:
By the way you are totally right about your approach : make it dead simple. You'll get some results faster, and you will be able to make your code evolve more easily when needed.
just imagine we have a framework (it could be IQ's) and we understand how to use it in a simple way to add some stuff.. then we can exchange with examples how to do some stuff and then make a small simple demo.. now I can just draw some objects in OGL (I understand how it is initialize etc, it looks like nehe examples) but I don't understand how to do something finished, like sychronized with music 3d scene with pulsing objects and some 2d art at the front of it(like credits and some message etc)
Quote:
Tip : add features only when you need them. Don't plan them in advance. But make it flexible so you can add/extend features easily.
IQ's framework is a very good start.
I started with it ;)))
OK, I can run it in vs2012, I can change scenes and make my own but where to go further? how to work with camera? and how to do this example? http://iquilezles.org/www/articles/sincos/sincos.htm
I did a really basic setup/startup repo for anyone willing to learn opengl3 and software audio rendering:
https://github.com/uucidl/uu.micros
should compile/work on OSX and windows. May require minor customization of the ./build script
https://github.com/uucidl/uu.micros
should compile/work on OSX and windows. May require minor customization of the ./build script