blubberbert

Members
  • Content count

    90
  • Joined

  • Last visited

Community Reputation

236 Neutral

About blubberbert

  • Rank
    Member
  1. as for tutorials, id recommend www.open.gl, its one of the best tutorials out there for OpenGL 3.x/4 imho   if youre going for 3.x/4, all the "GLU, GLUT" thingies youll need are   GLEW (GL extension wrangler library) - will give you access to all the OpenGL functions you need   and a library that creates the context for you (i.e. opens a window for you to draw in, handles input for you, etc.) GLFW and SDL would be my recommendations, SDL offers a little more extra functionality like networking/sound/image loading, GLFW is just context creation and input handling, youll have to load textures yourself or use another library for that (like SOIL)
  2. why not use glFramebufferTexture1D/2D/3D instead?
  3. my question is simple (i think)   consider this class Base { ... };   class A { public:   template <class T = std::enable_if<std::is_base_of<Base, T>::value>::type>   void Test1() { }   template <class T, T = std::enable_if<std::is_base_of<Base, T>::value>::type>   void Test2() { } };   a.Test1<int>(); //compiles a.Test2<int>(); //doesn't compile why does the Test1 call compile when it shouldnt, because int isnt derived from Base ive already found the correct syntax (wich seems to be the one of Test2) but i dont get why the enable_if doesnt create an error in Test1   by the way im using Visual Studio
  4. expected template ambiguity

    wow that was fast. article explains everything... holy **** thats complicated :D thanks for helping
  5. i expected the following code to raise an error because the compiler doesnt know wich func to use, the template or non-template one #include <string> #include <iostream> #include <cstdlib>   template<typename T> T func(T arg) { return arg; }   std::string func(std::string arg) { return "surprise!"; }     int main(int argc, char **argv) {     std::cout << func(std::string("no surprise please!") );     system("PAUSE");     return 0; } however the code always calls the non-template function.  1.Why is that? 2.If that kind of behaviour is part of the standard (calling non-template functions rather than fitting templates), whats the point of the special syntax for template specialization? i.e. template<> std::string func<std::string>(std::string arg) { return "surprise!"; }
  6. well having written some hacks for multiplayer games like QuakeLive or Call of Duty 4, i think the best way is to check critical functions in the graphics API that could be hooked and used for hacks. obviously you should also check the functions in your own code. punkbuster seems to only scan the first bytes of DrawIndexedPrimitive for example and you can easily circumvent that by doing a hook mid-function, so thats a mistake you dont want to make ;) you might also set some breakpoints on read access to critical structures (for example player positions) however i dont know if this would be possible in real time. another way is to check all 3rd party modules for signaturs of known hacks (i think most anticheats rely a lot on this).   if you like a challenge, you can also try to write some kind of intelligent cheat detection code that detects if a piece of code accesses data it shouldnt access (your games internal data)   those are just ideas though, ive never done anything like this  
  7. im currently working on a deferred renderer with SSGI and came across a problem: iam doing 4 passes to render the final image, but i want to reuse one Gbuffer wich is written in the 1st and read in the 2nd pass to be written in the 3rd and read in the 4th pass that rendertarget stores the indirect illumination color and the ao. however since my good old ATI 4650M isnt that fast, i compute the SSGI on a 4 times smaller resolution. so after the third pass, some of the rendertarget holds the new SSGI data, while some part still stores the data written in the 1st pass wich is not needed anymore. it would look like this: OOOO OOOO NNOO NNOO where O is old data and N new data the problem is that now when i read the SSGI data (N) in the 4th pass, i get some artifacts when i read data from the right or top border, because im actually reading 'O' data, wich is not what i want... the shader for the fourth pass looks like this: [code] uniform sampler2D ssdiMap; uniform sampler2D ssgiMap; varying vec2 texCoord0; varying vec2 texCoord1; vec4 getGI(in vec2 coord) { coord = clamp(coord, 0.0, 0.25); return texture2D(ssgiMap, coord); } void main() { float rad = 0.0005; vec2 offsets[8] = vec2[8](vec2(rad,rad),vec2(-rad,rad),vec2(-rad,-rad),vec2(rad,-rad), vec2(0.0,rad),vec2(0.0,-rad),vec2(rad,0.0),vec2(-rad,0.0)); vec4 gi = vec4(0.0); for(int i = 0; i < 8; i++) gi += getGI(texCoord1 + offsets[i]); for(int i = 0; i < 8; i++) gi += getGI(texCoord1 + offsets[i] * 2.0); gi /= 16.0; vec4 di = texture2D(ssdiMap, texCoord0); vec3 final = (di.xyz*gi.w) + gi.xyz; //gi.xyz is GI color, gi.w is AO gl_FragColor = vec4(final, 1.0); } [/code]
  8. OpenGL experminental shader extensions

    i once used geometry shaders on 2.1 drivers through glewExperimental
  9. OpenGL experminental shader extensions

    [quote][color="#1C2837"][size="2"]You need to have OpenGL 4.2 or better if you want to use this extension.[/quote][/size][/color] [color="#1C2837"][size="2"]are you sure? because why would AMD/ATI add the functions to the driver if it can never be supported? the ATI 4650 is a DX10/GL3.3 card so itll never have GL4.2 because its lacking the hardware[/size][/color] [color="#1C2837"] [/color] [color="#1C2837"][size="2"]EDIT: you could be right tho...[/size][/color] [color="#1C2837"][size="2"]GL_MAX_IMAGE_UNITS_EXT is 0 =(([/size][/color]
  10. i wanna try the GL_EXT_shader_image_load_store extension, but my graphics card only supports OpenGL 3.3 (Ati mobility 4650) the extension is not in the extension string and glew doesnt load it normally but when i set glewExperimental to true, it says GL_EXT_shader_image_load_store is supported. the functions also do have a valid entry point. unfortunately that wasnt true for the shader since [code] #extension GL_EXT_shader_image_load_store : enable [/code] didnt compile [img]http://public.gamedev.net/public/style_emoticons/default/sad.gif[/img] long story short, does anyone know how to enable experimental driver functionality for shaders?
  11. recently i asked on the forums on how to render to 3D textures i ended up with binding each texture layer in each frame and then rendering to it wich is a solution, but quite slow i now tried to go with geometry shaders and got the rendering working, however only half of the texture is filled gDebugger shows that layer 63 is black, while layer 64 is filled normally (on a 128*128*128 texture) here is my geometry shader [code] layout (points) in; layout (triangle_strip, max_vertices = 512) out; void main() { float f = 2.0 / 128.0; for(int i = 0; i < 128; i++) { float lz = (f * float(i)) - 2.0; gl_Position = vec4(-1.0,-1.0,lz,1.0); gl_Layer = i; EmitVertex(); gl_Position = vec4( 1.0,-1.0,lz,1.0); gl_Layer = i; EmitVertex(); gl_Position = vec4(-1.0, 1.0,lz,1.0); gl_Layer = i; EmitVertex(); gl_Position = vec4( 1.0, 1.0,lz,1.0); gl_Layer = i; EmitVertex(); EndPrimitive(); } } [/code] the fragment shader that is used to fill each of the layers [code] void main() { vec3 coord = gl_FragCoord.xyz; //coordinates reach from 0.5 to 128.5 coord.xy -= 0.5; coord.xy /= 128.0; coord.xy -= 0.5; gl_FragData[0] = vec4(coord,1.0); } [/code] and the code that fills the volume [code] void fillTarget() { glBindFramebuffer(GL_FRAMEBUFFER, framebuffer); glPushAttrib(GL_VIEWPORT_BIT); glViewport(0,0,volRes,volRes); glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, volumetex->getId(), 0); glClearColor(0.0f,0.0f,0.0f,1.0f); //making this red shows that the layers still stay empty glClear(GL_COLOR_BUFFER_BIT); program->bind(); glBegin(GL_POINTS); glVertex3f(0.0f,0.0f,0.0f); glEnd(); Program::unbind(); glPopAttrib(); glBindFramebuffer(GL_FRAMEBUFFER, 0); } [/code]
  12. render to 3D texture

    ok so after many sleepless nights (and no replies here [img]http://public.gamedev.net/public/style_emoticons/default/unsure.gif[/img]) i finally found out how to do it [code] void buildFramebuffer() { renderTarget = new Texture3D(GL_RGB, GL_RGB8, GL_UNSIGNED_BYTE, GL_LINEAR, GL_CLAMP_TO_EDGE, 100,100,100,NULL); glGenFramebuffers(1, &framebuffer); glBindFramebuffer(GL_FRAMEBUFFER, framebuffer); glFramebufferTexture3D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_3D, renderTarget->getId(), 0, 0); GLenum buffers[] = { GL_COLOR_ATTACHMENT0 }; glDrawBuffers(1, buffers); glReadBuffer(GL_NONE); GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); glBindFramebuffer(GL_FRAMEBUFFER, 0); printf("Framebuffer status: %s\n", status == GL_FRAMEBUFFER_COMPLETE?"OK":"ERROR"); } void fillTarget() { glBindFramebuffer(GL_FRAMEBUFFER, framebuffer); glPushAttrib(GL_VIEWPORT_BIT); glViewport(0,0,100,100); for(int i = 0; i < 100; i++) { glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, renderTarget->getId(), 0, i); glClearColor(1.0f,(1.0f/100.0f)*((float)i),0.0f,1.0f); glClear(GL_COLOR_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0.0f,0.0f,-5.0f); glColor3f(0.0f, 1.0f, 1.0f); glBegin(GL_TRIANGLES); glVertex3f(-1.0f,0.0f,0.0f); glVertex3f( 0.0f,1.0f,0.0f); glVertex3f( 1.0f,0.0f,0.0f); glEnd(); } glPopAttrib(); glBindFramebuffer(GL_FRAMEBUFFER, 0); } void draw() { fillTarget(); glClearColor(0.0f,0.0f,1.0f,1.0f); glClear(GL_COLOR_BUFFER_BIT); glEnable(GL_TEXTURE_3D); renderTarget->bind(); glColor3f(1.0f,1.0f,1.0f); glBegin(GL_QUADS); glTexCoord3f(0.0f,0.0f,1.0f); glVertex3f(-1.0f, 1.0f,0.0f); glTexCoord3f(0.0f,1.0f,1.0f); glVertex3f(-1.0f,-1.0f,0.0f); glTexCoord3f(1.0f,1.0f,1.0f); glVertex3f( 1.0f,-1.0f,0.0f); glTexCoord3f(1.0f,0.0f,1.0f); glVertex3f( 1.0f, 1.0f,0.0f); glEnd(); Texture3D::unbind(); SDL_GL_SwapBuffers(); } [/code] just posting this here for the people facing similar problems this code should render a blue background with a yellow quad in the center with a turquoise triangle in it (the quad is yellow because the texcoords Z is 1 if it were 0 the quad would be red) however if someone finds anything wrong with my code feel free to point any mistakes out (apart from every 2nd function call being deprecated)
  13. im working on a volumetric renderer and want to implement updating mechanisms to the volume (wich is represented as 3D texture) i wanted to know wether and how rendering to 3D textures is possibly (there is glFramebufferTexture3D but i dont quite get the rest) so normally(when rendering to 2D textures) i would bind a framebuffer with the target texture and in my fragment shader do something like: [code] gl_FragData[0] = stuff.xyzw; [/code] but since the fragment shader is run after the projection, coordinates should be 2d. basically what im looking for is a way to write to a specific position in the 3D texture, lets say [0.43,0.5,0.7] without uploading the data from RAM but instead writing it from a shader
  14. ive got a binary voxel grid, stored as 3 dimensional array of boolean values. does anyone have an idea how to create a polygon mesh out of such a grid?
  15. get type of string in C++

    thank you so much... i already knew about stringstreams but i didnt know that the failbit existed... this is what ive been searching for [img]http://public.gamedev.net/public/style_emoticons/default/smile.gif[/img] EDIT: one last question though: if i call the stringstream operator twice, will the second overwrite the firsts failbit, if it has been set? like this [code] <stringstream operation fails> //flag is set <stringstream operation is successful> //flag is not set? [/code]