Jump to content

SpiderPig

Members
  • Posts

    2,412
  • Joined

  • Last visited

Posts posted by SpiderPig

  1. Don't mean to bother you @Josh, but do you think getting the character controller to align to the direction it's falling could be in the next update?  I'm hoping to release my game early next year...

    What I'm doing is adding a force to each character controller in the direction of gravity.  I just need the controller to align itself to that direction, and behave like normal.

  2. I'd use a class to store the information;

    class LoadOut
    {
    private:
    	string saveTitle = "Assault Pack";
    	vector<(type)> weaponsList;
    public:
    };

    This will work for saving between map loads.  If you want to save between games you can use the Leadwerks FileSystem to save the list to a file.

    Is your players inventory in LUA though?

  3. Scripts can still be attached to objects.  There should be a visual studio project file in one of the folders of your project, under Project->Windows i think...?

    Load that up, and you'll see in App.cpp the code that executes Main.lua.  You should just need to recode Main.lua into App.cpp and go from there.

  4. I'm not sure why it's needed either.  I will be looking into it more as i dont think its just the texture array shader.  I have a shader that uses a storage object and it dosnt work with zsort on.  I'll see if I can track the problem down.

  5. Quote

    So it does not occur when MSAA is disabled.

    Correct.

    What I noticed with texture arrays is, the material had to have z-sort enabled in order for the textures to show.  With z-sort enabled on my terrain, and MSAA enabled I get this issue.  Can the resolution of the depth texture be changed to match the context or is this impractical?

  6. This code shows a yellow texture;

    int _width = 512;
    int _height = 512;
    char* buf = new char[ _width * _height * 3];
    
    int index = 0;
    for (int x = 0; x < _width; x++) {
    	for (int y = 0; y < _height; y++) {
    		buf[index] = 255;
    		buf[index + 1] = 255;
    		buf[index + 2] = 0;
    		index+=3;
    	}
    }
    
    OpenGLShader* shader = (OpenGLShader*)mat->GetShader();
    glUseProgram(shader->program);
    
    GLuint _buffer;
    glGenTextures(1, &_buffer);
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D_ARRAY, _buffer);
    glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAX_LEVEL, 0);
    
    glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGB8, _width, _height, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, nullptr);
    
    GLenum e5 = glGetError();
    glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, _width, _height, 1, GL_RGB, GL_UNSIGNED_BYTE, buf);
    
    glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

    However loading a texture with a different size at the beginning (1024 x 1024) causes the crash.

    Texture* texture = Texture::Load("Materials\\bluegrid.tex");//1024x1024
    
    int _width = 512;//works if these are made 1024 as well
    int _height = 512;
    char* buf = new char[ _width * _height * 3];
    
    int index = 0;
    for (int x = 0; x < _width; x++) {
    	for (int y = 0; y < _height; y++) {
    		buf[index] = 255;
    		buf[index + 1] = 255;
    		buf[index + 2] = 0;
    		index+=3;
    	}
    }
    
    OpenGLShader* shader = (OpenGLShader*)mat->GetShader();
    glUseProgram(shader->program);
    
    GLuint _buffer;
    glGenTextures(1, &_buffer);
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D_ARRAY, _buffer);
    glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAX_LEVEL, 0);
    
    glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGB8, _width, _height, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, nullptr);
    
    GLenum e5 = glGetError();
    glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, _width, _height, 1, GL_RGB, GL_UNSIGNED_BYTE, buf);
    
    glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

     

  7. With no compression it is, yes.  Even if i didn't use the texture that I loaded, and set the pixels for the array manually after loading the texture, the two different sizes would cause the crash.  Obviously it's something that's easily avoided now, I'm just more curious as to why it happened.

  8. Okay I've solved it.  If I use a 4096x4096 texture the crash occurs.  Using a 1024x1024 works perfectly.  @Josh any ideas why this would happen?

     

    EDIT : Something is being set when loading the texture before assigning it to the array.  If I don't load the texture and set my own, any size works.  But if I load an image before making my own to assign to the array and the two sizes don't match, it crashes.

  9. Finally got it to work in a dedicated project, but not in my game.  Here's the code that works;

    Model* box = Model::Box();
    box->Move(0, 1, 0);
    Material* mat = Material::Load("Materials\\Test.mat");
    box->SetMaterial(mat);
    
    
    Texture* texture = Texture::Load("Materials\\bluegrid.tex");
    
    int _width = texture->GetWidth();
    int _height = texture->GetHeight();
    int sze = texture->GetMipmapSize(0);
    char* buf = new char[sze];
    texture->GetPixels(buf);
    
    OpenGLShader* shader = (OpenGLShader*)mat->GetShader();
    
    glUseProgram(shader->program);
    
    GLuint _buffer;
    glGenTextures(1, &_buffer);
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D_ARRAY, _buffer);
    glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAX_LEVEL, 0);
    
    glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA8, _width, _height, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
    
    glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, _width, _height, 1, GL_RGBA, GL_UNSIGNED_BYTE, buf);
    
    glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

    However the exact same code in my game project fails with an access violation at this line in assembly;

    0371FCE9  movzx       ebx,byte ptr [esi+2]  

    I'm using the same material and shader as the testing project, and am setting things up the same and at the begging in the Start() function after setting up the window, context and camera.  I'm wondering if it could be something setup wrong in the solution settings?  Any ideas?

  10. Quote

    After talking to @Argent Arts trying to figure out what was happening I managed to reproduce the problem.

    I have two screens of the same model both set to a resolution of 1920x1080 (which is their native resolution) in which full screen works fine.

    If I set one or both of these to a resolution below their native, the problem happens.

    @Argent Arts is using two screens as well, but both are different models and have different native resolutions.  By setting the lower native resolution screen to the primary Leadwerks ran in full screen but only on that screen, not the bigger one.

     

    I'm not sure how Leadwerks manages full-screen mode, but from what looks to be happening, it seems Leadwerks is using the correct resolution of the screen for it's window, but is somehow scaling the result down as if the screen was still using it's native resolution.

    The scaling options for Windows 10 would also do this because it would scale it up to be different from the native as well.

    I'm not positive but with the Issue of the Leadwerks window appearing off screen, probably relates to the difference between native and current resolutions too.

     

    Is anyone else able to reproduce this problem by changing their screen resolution?

    Quote

    Just had a thought and looked at it again, when Leadwerks runs it is actually changing the screens resolution back to native ;)

     

    EDIT : I changed my primary screen to 1680x1050 and had two black bars on the sides due to the aspect ratio.  When Leadwerks ran these bars disappeared.

    Did you see my earlier replies Josh?  I managed to replicate the problem like this.

    • Thanks 1
×
×
  • Create New...