NumberXaero

Members
  • Content count

    646
  • Joined

  • Last visited

Community Reputation

2624 Excellent

About NumberXaero

  • Rank
    Advanced Member

Personal Information

  • Interests
    Art
    Audio
    Programming
  1. You want array of vectors....   int frames = 1330; std::vector<int>* ivecs = new std::vector<int>[frames];   or just use a vector of vectors   typedef std::vector<int> intVector; std::vector<intVector> anims(frames);
  2. How to move a directx11 camera via the view matrix?

    What if you change all the camera (pos, dir, amount) to (amount, dir, pos)?   XMVectorMultiplyAdd(position, right, amount) => XMVectorMultiplyAdd(amount, right, position)
  3. Ive had a problem similar to this with gl text before, although it was a while ago and I dont remember what it was exactly. What gl version are you targeting and what does the shader look like for this? Have you rendered the atlas to a quad and confirmed that everything is copying into the right place? Off the top of my head I remember something about setting the textures swizzle tex parameter GL_TEXTURE_SWIZZLE_RGBA to {GL_RED, GL_RED, GL_RED, GL_RED} when using the format GL_RED but thats just a guess.   1) confirm your tex coords are generated correctly 2) confirm the image displays as you think it should 3) confirm you are getting the correct values in the shader when sampling the texture in the fragment shader
  4. Probably to add features existing formats dont have, compression, mipmaps precalculated, HDR, could be a million things other formats dont support or dont do well enought for them.
  5. Thats pretty much correct, the baking youre referring to is common to generate a normal map (and other maps, AO, etc). The general idea is you have a low poly and a high poly that essentially match/lineup except they have different poly counts, and therefore the higher poly one is more detailed. You "bake" these high poly details into a texture (like a normal map) and then apply the normal map to the low poly in game for lighting calcs, etc.   Youre missing steps in the sense that it can be a little more involved, depends on the tools/process used, normal map output depends on the target engine/software format, conventions, etc. and as I understand it, its not exactly hard to generate bad maps containing errors if the input models are not what/where they need to be.   a program called x-normal is often used for the "bake" process.   As for poly counts, again its sort of target dependent, what are they for, I believe the characters in doom 3 if I remember were somewhere between 1500-3000, thats probably on the lower end these days, but again its depends on the target use and the effects that will be applied to it, it really could be anything. Two triangles for a wall in the world with a lot of effects on it might do the job. For the high poly bake source, ive seen extremely high counts, 100s of thousands or more depending. But again it depends on whats needed.
  6. GLSL: Incorrect WorldPosition

    Im not sure what "matTotal" is or how youre building it, is "matTotal" the combined world * view * proj matrix? if it is you might be transforming object space verts (vertexPos) into world (WorldPos) and then transforming world space pos "WorldPos" by world again, as part of the world view proj matrix "matTotal". "matTotal" is an odd name, might wanna name it what it is, MVP or VP.
  7. Why disable the context on line 5, only to turn it on again on 7? and why get two pointers to CreateContextAttribs? seems odd, or are these sanity checks?   Generally you   CreateContext(old) MakeCurrent(old) load CreateContextAttribs  // get ptr call CreateContextAttribs   // get the new context MakeCurrent(null)             // done with old DeleteContext(old)           // delete old MakeCurrent(new)            // off you go
  8. I have a model I loaded into a VBO with an index buffer using a VAO. The shader Im testing with uses a uniform buffer with an array of 4x4 matrices and an array of vec4 colors, 256 of each. These arrays are indexed by gl_InstanceID. When I create the buffer with the STATIC hint, with glBufferData to size it once, and glBufferSubData to upload to it once, everything is fine, runs as expected, 256 randomly rotated models in a grid layout. Switching the VBO to use glBufferStorage with 3x storage (~6mb for ~2mb model), creating with persistent/write/coherent flags, and mapping once with persistent/write/coherent/dynamic_storage causes the performance to plummet. If I limit the instance count of the bad perf case to 32 (of the possible 256) it runs alright. Whether I write to the 3x buffer every frame or not (using fenceSyncs, or not) simply using buffer storage with instancing destroys perf, where Im not seeing any problems with a single STATIC/BufferData/BufferSubData. Ive checked with NSight and all I can see is that with the buffer storage case, the single glDrawElementsInstancedBaseVertex call takes approx. 4x longer then the STATIC bufferData case. Nothing changes with the uniform buffer, same data, same updates, and the funny thing is I use this bufferStorage/fenceSync/3xSize setup all over the place, but only with this single glDrawElementsInstancedBaseVertex does it cause perf problems. Other info: - im not exceeding the uniform buffer size limit - can safely assume the fence syncs on the 3x buffer are not blocking - on an NV 670 2gb - Nsight reports no errors in graphics debugging, except the call is taking 4x longer Am I missing something, or have I just hit a slow path in the driver? any ideas? my last idea is that the 3x buffer with base vertex is taking me to some unaligned address, could that be it?
  9. Imagine a stack of matrices, in this case the "model_view" matrix stack activated with a call to glMatrixMode() <Top> [matrix1] [matrix0] <bottom> ----------- glPushMatrix() copies the matrix on the top, and then makes it the new top <Top> [matrix1copy] [matrix1] [matrix0] <bottom> ----------- this essentially saves matrix1 (any transforms youve done) and creates a copy, which you might then follow with a call that modifies the top matrix further, such as glTranslate*() -> builds a translation matrix and multiplies it into the top of the current stack (the matrix 1 copy) further transforming matrix 1 glScale() -> same thing, but a scale matrix is multipled into top glRotate()  -> same thing, but a rotation matrix it multipled into top glLoadIdentity() -> clear top to identity glMultMatrix() -> you provide the matrix already built <Top> [matrix1copy] *= Trans|Scale|Rot Matrix [matrix1] [matrix0] <bottom> ----------- now you draw, its use the top, then when you are done drawing, you call PopMatrix(), which removes the top and goes back to the original <Top> [matrix1] [matrix0] <bottom> ----------- simple example, want to draw an object at 10 down +x, at 20 down +x, and 5 up +y <Top> [matrix0.identity] <bottom> ----------- PushMatrix() <Top> [matrix0.identity] <- glPushMatrix() [matrix0.identity] <bottom> ----------- <Top> [matrix0.(10, 0, 0)] <- PushMatrix(), *= glTranslate(10, 0, 0), now draws at 10 down x [matrix0.identity] <bottom> ----------- <Top> [matrix0.(20, 0, 0)] <- PushMatrix(), *= glTranslate(10, 0, 0), now draws at 20 down x [matrix0.(10, 0, 0)] [matrix0.identity] <- drawing now draws at origin <bottom> ----------- PopMatrix(), PopMatrix() <Top> [matrix0.identity] <- drawing now draws at origin <bottom> ----------- <Top> [matrix0.(0, 5, 0)] <- PushMatrix(), *= glTranslate(0, 5, 0), now draws at 5 up y [matrix0.identity] <bottom> ----------- thats the general idea anyway, think of pushmatrix as transform save point, a fork in the road you might want to come back to before applying more transforms. Its the model view matrix because you generally put the view matrix (inverse of the cameras matrix) at the bottom (first) which brings an objects model matrix (world matrix) into the cameras "view space". These are all old opengl calls, but the idea can still be important to understand.
  10. Recommendations for a Text Editor

    Not sure if its what you need, https://code.visualstudio.com/ I use it for quick shader editing, it has highlighting and extensions, not sure about heavy plugins
  11. Resolving Creative Differences

    https://www.youtube.com/watch?v=aD3xfT0c99g
  12. You could also make the observation that your weapon likely has an ammo capacity, which you could pre-allocate at start up or creation time, and simply fire one out of the list placing it in a "used" or "fired" list of some sort and get a new one next time from the unused/loaded list. Once a used bullet dies, hitting an object or traveling too far, recycle it back into the unused list. If you need infinite ammo, your weapon probably has a rate of fire, and the bullets probably have a max travel distance limit, you could again use this info to allocate the max bullets you might ever need, and just keep firing and recycling. What you can do is sorta dependent on what youre making, but it could be as simple as pre allocating an array of bullets, and maintaining a fired/loaded link list of bullets where each bullet has a pointer to the next, where next is either fired or loaded depending on which list the bullet is in.
  13. I suppose you could just not use texture filtering, use point sampling (nearest), dont mipmap, and make sure your texture coordinates (table lookup indices?) fall exactly on texel centers.
  14. Im not american but I think George Carlin summed it up voting pretty well   "...First of all it's meaningless; this country was bought and sold a long time ago. The shit they shovel around every 4 years *pfff* doesn't mean a fucking thing."   because when there is that much money in play, something is being bought...   As far as the GOP goes they needed someone as fucking crazy as Trump to make the candidates they have been pushing look half normal. That party is a joke. Good or bad, which ever side wins, neither side is going to follow through on any of it unless they are told to by the money.
  15. This is way I would look at this, assuming you have your world grid evenly spaced across the map, and the state of each cell flagged as open or closed and the info for whether the current structure can be placed there (refinery) and whether its blocked by a unit, what you really want to draw is an WxH planar grid mesh of quads spaced the same as the world grid, which you can generate once at load time. Each quad would have its own 0.0 -> 1.0 texture space, to place the little faded corner texture on, and you could just change the vertex colors of the cells (quads) to match their state (yellow = neutral, green = ok, red = blocked), the whole thing would then look like a simple blended mesh draw, where you update the vertex colors when needed (when the grid is visible).   So you wouldnt exactly draw the cells as you have them stored in the world grid. You just draw a planar grid over top, blended, textured, with vertex colors matching the state based on the selected building/structure and your game logic.