• Content count

  • Joined

  • Last visited

Community Reputation

158 Neutral

About Total_Titillation

  • Rank
  1. I recently noticed that there is a new release of Qt.  I don’t have any personal experience developing games or applications with it, but I’m looking for an API or framework that will simplify creation of GUI for my applications, written in C++ & OpenGL.  At this stage I’m less worried about cross-platform, but this is something that I could benefit from in future.   I understand that Qt's real strength lies in its flexibility and cross-platform functionality.  Obviously this comes with a trade-off; less control over the main loop.   I have spent a few days pouring over articles and blogs and not really seen much about Qt 5 and the rest of the information regarding Qt seems to point to it not being a great choice for 3D games.  I wanted to get a discussion going as most of the information I’ve found seems to be quite dated.   So I guess my questions are: Is Qt a viable for 3D application/games development?    For instance, if I wanted to make a 3D application that had multiple viewports with relevant GUI and a viewport rending a relatively large amount of polys (say 6 million) with some degree of 3D texturing and multiple passes / shaders. Could I use Qt?   From what I’ve read, using GUI elements of Qt seem to take a lot of CPU time.  I recognise that there are optimisations you can do within your program, but Qt’s GUI is a big plus and I wouldn’t really want to use Qt if I couldn’t take advantage of it. 
  2. Tweaking Heightmap Generation For Hexagon Grids

      Ah, sorry, I missed that. Typically when someone posts an image, they are showing what they want to do, not what they don't want to do.   Still, what I said stands, as you stated. With a heightmap, there are always going to be some slopes, as long as some hexes are raised and some are lowered. The hexes "in between" will be ugly. I still stand with my assertion that the best bet would be to ditch the heightmap and just use straight meshes.   Edit: Reading the OP more closely, I'm not sure there really is a way to do what you want. It seems like you don't really have a clear vision of what you want. It might help if you somehow manually constructed a mock-up of what you have in mind, since that might help you to visualize solutions to how to implement it.   If you are wanting to have a mix of rolling height-map terrain and cliffs both, then typically this is implemented using a combination of height-map for the rolling terrain, and meshes for the cliffs that are placed on the terrain to cover the "ugly" hexes where hexes slope from high to low.     Thanks, I think you're right.  I'm going to do a bit more reading, turn my application into a more flexible level editor and implement a few different approaches.   One thing I have come accross is Spinodal Decomposition on a Hexagonal Lattice. Which looks interesting and I have since found a few papers that explain plenty of interesting procedural techniques, This one in particular.  
  3. Tweaking Heightmap Generation For Hexagon Grids

    Thanks for your suggestions.   Could you by any chance, point me in the direction of some material that explains or at least a phrase to search for.   Thanks!
  4. Currently I'm working on a little project just for a bit of fun. It is a C++, WinAPI application using OpenGL. I hope it will turn into a RTS Game played on a hexagon grid and when I get the basic game engine done, I have plans to expand it further. At the moment my application consists of a VBO that holds vertex and heightmap information. The heightmap is generated using a midpoint displacement algorithm (diamond-square). In order to implement a hexagon grid I went with the idea explained here. It shifts down odd rows of a normal grid to allow relatively easy rendering of hexagons without too many further complications (I hope). Allows for: After a few days it is beginning to come together and I've added mouse picking, which is implemented by rendering each hex in the grid in a unique colour, and then sampling a given mouse position within this FBO to identify the ID of the selected cell (visible in the top right of the screenshot below). In the next stage of my project I would like to look at generating more 'playable' terrains. To me this means that the shape of each hexagon should be more regular than those seen in the image above. So finally coming to my point, is there:A way of smoothing or adjusting the vertices in my current method that would bring all point of a hexagon onto one plane (coplanar). A better approach to procedural terrain generation that would allow for better control of this sort of thing. A way to represent my vertex information in a different way that allows for this.To be clear, I am not trying to achieve a flat hex grid with raised edges or platforms (as seen below). I would like all the geometry to join and lead into the next bit. I'm hope to achieve something similar to what I have now (relatively nice undulating hills & terrain) but with more controllable plateaus. This gives me the flexibility of cording off areas (unplayable tiles) later on, where I can add higher detail meshes if needed. Any feedback is welcome, I'm using this as a learning exercise so please - all comments welcome!
  5. I'm currently working on a breakout type game set in space. I want to do a range of different particle effects, the first of which is a rocket booster type trail for the player's ship. The system I using is a modified version of the particle tutorial found on NeHe. Most of the tutorials and examples I have looked as used addative blending for this (glBlendFunc(GL_SRC_ALPHA, GL_ONE) - I think). However, if I use this method I get a nice result if the background is dark, but if the background colour is approaching white you can haldy see the effect. A snapshot of the effect on a dark background. [img][/img] [img][/img] So i guess my question is, am I using the correct method of blending? Is there a way I can achieve the same affect no matter the background colour? I'm guessing if I was to use normal alpha blending (glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)) I would have to modify my particle system to move through a set number of colours to achieve the same affect that I have currently? Any help would be much appreciated, thank you!
  6. OpenGL Depth Buffer Problem[Solved]

    Wow, andy you were right! Annoyed I missed that, thanks alot!
  7. OpenGL Depth Buffer Problem[Solved]

    1)Everything seems to work fine, other than the skybox appearing white (I think). 2)Yes 3)Rendering the font is causing this problem. 4)I Want to know how I can 'adjust' the font rendering class to get it back to normal. I'm using Graphic Remedy it allows you to look at the textures, buffers being used in your program - It's a good profiler. How do i check glGetError? Also two other things: 1) The problem doesn't seem to be modelview matrix related. 2) Are you checking glGetError? Here is an example log from GeDEBugger(Big file sorry). [Edit] I have tried disabling the depth buffer when rendering the font and it does nothing. In previous projects the texturing was done by a shader, perhaps this is why I am having problems. What is however strange is that my GUI is still working (uses textures) so I can't be a texture related problem.
  8. For my last few projects I have been using some of the utility files that I found whilst looking at a few demos here. Namely a file called opengl.h - mainly used to manage shaders a bit like glew and another file gl_font. gl_font is a class they use to render fonts on screen using vertex buffer objects. However, when I use this to render the framerate in my game it draws everything but the skybox correctly. For some reason the skybox is rendered white as seen here, if I do not render the font it looks like this. Here are some parts of the gl_font class that I think are most important: void GLFont::begin() { HWND hWnd = GetForegroundWindow(); RECT rcClient; GetClientRect(hWnd, &rcClient); int w = rcClient.right - rcClient.left; int h = rcClient.bottom -; glPushAttrib(GL_CURRENT_BIT | GL_LIGHTING_BIT); glDisable(GL_LIGHTING); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, m_fontTexture); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glOrtho(0.0f, w, h, 0.0f, -1.0f, 1.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glBindBuffer(GL_ARRAY_BUFFER, m_vertexBuffer); drawTextBegin(); } I have trie changing glPushAttrib(GL_CURRENT_BIT | GL_LIGHTING_BIT); to glPushAttrib(GL_CURRENT_BIT | GL_LIGHTING_BIT | GL_TEXTURE_BIT); and the background texture returns, but the font isn't rendered. void GLFont::end() { drawTextEnd(); glBindBuffer(GL_ARRAY_BUFFER, 0); glBindTexture(GL_TEXTURE_2D, 0); glDisable(GL_TEXTURE_2D); glDisable(GL_BLEND); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); glPopAttrib(); } This is an image of the depth buffer when the font is rendered and this is what is looks like when it is not. Could anyone shed some light on this problem please? Any help would be much appreciated! Thanks. [Edited by - Total_Titillation on January 6, 2011 10:02:20 AM]
  9. Texturing VBOs

    I have tried my old texture manager and the textures are loading fine. What is the best way to manager textures? My previous version loads all of the textures at the start and then passes pointers when needed. [Edited by - Total_Titillation on November 7, 2010 11:19:01 AM]
  10. Texturing VBOs

    I'm currently working on a procedural planet generation tool that works by taking a cube, mapping it to a sphere and then applying a heightmap to each face to generate terrain. I'm using a VBO for each face which is created using the following method: void Planet::setVertexBufferObject() { Vertex* vertices; int currentVertex; Vertex* vertex; for(int i = 0; i < 6; i++) { // bottom face if(i == 0) { glBindBuffer(GL_ARRAY_BUFFER, bottomVBO); } // top face else if(i == 1) { glBindBuffer(GL_ARRAY_BUFFER, topVBO); } // front face else if(i == 2) { glBindBuffer(GL_ARRAY_BUFFER, frontVBO); } // back face else if(i == 3) { glBindBuffer(GL_ARRAY_BUFFER, backVBO); } // left face else if(i == 4) { glBindBuffer(GL_ARRAY_BUFFER, leftVBO); } // right face else { glBindBuffer(GL_ARRAY_BUFFER, rightVBO); } vertices = (Vertex*)glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY); currentVertex = 0; for(int x = 0; x < size; x++) { for(int z = 0; z < size; z++) { currentVertex = z * size + x; vertex = &vertices[currentVertex]; vertex->xTextureCoord = (x * 1.0f) / 512.0f; vertex->zTextureCoord = (z * 1.0f) / 512.0f; Vector3 normal; vertex->xNormal = normal.x; vertex->yNormal = normal.y; vertex->zNormal = normal.z; vertex->x = heightMapCubeFace[i][x][z][0]; vertex->y = heightMapCubeFace[i][x][z][1]; vertex->z = heightMapCubeFace[i][x][z][2]; vertex->x *= (1.0f +((heightMaps[i][z][x]/256.0f) * 0.1)); vertex->y *= (1.0f +((heightMaps[i][z][x]/256.0f) * 0.1)); vertex->z *= (1.0f +((heightMaps[i][z][x]/256.0f) * 0.1)); } } glUnmapBuffer(GL_ARRAY_BUFFER); glBindBuffer(GL_ARRAY_BUFFER, 0); } } I have left out the setIndexBufferObject() method as that is working OK. I am then rendering the sphere using this method: void Planet::render() { // bottom face glBindBuffer(GL_ARRAY_BUFFER, bottomVBO); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bottomIBO); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer(2, GL_FLOAT, sizeof(Vertex), BUFFER_OFFSET(6 * sizeof(float))); glEnableClientState(GL_NORMAL_ARRAY); glNormalPointer(GL_FLOAT, sizeof(Vertex), BUFFER_OFFSET(3 * sizeof(float))); glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(3, GL_FLOAT, sizeof(Vertex), BUFFER_OFFSET(0)); TextureManager::Inst()->BindTexture(textueIDs[0]); glClientActiveTexture(GL_TEXTURE0+textueIDs[0]); glDrawElements(GL_TRIANGLE_STRIP, numberOfIndices, GL_UNSIGNED_INT, BUFFER_OFFSET(0)); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_NORMAL_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); // next face and so on... The textures are being loaded in using free image, as you can see from the above code I am just using the example texture manager that came with freeimage. Why is binding the texture not working? Any help would be much appreciated, thanks!
  11. Problems Mapping Heightmaps to Sphere [SOLVED]

    Seems obvious now, but as everything is between -1 and 1 you can just multiply each vertex by a percentage.
  12. Problems Mapping Heightmaps to Sphere [SOLVED]

    OK I have done as you suggested; as you can see in the following images, I made the top right corner of the red face 0.2 taller than everything else and the top left corner of the white face 0.2 taller: Without mapping them to the sphere the edges don't meet, and when mapping them to a sphere it has the same problem. All the values of the geometry are between -1 and 1 and I'm using the following to map them: vert.x = x * sqrtf(1.0f - y * y * 0.5f - z * z * 0.5f + y * y * z * z / 3.0f); vert.y = y * sqrtf(1.0f - z * z * 0.5f - x * x * 0.5f + z * z * x * x / 3.0f); vert.z = z * sqrtf(1.0f - x * x * 0.5f - y * y * 0.5f + x * x * y * y / 3.0f); which looked like this As far as I can tell as you approach 1 or -1 the function seems to curve the geometry a lot more. But I don't see how I can deform the geometry without creating gaps, as if I add height to a face it will create graps at the edges and this will be transferred onto the sphere. Edit: I'm guessing one way would be to store the height info for use in a shader, then in the shader get the vector from the centre to the point on the spheres surface and add or take away height for each vertex?
  13. I'm currently trying to create a procedural planet generating tool. I have started off by mapping a cube to a sphere like so: I know this has been covered quite alot but I couldn't really find anything specific. I'm using Libnoise to heightmap a cube using 3D Perlian noise. I am able to generate a seamless cubmap. I have checked this in photoshop and though I had to rotate the heightmap images to get them to fit in the net I think they are the correct orientation. I have tried getting the perlin value for the co ordinates after they have been mapped to the sphere, but they don't meet at the edges. At the moment I am creating geometry between -0.8 and +0.8 and then adding 0.2 * heightmap value(between -1 and 1). Either I am making use of the heightmap data wrongly or the heightmaps are not orientated correctly (I suspect it is a little of both). Any help would be much appreciated! Thanks, Henry. [Edited by - Total_Titillation on November 3, 2010 6:39:39 PM]
  14. GLSL Texture splatting + Fog

    The problem was my lighting. glFog is not working because I am using a shader. Shader: [vert] uniform float tilingFactor; varying vec4 normal; varying float gl_FogFragCoord; void main() { gl_FogFragCoord = gl_Position.z; = normalize(gl_NormalMatrix * gl_Normal); normal.w = gl_Vertex.y; gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; gl_TexCoord[0] = gl_MultiTexCoord0 * tilingFactor; } [frag] struct TerrainRegion { float min; float max; }; uniform TerrainRegion region1; uniform TerrainRegion region2; uniform TerrainRegion region3; uniform TerrainRegion region4; uniform TerrainRegion region5; uniform sampler2D region1ColorMap; uniform sampler2D region2ColorMap; uniform sampler2D region3ColorMap; uniform sampler2D region4ColorMap; uniform sampler2D region5ColorMap; varying vec4 normal; varying float gl_FogFragCoord; vec4 GenerateTerrainColor() { vec4 terrainColor = vec4(0.0, 0.0, 0.0, 1.0); float height = normal.w; float regionMin = 0.0; float regionMax = 0.0; float regionRange = 0.0; float regionWeight = 0.0; // Terrain region 1. regionMin = region1.min; regionMax = region1.max; regionRange = regionMax - regionMin; regionWeight = (regionRange - abs(height - regionMax)) / regionRange; regionWeight = max(0.0, 0.5 * regionWeight); terrainColor += regionWeight * texture2D(region1ColorMap, gl_TexCoord[0].st); // Terrain region 2. regionMin = region2.min; regionMax = region2.max; regionRange = regionMax - regionMin; regionWeight = (regionRange - abs(height - regionMax)) / (regionRange * 2) ; regionWeight = max(0.0,regionWeight); terrainColor += regionWeight * texture2D(region2ColorMap, gl_TexCoord[0].st); // Terrain region 3. regionMin = region3.min; regionMax = region3.max; regionRange = regionMax - regionMin; regionWeight = (regionRange - abs(height - regionMax)) / regionRange; regionWeight = max(0.0, regionWeight); terrainColor += regionWeight * texture2D(region3ColorMap, gl_TexCoord[0].st); // Terrain region 4. regionMin = region4.min; regionMax = region4.max; regionRange = regionMax - regionMin; regionWeight = (regionRange - abs(height - regionMax)) / regionRange; regionWeight = max(0.0, regionWeight); terrainColor += regionWeight * texture2D(region4ColorMap, gl_TexCoord[0].st); // Terrain region 5. regionMin = region5.min; regionMax = region5.max; regionRange = regionMax - regionMin; regionWeight = (regionRange - abs(height - regionMax)) / regionRange; regionWeight = max(0.0, regionWeight); terrainColor += regionWeight * texture2D(region5ColorMap, gl_TexCoord[0].st); return terrainColor; } void main() { float fog; vec3 n = normalize(; float nDotL = max(0.0, dot(n, gl_LightSource[0]; vec4 ambient = gl_FrontLightProduct[0].ambient; vec4 diffuse = gl_FrontLightProduct[0].diffuse * nDotL; vec4 color = gl_FrontLightModelProduct.sceneColor + ambient + diffuse; fog = (gl_Fog.end - gl_FogFragCoord) * gl_Fog.scale; gl_FragColor = mix(gl_Fog.color, (color * GenerateTerrainColor()), fog); } The texture splatting is still working, but random patches are appearing each frame, can anyone point out what I am doing wrong please?
  15. GLSL Texture splatting + Fog

    I'm trying to use glfog() to hide clipping points in my terrain editor. However, because I am playing around with matrix multiplications, the glFog() seems to be working on the wrong axis. Here is my renderFrame() method: void RenderFrame() { glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); glViewport(0, 0, g_windowWidth, g_windowHeight); glClearColor(0.3f, 0.5f, 0.9f, 0.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glMultMatrixf(&g_camera.getProjectionMatrix()[0][0]); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glMultMatrixf(&g_camera.getViewMatrix()[0][0]); RenderTerrain(); RenderText(); } Here are a few screenshots to illustrate the problem: image 1 image 2 image 3 As the camera turns to look down the Y axis, the fog takes affect. How can I fix this? Any help would be much appreciated thank you! [Edited by - Total_Titillation on August 1, 2010 3:13:08 PM]