• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

ste3e

Members
  • Content count

    4
  • Joined

  • Last visited

Community Reputation

118 Neutral

About ste3e

  • Rank
    Newbie
  1. Problem sorted thanks to DMD folk. The &v in glBufferData(GL_ARRAY_BUFFER, v.length * GL_FLOAT.sizeof, &v, GL_STATIC_DRAW); should be &v[0]
  2. Maybe someone in the big wide world has Derelict2 running. [font=arial,helvetica,sans-serif]W[color=#000000][background=rgb(246, 246, 246)]hat I have [/background][/color][/font][color=#000000][font=arial, helvetica, sans-serif][background=rgb(246, 246, 246)]done is created the most parred back, hello world type program [/background][/font][/color][color=#000000][font=arial, helvetica, sans-serif][background=rgb(246, 246, 246)]that could run under the GL3 enforcement policies dictated by [/background][/font][/color][color=#000000][font=arial, helvetica, sans-serif][background=rgb(246, 246, 246)]Derelict2, running on DMD2 on XP. Fixed function pipeline is out. The vertex positions [/background][/font][/color][color=#000000][font=arial, helvetica, sans-serif][background=rgb(246, 246, 246)]fit within clip space so there is no need to be sending [/background][/font][/color][color=#000000][font=arial, helvetica, sans-serif][background=rgb(246, 246, 246)]projection, view or model matricies to the vertex shader, nor any [/background][/font][/color][color=#000000][font=arial, helvetica, sans-serif][background=rgb(246, 246, 246)]need therein to be altering the vertex positions; they simply get [/background][/font][/color][color=#000000][font=arial, helvetica, sans-serif][background=rgb(246, 246, 246)]set to gl_Position. The fragment shader assigns red to [/background][/font][/color][color=#000000][font=arial, helvetica, sans-serif][background=rgb(246, 246, 246)]gl_FragColor. I have read somewhere that vaos are required for [/background][/font][/color][color=#000000][font=arial, helvetica, sans-serif][background=rgb(246, 246, 246)]GL3 and that vbos hang pointlessly without the chaperone of a [/background][/font][/color][color=#000000][font=arial, helvetica, sans-serif][background=rgb(246, 246, 246)]vao, regardless, the code can draw either vao or vbo depending on [/background][/font][/color][color=#000000][font=arial, helvetica, sans-serif][background=rgb(246, 246, 246)]which draw function is not commented out in the loop. The problem [/background][/font][/color][color=#000000][font=arial, helvetica, sans-serif][background=rgb(246, 246, 246)]is, however, that neither function draws anything. Yet all the initializations are returning true; the SDL window pops up and gets cleared to black but no red triangle. I can't see where the problem lies. [/background][/font][/color] [CODE] import std.stdio; import std.string; import std.conv; import derelict.sdl2.sdl; import derelict.opengl3.gl3; pragma(lib, "DerelictUtil.lib"); pragma(lib, "DerelictSDL2.lib"); pragma(lib, "DerelictGL3.lib"); SDL_Window *win; SDL_GLContext context; int w=800, h=600; bool running=true; int shader = 0; uint vao=0, vbo=0; bool loadLibs(){ try{ DerelictSDL2.load(); }catch(Exception e){ writeln("Error loading SDL2 lib"); return false; } try{ DerelictGL3.load(); }catch(Exception e){ writeln("Error loading GL3 lib"); return false; } return true; } bool initSDL(){ if(SDL_Init(SDL_INIT_VIDEO) < 0){ writefln("Error initializing SDL"); return false; } SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); win=SDL_CreateWindow("3Doodle", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, w, h, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN); if(!win){ writefln("Error creating SDL window"); SDL_Quit(); return false; } context=SDL_GL_CreateContext(win); SDL_GL_SetSwapInterval(1); DerelictGL3.reload(); return true; } bool initGL(){ glClearColor(0.0, 0.0, 0.0, 1.0); glViewport(0, 0, w, h); return true; } bool initShaders(){ const string vshader=" #version 330 layout(location = 0) in vec4 pos; void main(void) { gl_Position = pos; } "; const string fshader=" #version 330 void main(void) { gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); } "; shader=glCreateProgram(); if(shader == 0){ writeln("Error: GL did not assigh main shader program id"); return false; } int vshad=glCreateShader(GL_VERTEX_SHADER); const char *vptr=toStringz(vshader); glShaderSource(vshad, 1, &vptr, null); glCompileShader(vshad); int status, len; glGetShaderiv(vshad, GL_COMPILE_STATUS, &status); if(status==GL_FALSE){ glGetShaderiv(vshad, GL_INFO_LOG_LENGTH, &len); char[] error=new char[len]; glGetShaderInfoLog(vshad, len, null, cast(char*)error); writeln(error); return false; } int fshad=glCreateShader(GL_FRAGMENT_SHADER); const char *fptr=toStringz(fshader); glShaderSource(fshad, 1, &fptr, null); glCompileShader(fshad); glGetShaderiv(vshad, GL_COMPILE_STATUS, &status); if(status==GL_FALSE){ glGetShaderiv(fshad, GL_INFO_LOG_LENGTH, &len); char[] error=new char[len]; glGetShaderInfoLog(fshad, len, null, cast(char*)error); writeln(error); return false; } glAttachShader(shader, vshad); glAttachShader(shader, fshad); glLinkProgram(shader); glGetShaderiv(shader, GL_LINK_STATUS, &status); if(status==GL_FALSE){ glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &len); char[] error=new char[len]; glGetShaderInfoLog(shader, len, null, cast(char*)error); writeln(error); return false; } return true; } bool initVAO(){ const float[] v = [ 0.75f, 0.75f, 0.0f, 1.0f, 0.75f, -0.75f, 0.0f, 1.0f, -0.75f, -0.75f, 0.0f, 1.0f]; glGenVertexArrays(1, &vao); if(vao<1){ writeln("Error: GL failed to assign vao id"); return false; } glBindVertexArray(vao); glGenBuffers(1, &vbo); if(vbo<1){ writeln("Error: GL failed to assign vbo id"); return false; } glBindBuffer(GL_ARRAY_BUFFER, vbo); glBufferData(GL_ARRAY_BUFFER, v.length * GL_FLOAT.sizeof, &v, GL_STATIC_DRAW); glEnableVertexAttribArray(0); glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, null); glBindBuffer(GL_ARRAY_BUFFER, 0); glBindVertexArray(0); return true; } void drawVao(){ glUseProgram(shader); glBindVertexArray(vao); glDrawArrays(GL_TRIANGLES, 0, 6); glBindVertexArray(0); glUseProgram(0); } void drawVbo(){ glUseProgram(shader); glBindBuffer(GL_ARRAY_BUFFER, vbo); glEnableVertexAttribArray(0); glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, null); glDrawArrays(GL_TRIANGLES, 0, 6); glBindBuffer(GL_ARRAY_BUFFER, 0); glUseProgram(0); } int main() { writeln("Load libs: ", loadLibs()); writeln("Init sdl: ", initSDL()); writeln("Init gl: ", initGL()); writeln("Init shaders: ", initShaders()); writeln("Init vao: ", initVAO()); while(running){ SDL_Event e; while(SDL_PollEvent(&e)){ switch(e.type){ case SDL_KEYDOWN: running=false; break; default: break; } } glClear(GL_COLOR_BUFFER_BIT); //drawVao(); drawVbo(); SDL_GL_SwapWindow(win); } SDL_GL_DeleteContext(context); SDL_DestroyWindow(win); SDL_Quit(); return 0; } [/CODE]
  3. It could be because you are using the SDL_Surface of the main screen rather than "surfPtr" used to hold the font. surfPtr will hold info about the size of the font and RGB or RGBA. By the way, if someone knows how to access this info from the IntPtr please tell. In C++ you would use surfPtr->w, and more importantly you can grab surfPtr->Amask to read weather the image is RGB or RGBA.
  4. Assuming the sea is rippling upon a flat horizontal plane, and all the normals responsible for the rippling come from a normal map, a texture matrix per vertex is not required. All that is needed is to rotate the normal stored in the map 90 degrees about the x axis so that it points up. Basically. Pull the normal from the map as a vec3 (openGL) float3(HLSL) called norm. Then rotate it into a new vec3 called n as below. [code]n.x=norm.x; n.y=norm.z; n.z=-norm.y; [/code] Think of it like this, the blue normal map produced in photoshop is said to be in tangent space. But obviously photoshop has no knowledge of the model the map will map, therefore it has no idea of the model's vertices or how those verticies will be UV mapped... basically, photoshop has no knowledge of the tangent space it is supposedly defining normals in. Tangent space normal maps are not mapped in tangent space, they are mapped in eye space. They assume (pretend) that all of the model's vertex normals point (0,0,1) up the z axis (openGL), and since they encode the z value in the blue channel of the map, the maps are mostly blue; the red and green channels encode x and y offsets from the z axis, ie, the perturbations. Given eye coordinates place the camera at (0,0,0) looking down the negative z axis (openGL), a normal in the map is like a south facing wall, the normals point out of the wall toward the camera. So what we need for the sea is to rotate the map 90 degrees so the z normals point up. As you can see from the code above, the y axis (standard base frame in eye space) now takes the z component, meaning, scale the y axis by the amount of z; the x axis remains unchanged because the normal is being rotated about this axis; if you rotate the axis frame 90 degrees about the x axis, the former y axis will now point down the negative z axis (openGL), so n.z is assigned the negative of the y value, which is to say, the z axis is scaled by the negative of the amount y.