Jump to content
  • Advertisement

Gyiove Sparkle

Member
  • Content Count

    47
  • Joined

  • Last visited

Community Reputation

196 Neutral

About Gyiove Sparkle

  • Rank
    Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hello everyone! Here's opengl NVIDIA tutorials: http://developer.download.nvidia.com/SDK/9.5/Samples/samples.html The question is that they aren't going to work on for example AMD or Intel even if they support the latest opengl version? Those nvidia stuff are just incredible and there's always a catch when stuff seems to good. If however those stuff there only works for nvidia then i guess my game engine is going to support only nvidia even tho i wish that my engine would work on ps4 and xbox ( not sure what kinda systems are they using )   I have heard that alot of computers uses nvidia and amd and intel would be cpu like mine is, i sure hope that nvidia and amd don't have too many differences and all the features i want to include to my engine can be done in both graphics cards. Thanks!
  2. Hello everyone! I was wondering, what method should i use when i wish to apply transparency on rendering animated object? Right now i have object and it's skeleton and updating vertex position, for making animation, in shader. So sorting triangles in cpu would take alot of power ( calculating triangles new pos based on skeleton animation then calculating distance relativity to camera and while doing this, sorting them as well, nearest to farthest ) I liked that 'Weighted average', it was really fast yet with 100% opacity ... things got weird. 'Depth peeling' is perhaps too slow I know that in weighted average way the sorting is not needed yet i dont know how depth peeling works. Anyways, so im waiting your opinion on what should i consider. Thanks!
  3. I really thought about not including such complex ( for me ) thing for my game engine but it appears it is needed. anyways...   That things what you linked seems a bit confusing. Is web engine really 60mb? hmm I'm looking for a libary what would deal with web stuff, only thing i have to do is call it with website and get image from it to render it. Anyone knows those simple kinds of libraries what do what i wish?
  4. I guess the one thing would be to show my page on my game launcher the other one would be in game like in counter strike ( the motd thingy ). I would mainly use that for example players register and login in game, interact with my page/mysql. This can be done without html thingy but i really wish that they would have access to forum and everywhere. Even on youtube.
  5. Hello everyone!   First of all, i have no idea how browsers like chrome, for example, works. What i need is to render a web page into quad but in that quad area, buttons and others stuff should work.   My engine supports only one window right now but perhaps that won't be the problem at all. Perhaps i could create a new window for html to that quad position what is invisible and only for keyboard/mouse hooking ( or what ever that html thing needs )   I'm wondering here. What should i do: create my own html engine ( and waste perhaps few months on that because i need to learn things again... ) or should i use what the others have created, if so then what would be best option and free for beginner kind like me? ( any good html lib things what will do what i wish? )   I really wish that the html engine or library will be simple. The simplest the better. ( less features, that what i meant i guess. ) Right now my mind seeks for something like:   1. create window for html engine 2. init html with that window 3. hide that window and place that above my game window in quad position. 4. ask the html engine to render everything to texture 5. fill that quad with texture the html engine returned   Also the app may run in full screen. Im not sure if i can have another window if my app's window is in full screen mode. Never worked with basics of window programming ( well rarely )   Thanks!    
  6. Here's the code:   struct vertexData{ float position[3]; float normal[3]; float tangent[3]; float color[3]; float uv[2]; }; struct vertexID{ unsigned int id[3]; }; vertexData quad[4]; quad[3].position[0] = -1.0f; quad[3].position[1] =  1.0f; quad[3].position[2] =  0.0f; quad[3].normal[0] = -1.0f; quad[3].normal[1] = -0.0f; quad[3].normal[2] = 0.0f; quad[3].uv[0] = 0.0f; quad[3].uv[1] = 1.0f; quad[2].position[0] =  1.0f; quad[2].position[1] =  1.0f; quad[2].position[2] =  0.0f; quad[2].normal[0] = -1.0f; quad[2].normal[1] = -0.0f; quad[2].normal[2] = 0.0f; quad[2].uv[0] = 1.0f; quad[2].uv[1] = 1.0f; quad[1].position[0] =  1.0f; quad[1].position[1] = -1.0f; quad[1].position[2] =  0.0f; quad[1].normal[0] = 1.0f; quad[1].normal[1] = 0.0f; quad[1].normal[2] = 0.0f; quad[1].uv[0] = 1.0f; quad[1].uv[1] = 0.0f; quad[0].position[0] = -1.0f; quad[0].position[1] = -1.0f; quad[0].position[2] =  0.0f; quad[0].normal[0] = -1.0f; quad[0].normal[1] = -0.0f; quad[0].normal[2] = 0.0f; quad[0].uv[0] = 0.0f; quad[0].uv[1] = 1.0f; glGenBuffers(1,&vbo); glBindBuffer(GL_ARRAY_BUFFER,vbo); glBufferData(GL_ARRAY_BUFFER,4*sizeof(vertexData), &quad,GL_STATIC_DRAW); vertexID id[2]; id[0].id[0] = 0; id[0].id[1] = 1; id[0].id[2] = 2; id[1].id[0] = 0; id[1].id[1] = 2; id[1].id[2] = 3; glGenBuffers(1,&vbo2); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,vbo2); glBufferData(GL_ELEMENT_ARRAY_BUFFER,6*sizeof(unsigned int),&id,GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER,0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0);       What exacly is that variable i created called id what holds those index numbers? I don't quite get it. I do understand one thing that its for saving memory, for ... hmm building mesh? Basically sorting out the vertices what are in same position?   I really dont like these things since im holding normal, color etc... data there and perhaps something would go wrong. Perhaps normals&smoothing would be wrong but i guess thats up to mesh compiler to care for.   but one question and the reply for it could change my view point of them.   for example if im having complex transparent mesh what triangles i need to sort by nearest to far basically i can change the triangle draw order in that id variable?   if thats not possible then i have get the idea of that GL_ELEMENT_ARRAY_BUFFER pretty wrong way.
  7. I'm pretty sure you want to transform them by a matrix unless you're really keen on figuring out what your pixel-perfect coordinates look like in NDC space by hand. You'll want an orthographic projection matrix sized to the surface's pixel dimensions (window width and height).   Thanks, added this: grpc::projectionMatrix = glm::ortho(0.0f, (float)size[0],(float)size[1], 0.0f, 0.1f, 100.0f); And now its working like i wish.
  8. Hello Everyone!   I have code here: namespace grpc { classwindow *window; fw *render; glm::mat4 modelMatrix; glm::mat4 viewMatrix; glm::mat4 projectionMatrix; glm::mat4 modelViewMatrix; glm::mat4 modelViewProjectionMatrix; glm::mat3 normalMatrix; shader simple; } struct vertexData{ float position[3]; float normal[3]; float tangent[3]; float color[3]; float uv[2]; }; struct vertexID{ unsigned int id[3]; }; unsigned int vbo, vbo2; void graphic_frame() { if( grpc::window->winactive ) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0,0,0,0); glEnable(GL_DEPTH_TEST); double size[2]; size[0] = (double)grpc::window->size[0]; size[1] = (double)grpc::window->size[1]; grpc::projectionMatrix = glm::perspective(50.0, size[0]/size[1], 1.0, 9999.0); grpc::modelMatrix = glm::mat4(1.0); grpc::viewMatrix = glm::mat4(1.0); grpc::viewMatrix *= glm::rotate(0.0f, glm::vec3(1.0, 0.0, 0.0)); grpc::viewMatrix *= glm::rotate(0.0f, glm::vec3(0.0, 1.0, 0.0)); grpc::viewMatrix *= glm::rotate(0.0f, glm::vec3(0.0, 0.0, 1.0)); grpc::viewMatrix *= glm::translate(glm::vec3(0.0, 0.0, -90.0)); grpc::modelMatrix *= glm::scale(glm::vec3(1.0,1.0,1.0)); grpc::modelViewMatrix=grpc::viewMatrix*grpc::modelMatrix; grpc::modelViewProjectionMatrix=grpc::projectionMatrix*grpc::viewMatrix*grpc::modelMatrix; grpc::normalMatrix=glm::mat3(grpc::modelViewProjectionMatrix); grpc::simple.use(); glUniformMatrix4fv(glGetUniformLocation(grpc::simple.index,"modelMatrix"),1,GL_FALSE, &grpc::modelMatrix[0][0]); glUniformMatrix4fv(glGetUniformLocation(grpc::simple.index,"viewMatrix"),1,GL_FALSE, &grpc::viewMatrix[0][0]); glUniformMatrix4fv(glGetUniformLocation(grpc::simple.index,"projectionMatrix"),1,GL_FALSE, &grpc::projectionMatrix[0][0]); glUniformMatrix4fv(glGetUniformLocation(grpc::simple.index,"modelViewMatrix"),1,GL_FALSE, &grpc::modelViewMatrix[0][0]); glUniformMatrix4fv(glGetUniformLocation(grpc::simple.index,"modelViewProjectionMatrix"),1,GL_FALSE, &grpc::modelViewProjectionMatrix[0][0]); glUniformMatrix3fv(glGetUniformLocation(grpc::simple.index,"normalMatrix"),1,GL_FALSE, &grpc::normalMatrix[0][0]); int vertex=glGetAttribLocation(grpc::simple.index,"vertex"); //0 int normal=glGetAttribLocation(grpc::simple.index,"normal"); //1 int tangent=glGetAttribLocation(grpc::simple.index,"tangent"); //2 int color=glGetAttribLocation(grpc::simple.index,"color"); //3 int UV=glGetAttribLocation(grpc::simple.index,"UV"); //4 glBindBuffer(GL_ARRAY_BUFFER,vbo); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,vbo2); glEnableVertexAttribArray(vertex); glVertexAttribPointer(vertex,3,GL_FLOAT,GL_FALSE,sizeof(vertexData),0); glEnableVertexAttribArray(normal); glVertexAttribPointer(normal,3,GL_FLOAT,GL_FALSE,sizeof(vertexData),(void*)(3*sizeof(float))); glEnableVertexAttribArray(tangent); glVertexAttribPointer(tangent,3,GL_FLOAT,GL_FALSE,sizeof(vertexData),(void*)(6*sizeof(float))); glEnableVertexAttribArray(color); glVertexAttribPointer(color,3,GL_FLOAT,GL_FALSE,sizeof(vertexData),(void*)(9*sizeof(float))); glEnableVertexAttribArray(UV); glVertexAttribPointer(UV,2,GL_FLOAT,GL_FALSE,sizeof(vertexData),(void*)(12*sizeof(float))); glDrawElements(GL_TRIANGLES, 6,GL_UNSIGNED_INT,0); glDisableVertexAttribArray(vertex); glDisableVertexAttribArray(normal); glDisableVertexAttribArray(tangent); glDisableVertexAttribArray(color); glDisableVertexAttribArray(UV); glBindBuffer(GL_ARRAY_BUFFER,0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0); call_forward(grpc::render, tfunc::void_void); // that is doing nothing right now // after this func ends then SwapBuffers(win->render_device) will be called } } void graphic_end() { grpc::simple.destroy(); } void img_init(); void graphic_init() { register_forward( "frame", func_add(graphic_frame) ); glClearColor(0,0,0,0); glEnable(GL_DEPTH_TEST); grpc::modelMatrix = glm::mat4(1.0); grpc::viewMatrix = glm::mat4(1.0); grpc::projectionMatrix = glm::mat4(1.0); grpc::modelViewMatrix = glm::mat4(1.0); grpc::modelViewProjectionMatrix = glm::mat4(1.0); grpc::normalMatrix = glm::mat3(1.0); grpc::window = get_classwindow(); create_forward("render", "void()"); grpc::render = get_forward("render"); grpc::simple.shader_load( "test", "hv;>y64:_72h6/8h4 3j<hxd-*y83'Simple,Test.SpShader' !*" ); glBindFramebuffer(GL_FRAMEBUFFER,0); img_init(); vertexData quad[4]; quad[3].position[0] = -1.0f; quad[3].position[1] = 1.0f; quad[3].position[2] = 0.0f; quad[3].normal[0] = -1.0f; quad[3].normal[1] = -0.0f; quad[3].normal[2] = 0.0f; quad[3].uv[0] = 0.0f; quad[3].uv[1] = 1.0f; quad[2].position[0] = 1.0f; quad[2].position[1] = 1.0f; quad[2].position[2] = 0.0f; quad[2].normal[0] = -1.0f; quad[2].normal[1] = -0.0f; quad[2].normal[2] = 0.0f; quad[2].uv[0] = 1.0f; quad[2].uv[1] = 1.0f; quad[1].position[0] = 1.0f; quad[1].position[1] = -1.0f; quad[1].position[2] = 0.0f; quad[1].normal[0] = 1.0f; quad[1].normal[1] = 0.0f; quad[1].normal[2] = 0.0f; quad[1].uv[0] = 1.0f; quad[1].uv[1] = 0.0f; quad[0].position[0] = -1.0f; quad[0].position[1] = -1.0f; quad[0].position[2] = 0.0f; quad[0].normal[0] = -1.0f; quad[0].normal[1] = -0.0f; quad[0].normal[2] = 0.0f; quad[0].uv[0] = 0.0f; quad[0].uv[1] = 1.0f; glGenBuffers(1,&vbo); glBindBuffer(GL_ARRAY_BUFFER,vbo); glBufferData(GL_ARRAY_BUFFER,4*sizeof(vertexData), &quad,GL_STATIC_DRAW); vertexID id[2]; id[0].id[0] = 0; id[0].id[1] = 1; id[0].id[2] = 2; id[1].id[0] = 0; id[1].id[1] = 2; id[1].id[2] = 3; glGenBuffers(1,&vbo2); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,vbo2); glBufferData(GL_ELEMENT_ARRAY_BUFFER,6*sizeof(unsigned int),&id,GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER,0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0); } Really hard to explain it but i want to make a gui system inside the opengl and i wish that everything would be pixel accurate. If i wish that my quad would appear in screen for example 100 pixels tall and 50 pixels wide then so it would be it. I guess my idea is just to fill screen with textures so i could make gui like thing... Im really sorry about bad explanation, i hope you'll understand me. Thanks!    
  9. Gyiove Sparkle

    Rendering quad but something is missing

    oh yea, thank you. its working now grpc::projectionMatrix = glm::perspective(50.0, size[0]/size[1], 1.0, 9999.0); grpc::modelMatrix = glm::mat4(1.0); grpc::viewMatrix = glm::mat4(1.0); grpc::viewMatrix *= glm::rotate(0.0f, glm::vec3(1.0, 0.0, 0.0)); grpc::viewMatrix *= glm::rotate(0.0f, glm::vec3(0.0, 1.0, 0.0)); grpc::viewMatrix *= glm::rotate(0.0f, glm::vec3(0.0, 0.0, 1.0)); grpc::viewMatrix *= glm::translate(glm::vec3(0.0, 0.0, -300.0)); grpc::modelViewMatrix=grpc::viewMatrix*grpc::modelMatrix; grpc::modelViewProjectionMatrix=grpc::projectionMatrix*grpc::viewMatrix*grpc::modelMatrix; grpc::normalMatrix=glm::mat3(grpc::modelViewProjectionMatrix);
  10. Gyiove Sparkle

    Rendering quad but something is missing

    fixed that now the problem is: grpc::viewMatrix *= glm::translate no matter what values i bring there the quad is still on screen ( quad covers full screen, always )
  11. Gyiove Sparkle

    Rendering quad but something is missing

    vertexData quad[6]; quad[5].position[0] = 0.0f; quad[5].position[1] = 0.0f; quad[5].position[2] = -1.0f; quad[5].normal[0] = -1.0f; quad[5].normal[1] = -0.0f; quad[5].normal[2] = 0.0f; quad[5].uv[0] = 1.0f; quad[5].uv[1] = 0.0f; quad[4].position[0] = 0.0f; quad[4].position[1] = 1.0f; quad[4].position[2] = -1.0f; quad[4].normal[0] = -1.0f; quad[4].normal[1] = -0.0f; quad[4].normal[2] = 0.0f; quad[4].uv[0] = 0.0f; quad[4].uv[1] = 0.0f; quad[3].position[0] = -1.0f; quad[3].position[1] = 1.0f; quad[3].position[2] = 0.0f; quad[3].normal[0] = -1.0f; quad[3].normal[1] = -0.0f; quad[3].normal[2] = 0.0f; quad[3].uv[0] = 0.0f; quad[3].uv[1] = 1.0f; quad[2].position[0] = 1.0f; quad[2].position[1] = 1.0f; quad[2].position[2] = 0.0f; quad[2].normal[0] = -1.0f; quad[2].normal[1] = -0.0f; quad[2].normal[2] = 0.0f; quad[2].uv[0] = 1.0f; quad[2].uv[1] = 1.0f; quad[1].position[0] = 1.0f; quad[1].position[1] = -1.0f; quad[1].position[2] = 0.0f; quad[1].normal[0] = 1.0f; quad[1].normal[1] = 0.0f; quad[1].normal[2] = 0.0f; quad[1].uv[0] = 1.0f; quad[1].uv[1] = 0.0f; quad[0].position[0] = -1.0f; quad[0].position[1] = -1.0f; quad[0].position[2] = 0.0f; quad[0].normal[0] = -1.0f; quad[0].normal[1] = -0.0f; quad[0].normal[2] = 0.0f; quad[0].uv[0] = 0.0f; quad[0].uv[1] = 1.0f; // and grpc::viewMatrix *= glm::translate(glm::vec3(0.0, 0.0, -10.0)); now that quad is everywhere, no matter what angle or pos, quad is in screen, thats weird. Also, i wanted that the quad is made of 2 triangles. ( in case that was misunderstood )
  12. Hello everyone!   This is first time im rendering things with vbo and manually controlling matrices. Here's the code: namespace grpc { classwindow *window; fw *render; glm::mat4 modelMatrix; glm::mat4 viewMatrix; glm::mat4 projectionMatrix; glm::mat4 modelViewMatrix; glm::mat4 modelViewProjectionMatrix; glm::mat3 normalMatrix; shader simple; } struct vertexData{ float position[3]; float normal[3]; float tangent[3]; float color[3]; float uv[2]; }; struct vertexID{ unsigned int id[3]; }; unsigned int vbo, vbo2; // vbo2 is vectex indexes ( is that how they call it? ) void graphic_frame() { if( grpc::window->winactive ) // winactive is 0 when window is minimized { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(0,0,0,0); // changing values here will affect the screen // so everything should just draw fine on screen glEnable(GL_DEPTH_TEST); double size[2]; size[0] = (double)grpc::window->size[0]; size[1] = (double)grpc::window->size[1]; grpc::projectionMatrix = glm::perspective(50.0, size[0]/size[1], 1.0, 9999.0); grpc::modelMatrix = glm::mat4(1.0); grpc::viewMatrix = glm::mat4(1.0); // tried every angle/pos still no quad on screen grpc::viewMatrix *= glm::rotate(0.0f, glm::vec3(1.0, 0.0, 0.0)); grpc::viewMatrix *= glm::rotate(0.0f, glm::vec3(0.0, 1.0, 0.0)); grpc::viewMatrix *= glm::rotate(0.0f, glm::vec3(0.0, 0.0, 1.0)); grpc::viewMatrix *= glm::translate(glm::vec3(10.0, 0.0, 0.0)); grpc::simple.use(); // cout << glGetUniformLocation(grpc::simple.index,"modelMatrix") is saying that it returns -1 // it should not do it am i right? glUniformMatrix4fv(glGetUniformLocation(grpc::simple.index,"modelMatrix"), 1,GL_FALSE, &grpc::modelMatrix[0][0]); glUniformMatrix4fv(glGetUniformLocation(grpc::simple.index,"viewMatrix"), 1,GL_FALSE, &grpc::viewMatrix[0][0]); glUniformMatrix4fv(glGetUniformLocation(grpc::simple.index,"projectionMatrix"), 1,GL_FALSE, &grpc::projectionMatrix[0][0]); glUniformMatrix4fv(glGetUniformLocation(grpc::simple.index,"modelViewMatrix"), 1,GL_FALSE, &grpc::modelViewMatrix[0][0]); glUniformMatrix4fv(glGetUniformLocation(grpc::simple.index,"modelViewProjectionMatrix"), 1,GL_FALSE, &grpc::modelViewProjectionMatrix[0][0]); glUniformMatrix3fv(glGetUniformLocation(grpc::simple.index,"normalMatrix"), 1,GL_FALSE, &grpc::normalMatrix[0][0]); int vertex=glGetAttribLocation(grpc::simple.index,"vertex"); // vertex variable holds 0 what should be fine int normal=glGetAttribLocation(grpc::simple.index,"normal"); // normal variable holds -1 as well as tangent, color and UV ... weird int tangent=glGetAttribLocation(grpc::simple.index,"tangent"); int color=glGetAttribLocation(grpc::simple.index,"color"); int UV=glGetAttribLocation(grpc::simple.index,"UV"); glBindBuffer(GL_ARRAY_BUFFER,vbo); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,vbo2); // vbo holds 1 and vbo2 holds 2 glEnableVertexAttribArray(vertex); glVertexAttribPointer(vertex,3,GL_FLOAT,GL_FALSE,sizeof(vertexData),0); glEnableVertexAttribArray(normal); glVertexAttribPointer(normal,3,GL_FLOAT,GL_FALSE,sizeof(vertexData),(void*)(3*sizeof(float))); glEnableVertexAttribArray(tangent); glVertexAttribPointer(tangent,3,GL_FLOAT,GL_FALSE,sizeof(vertexData),(void*)(6*sizeof(float))); glEnableVertexAttribArray(color); glVertexAttribPointer(color,3,GL_FLOAT,GL_FALSE,sizeof(vertexData),(void*)(9*sizeof(float))); glEnableVertexAttribArray(UV); glVertexAttribPointer(UV,2,GL_FLOAT,GL_FALSE,sizeof(vertexData),(void*)(12*sizeof(float))); glDrawElements(GL_TRIANGLES, 6,GL_UNSIGNED_INT,0); glDisableVertexAttribArray(vertex); glDisableVertexAttribArray(normal); glDisableVertexAttribArray(tangent); glDisableVertexAttribArray(color); glDisableVertexAttribArray(UV); glBindBuffer(GL_ARRAY_BUFFER,0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0); call_forward(grpc::render, tfunc::void_void); // that is doing nothing right now // after this func ends then SwapBuffers(win->render_device) will be called } } void img_init(); void graphic_init() { register_forward( "frame", func_add(graphic_frame) ); glClearColor(0,0,0,0); glEnable(GL_DEPTH_TEST); grpc::modelMatrix = glm::mat4(1.0); grpc::viewMatrix = glm::mat4(1.0); grpc::projectionMatrix = glm::mat4(1.0); grpc::modelViewMatrix = glm::mat4(1.0); grpc::modelViewProjectionMatrix = glm::mat4(1.0); grpc::normalMatrix = glm::mat3(1.0); grpc::window = get_classwindow(); create_forward("render", "void()"); grpc::render = get_forward("render"); // this function should load shaders correctly, i debugged everything before i started working on this. // it loads test.vs and test.frag and compiles it and fills the simple.index with index = glCreateProgram(); grpc::simple.shader_load( "test", "shaderdetails..." ); glBindFramebuffer(GL_FRAMEBUFFER,0); img_init(); vertexData quad[6]; quad[5].position[0] = 0.0f; quad[5].position[1] = 0.0f; quad[5].position[2] = -1.0f; quad[5].normal[0] = -1.0f; quad[5].normal[1] = -0.0f; quad[5].normal[2] = 0.0f; quad[5].uv[0] = 1.0f; quad[5].uv[1] = 0.0f; quad[4].position[0] = 0.0f; quad[4].position[1] = 1.0f; quad[4].position[2] = -1.0f; quad[4].normal[0] = -1.0f; quad[4].normal[1] = -0.0f; quad[4].normal[2] = 0.0f; quad[4].uv[0] = 0.0f; quad[4].uv[1] = 0.0f; quad[3].position[0] = 0.0f; quad[3].position[1] = 1.0f; quad[3].position[2] = 0.0f; quad[3].normal[0] = -1.0f; quad[3].normal[1] = -0.0f; quad[3].normal[2] = 0.0f; quad[3].uv[0] = 0.0f; quad[3].uv[1] = 1.0f; quad[2].position[0] = 0.0f; quad[2].position[1] = 0.0f; quad[2].position[2] = 0.0f; quad[2].normal[0] = -1.0f; quad[2].normal[1] = -0.0f; quad[2].normal[2] = 0.0f; quad[2].uv[0] = 1.0f; quad[2].uv[1] = 1.0f; quad[1].position[0] = 0.0f; quad[1].position[1] = 0.0f; quad[1].position[2] = -1.0f; quad[1].normal[0] = 1.0f; quad[1].normal[1] = 0.0f; quad[1].normal[2] = 0.0f; quad[1].uv[0] = 1.0f; quad[1].uv[1] = 0.0f; quad[0].position[0] = 0.0f; quad[0].position[1] = 1.0f; quad[0].position[2] = 0.0f; quad[0].normal[0] = -1.0f; quad[0].normal[1] = -0.0f; quad[0].normal[2] = 0.0f; quad[0].uv[0] = 0.0f; quad[0].uv[1] = 1.0f; glGenBuffers(1,&vbo); glBindBuffer(GL_ARRAY_BUFFER,vbo); glBufferData(GL_ARRAY_BUFFER,6*sizeof(vertexData), &quad,GL_STATIC_DRAW); vertexID id[2]; id[0].id[0] = 0; id[0].id[1] = 1; id[0].id[2] = 2; id[1].id[0] = 0; id[1].id[1] = 2; id[1].id[2] = 3; glGenBuffers(1,&vbo2); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,vbo2); glBufferData(GL_ELEMENT_ARRAY_BUFFER,6*sizeof(unsigned int),&id,GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER,0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0); } shaders // frag void main() { gl_FragColor=vec4(1.0,0.0,0.0,1.0); } // vertex attribute vec3 vertex; attribute vec3 normal; attribute vec3 tangent; attribute vec3 color; attribute vec2 UV; varying vec3 outNormal; varying vec3 outTangent; varying vec3 outColor; varying vec2 outUV; varying vec3 position; uniform mat4 modelMatrix; uniform mat4 viewMatrix; uniform mat4 projectionMatrix; uniform mat4 modelViewMatrix; uniform mat4 modelViewProjectionMatrix; uniform mat3 normalMatrix; void main() { gl_Position=modelViewProjectionMatrix*vec4(vertex,1.0); position=vec3(modelViewMatrix*vec4(vertex,1.0)); outNormal=normalMatrix*normal; outTangent=normalMatrix*outTangent; outColor=color; outUV=UV; } The problem is that only thing i see is black screen, why?
  13. Thats relief since i already coded alot of systems that way, that the shader code don't change in memory. But what would i miss when i choose to go the way you recommended?
  14. Hello everyone!   1. Does that case exist when you need to edit shader ( frag, vertex ) code each frame or perhaps each 30-50 frames or is everything that dynamic that i could just wrote down certain shaders and they don't need to be edited in program ( and recompile ).   2. I know that in vertex shader there are frame buffer object what are really dynamic, you can have unlimited stuff in it but the problem is that you can't access to fbo in fragment am i right? So for example how could i pass x amount of data to fragment? I know that one thing what i could do is have a image what is not a image but a data that i would need there but i think thats bad way to do that because image slots are already limited. It will get really complicated.   this is why i asked 1. because i could just hardcode or rewrite those varying objects so i could have like for example x amount of lights but when light count changes i have to change the shader code and recompile it. ( really bad at explaining things, im sorry )   Thanks!
  15. Okay, thank you so much for clearing things up for me.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!