flat assembler
Message board for the users of flat assembler.
Index
> Tutorials and Examples > fun opengl game (3D) + guassian blur shader example Goto page Previous 1, 2, 3, 4 Next |
Author |
|
dancho 17 Sep 2013, 08:35
tthsqe wrote: Before introducing more complex models (I agree - those diatoms do look great), we ought to maximize the CPU -> GPU triangle transfer rate, or store some of the models on the GPU. Do you know how to do this? I have a strong feeling all of the calls to glvertex3f are not the best way. the only way to free some cpu time is the use of the shader program , shaders are running calcs on the rendering hardwer ( the graphic card ) and frees cpu time for some other operation , I played with glsl ( opengl shader api ) and it is powerfull thing , language is like C and you can quickly catch syntax ... there is a lot of tutorials for glsl , just search for modern opengl glsl , http://ogldev.atspace.co.uk/index.html http://www.arcsynthesis.org/gltut/index.html http://openglbook.com/ http://www.opengl-tutorial.org/ this is editor , you can see your shader in real time ,really nice and powerfull : http://www.geeks3d.com/glslhacker/ gl&hf ps this 2 library helped me a lot in fast app development , but in C , you'll have to port headers to fasm style ofc ... http://www.glfw.org/ http://glew.sourceforge.net/ pps this is all for opengl 3.* and higher , there isn't glvertex3* functions here , no need really , just do some tutorials and you will found why ... http://www.opengl.org/sdk/docs/man3/ |
|||
17 Sep 2013, 08:35 |
|
tthsqe 24 Sep 2013, 04:40
Quote: can you use the real keyboard scancodes to tell the keys to the program? then, i will have the qsdz control, and any keaybord mapping will have the same physical correspondance. Can you give a quick example of what this means? Are you talking about scanning the keyboard state each frame instead of reading them in the message loop? Also, the graphics are continually being updated. You can see a screenshot of the most recent version on my first post. The particle counts for each enemy are given by WINDMILL_PAR_COUNT, DIAMOND_PAR_COUNT, ect in the source |
|||
24 Sep 2013, 04:40 |
|
edfed 24 Sep 2013, 08:36
i mean, the hardware keyboard layout is the same for everybody (qwerty, azerty, bepo, etc...)
but the soft layout changes (qwerty, azerty, bepo) and makes it difficult to use the alpha keys reliably for the moves. in my case, the keys wasd are not disposed as a directional cross, the hardware scancodes are "geographic" and i think they are better suitable for the game dev than the character keys. |
|||
24 Sep 2013, 08:36 |
|
tthsqe 24 Sep 2013, 11:46
oh, i get it. What api functions would I use for that? I'm assume GetKeyboardState will not work because it 'copies the status of the 256 virtual keys to the specified buffer' and virtual keys are not what you are talking about...
|
|||
24 Sep 2013, 11:46 |
|
matefkr 25 Sep 2013, 09:15
http://www.youtube.com/watch?v=e1TCHfDE7jI
there i can see a very similar graphics thing on some things.. its yours? |
|||
25 Sep 2013, 09:15 |
|
sleepsleep 25 Sep 2013, 14:35
too similiar... except the top bar got score, time, and highest score.
|
|||
25 Sep 2013, 14:35 |
|
matefkr 25 Sep 2013, 22:33
i wonder wich one is earlier. because some stuff can be disassemblered, but whatever. If it was stolen, then should report this. if the person made this and put it there then there is nothing else to do, if this is sthe stolen copy, then perhaps should reconsider allowing the person to handle moneys with common projects.
|
|||
25 Sep 2013, 22:33 |
|
edfed 25 Sep 2013, 22:33
a dot will always be a dot, and the drawer of the dot will not change anything to that, a dot is a dot.
then, a geometry war 2 is a geometry war 2 and cannot be anything else. maybe you can make a map with inverted colors... white instead of black, and so on. about the keyboard, sorry, i don't have any solution, i am still a pure noob in win api. but i am sure there is a way to interpret keys by scancode. even in windows. but really, your dot looks very similar to their dot... maybe they use your dot in fact sue them until you or they don't have more money, the world will be a little more balanced after that but before (or after like me) saying, they copied your idea etc... can you juste read the title bar of this program? what do you see? i see: aGW2 clone. the word clone here means, it is a copy of the original. then, close this nonsense, we don't care who had the idea first, otherwise, stop breath now cause jesus and ramses 2 had the idea before you. Last edited by edfed on 25 Sep 2013, 22:43; edited 1 time in total |
|||
25 Sep 2013, 22:33 |
|
matefkr 25 Sep 2013, 22:41
There was a person who posted this video (well i dunno) so this "person" have posted a video about another game wich seemed like many things were stolen from gta san andreas or such and some stuff only modified. plus some stuff added. the game is called saints row 4.
so perhaps stolen in some way? but u never know.. in reality making 3d stuff in high quality is rather old stuff and already used to fake some persons on videos, so perhaps such is the case recently. this is btw a very good reason never to pay for webcam strip porn things. |
|||
25 Sep 2013, 22:41 |
|
matefkr 25 Sep 2013, 22:42
there are already websits exploiting such a thing. for example Chaturbate or similar seems very likely to be such.. or contain many such individduals at least. but well.
|
|||
25 Sep 2013, 22:42 |
|
sleepsleep 25 Sep 2013, 22:51
tthsqe wrote:
this actually confuse me a lot, as i just read it today, maybe i overlook this sentence from the beginning, http://en.wikipedia.org/wiki/Geometry_Wars:_Retro_Evolved_2 (2008) |
|||
25 Sep 2013, 22:51 |
|
matefkr 25 Sep 2013, 23:12
oh. i dont read lengthy topics, just look at pictures and some questions. fine then.
|
|||
25 Sep 2013, 23:12 |
|
matefkr 25 Sep 2013, 23:14
tthsqe wrote to me we can make some game so now i have a 2 person team. tthsqe have not yet added me on skype.
|
|||
25 Sep 2013, 23:14 |
|
tthsqe 26 Sep 2013, 00:54
I almost have the graphics updated and all of the enemy types included.
What this game needs is some sound and some level types or AI. Sound: I have no idea about this and have never created any sound files before. AI: this is actually fairly simple. The game logic will have the current game state and simply needs to determine where and when and what types of enemies to spawn. Currently the game just spawn enemies randomly, which is quite boring. |
|||
26 Sep 2013, 00:54 |
|
edfed 26 Sep 2013, 12:20
i'd like to join. i need to practice a little more win32+openGL with fasm, i have not a lot of time to give for this project, but why not just try to add some features like sound, IA, skins, menus.... do you manage the sources with a versionning repository?
|
|||
26 Sep 2013, 12:20 |
|
matefkr 27 Sep 2013, 09:54
i dont think an open forum post is the best place to discuss this game, because it is obviously intended to be open. Also would there be some money out of it or something?
|
|||
27 Sep 2013, 09:54 |
|
HaHaAnonymous 27 Sep 2013, 14:39
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 19:50; edited 1 time in total |
|||
27 Sep 2013, 14:39 |
|
gens 14 Nov 2013, 12:48
tthsqe wrote: Before introducing more complex models (I agree - those diatoms do look great), we ought to maximize the CPU -> GPU triangle transfer rate, or store some of the models on the GPU. Do you know how to do this? I have a strong feeling all of the calls to glvertex3f are not the best way. well i only recently started learning opengl so dont hold me on the terminology (and some design details probably) modern opengl does not use glBegin() and end it's become a state machine and far more complex to set up speaking for opengl 3.3 data from buffers gets processed in vertex shaders then fragment shaders how you process data is up to you ofc shaders are written in GLSL, that is basically math wrapped in C first you need to make an opengl context, GLFW does that for you GLFW also gives you a window and input and all you need for graphics API is nice and can most all be done in callbacks, what is great then you set up opengl capabilities like DEPTH_TEST now comes the fun part most all these things need to be generated (created in the state machine) then bound (made current, that will be used in subsequent calls) then filled with some data it is actually a VERY flexible system, but this is how i did a simple picture viewer after creating a window, setting up callbacks and stuff generated and bound a vertex array that will hold buffers glGenVertexArrays(1, &vao); glBindVertexArray(vao); made buffers for vertices (all 4 of them) and UV coordinates, then filled them (this is just for vertices, its same for UV's and anything you want rly) glGenBuffers(1, vbo); glBindBuffer(GL_ARRAY_BUFFER, vbo[0]); glBufferData(GL_ARRAY_BUFFER, 4 * sizeof(struct vec3), flat, GL_STATIC_DRAW); glVertexAttribPointer((GLuint) 0, 3, GL_DOUBLE, GL_FALSE, sizeof(struct vec3), 0); glEnableVertexAttribArray(0); where "flat" is a pointer to my vertices last 2 calls put the buffer object in the first place of a vertex array afaik a buffer can be used directly easily, but like this i have 1 opengl call in rendering loop (shouldn't matter rly) then you have to load shader sources to opengl, create shaders in the state engine, compile them, link them into a program and make them current to be used in rendering also a program has to be crated too vertexsource = filetobuf("vertexshader.vert"); fragmentsource = filetobuf("fragmentshader.frag"); vertexshader = glCreateShader(GL_VERTEX_SHADER); fragmentshader = glCreateShader(GL_FRAGMENT_SHADER); glShaderSource(vertexshader, 1, (const GLchar **)&vertexsource, 0); glShaderSource(fragmentshader, 1, (const GLchar **)&fragmentsource, 0); glCompileShader(vertexshader); glCompileShader(fragmentshader); shaderprogram = glCreateProgram(); glAttachShader(shaderprogram, vertexshader); glAttachShader(shaderprogram, fragmentshader); glLinkProgram(shaderprogram); glUseProgram(shaderprogram); fun yet ? now also a sampler is needed to feed the pixel shader with.. well pixels it takes a couple parameters too glGenSamplers(1, &sampler); glSamplerParameteri(sampler, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glSamplerParameteri(sampler, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glSamplerParameterf(sampler, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16.0f); this is not much use in your game, but you can give it a texture instead of just a color glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, X, Y, 0, GL_RGB, GL_UNSIGNED_BYTE, picture); last call tells the shader to use the RGB texture pointed to by "picture" (actually it uploads the "picture" to "texture" and it is used in the frag shader) drawing itself is called simply with glDrawArrays(GL_QUADS, 0, 4); in my case its a QUAD made of 4 vertices this "draws" whatever is stored in buffers associated with the current (bound) array and ofc glfwSwapBuffers(window); to flip the buffer to screen shaders are more or less unrelated programs that process the data sent to them vertex shader sets the vertices in stone my vertex shader takes the vertices and UV's, makes vertices... vertices using gl_Position and passes UV's to the fragment shader directly my vertices are 3 floats, but opengl wants 4 so it gets a "1.0" as fourth also i dont apply no transformation matrix, since i do "2D" (there is no 2D in opengl afaik) #version 330 in vec3 inPosition; in vec2 vertexUV; out vec2 UV; void main() { gl_Position = vec4(inPosition, 1.0); UV = vertexUV; } note the IN to OUT design fragment shaders do more work giving pixes on screen their colors one pixel at a time #version 330 in vec2 UV; out vec3 outputColor; uniform sampler2D sampler; void main() { outputColor = texture( sampler, UV ).rgb ; } it uses the sampler to color a pixel based on the position of a triangle and its UV so ye its a lot more work to set up but it is powerful for complex scenes if you want il post my whole code just need to translate the comments to english funny, this makes me think there is a simpler way to just put a picture on the screen PS i assumed you know 3D math better then me so i left it out i could probably learn about it from you also a 2D picture viewer does not need it but there is great things about matrices and such in online tutorials i just didnt find any opengl 3.3 in C so i went on my own also great game inspires me to get back to opengl |
|||
14 Nov 2013, 12:48 |
|
tthsqe 15 Nov 2013, 20:34
I did use a bunch of immediate mode drawing. The problem that see with opengl is that I do not know exactly what the gpu does, nor do I know what the driver dies, so I am always reduced to a "top-down" approach of modifying others' code. Can we have a fragment shader sample from more than one texture? How would you set this up? Also, can we sample from a texture of floats (not bytes)?
edit: The shaders are making a bit more sense now. I think I found a list of attributes at http://www.opengl.org/sdk/docs/tutorials/ClockworkCoders/attributes.php so we just need to bind the texture to "channels" 0 through 7 and then we can access them with gl_MultiTexCoord0 through 7. |
|||
15 Nov 2013, 20:34 |
|
Goto page Previous 1, 2, 3, 4 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.