Giter Club home page Giter Club logo

Comments (15)

Dgame avatar Dgame commented on May 23, 2024

I would try the vertex array class:
http://dgame-dev.de/?package=Graphics&module=VertexArray
http://dgame-dev.de/?page=tutorial&tut=vertex_arrays

Otherwise the VertexRenderer:
http://dgame-dev.de/?package=System&module=VertexRenderer

from dgame.

Dgame avatar Dgame commented on May 23, 2024

If you doesn't want a Shape, you could also try to load your Pixel in a Texture/Surface.

from dgame.

Dgame avatar Dgame commented on May 23, 2024

Can this be closed?

from dgame.

Dgame avatar Dgame commented on May 23, 2024
In what format should I load memory with this function? I use Texture. final void loadFromMemory(void* memory, ushort width, ushort height, ubyte depth, Format fmt = Format.None);

Could you give me more code? Currently I don't see what you want.

from dgame.

MarisaLovesUsAll avatar MarisaLovesUsAll commented on May 23, 2024

Now I have:

Color bitmap[1024][768];
Texture screen = new Texture;
Sprite sprite = new Sprite(screen);

void draw_bitmap()
{
screen.loadFromMemory(&bitmap, 1024, 768, 24, Texture.Format.RGBA);
}

void Render()
{
sprite.setTexture(screen); // I think this isn't right :)
wnd.draw(sprite);
}

I want to change pixel data manually, and display it on the Window with hardware acceleration.

from dgame.

Dgame avatar Dgame commented on May 23, 2024

Have you tried Texture.setColorkey? You could also use Texture.getMemory. The latter could be converted to your Color array. You can use the setcolorkey code for inspiration: https://github.com/Dgame/Dgame/blob/master/Graphics/Texture.d#L470

What is your main intention?

from dgame.

MarisaLovesUsAll avatar MarisaLovesUsAll commented on May 23, 2024

Have you tried Texture.setColorkey?

Yes, I got this: https://dl.dropboxusercontent.com/u/76682625/Trash/shot1.png
Is it OpenGL issue? I have Intel HD Graphics 4600 on Linux Mint 15, maybe there is some bugs in drivers or incomplete support (i didn't find drivers, but TF2 runs fine, as example).

What is your main intention?

Pixels are not rendered correctly.

You could also use Texture.getMemory.

Thanks, I'll try it tomorrow.

from dgame.

Dgame avatar Dgame commented on May 23, 2024

Which Dgame version did you use? If it's the bug I think about it was fixed here: 59fff01#diff-a351c750b91f11d1a9b2fa332a3c3f0cL448

from dgame.

MarisaLovesUsAll avatar MarisaLovesUsAll commented on May 23, 2024

Sorry, it was my fault. Now it works almost perfectly, but there is some strange bug.
It appears randomly in ~30% of cases.

My code:

Color bitmap[768][1024];
Texture screen = new Texture;
sprite = new Sprite(screen);

        foreach(ref map; bitmap[])
        {
            map = Color(67,0,67);
        }

        for(int x=0; x<1024; x++)
        {
            for(int y=0; y<768; y++)
            {
                bitmap[y][x] = Color(30,30,127, 127);
            }
        }
        screen.loadFromMemory(&bitmap, 1024, 768, 32);
        sprite.setTexture(screen);
        sprite.setPosition(0,0);
        wnd.draw(sprite);

Screens:
https://dl.dropboxusercontent.com/u/76682625/Trash/Dgame/%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA-fgsfds-7.png
https://dl.dropboxusercontent.com/u/76682625/Trash/Dgame/%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA-fgsfds-8.png
https://dl.dropboxusercontent.com/u/76682625/Trash/Dgame/%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA-fgsfds-11.png
https://dl.dropboxusercontent.com/u/76682625/Trash/Dgame/%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA-fgsfds-12.png
https://dl.dropboxusercontent.com/u/76682625/Trash/Dgame/%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA-fgsfds-15.png
https://dl.dropboxusercontent.com/u/76682625/Trash/Dgame/%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA-fgsfds-16.png

from dgame.

Dgame avatar Dgame commented on May 23, 2024

You mean this artifacts? The blue triangle?

from dgame.

MarisaLovesUsAll avatar MarisaLovesUsAll commented on May 23, 2024

You mean this artifacts? The blue triangle?

Yes, this triangle. On a plot of the screen with this triangle, pixels doesn't update.
In this video my code is

        foreach(ref line; bitmap[])      // clear bitmap
        {
            line = Color(67,0,67);
        }

        /* render 3d points */
        /* write it on a bitmap */

        screen.loadFromMemory(&bitmap, 1024, 768, 32);        //load bitmap on a Texture

        sprite.setTexture(screen);        //load Texture to Sprite
        sprite.setPosition(0,0);
        wnd.draw(sprite);  //and show it

Video with bug:
https://dl.dropboxusercontent.com/u/76682625/Trash/Dgame/dgame_bug.mp4

from dgame.

Dgame avatar Dgame commented on May 23, 2024

This seems more like a bug with your graphics card driver. You should update them. Otherwise you could try to extend glClear in Window.d: https://github.com/Dgame/Dgame/blob/master/Window/Window.d#L358
Enable the outcommented GL_DEPTH_BUFFER_BIT or try some other: http://wiki.delphigl.com/index.php/glClear
But from my point of view it looks almost as a driver bug. Which graphic card did you use? And could you try it on another computer?

from dgame.

MarisaLovesUsAll avatar MarisaLovesUsAll commented on May 23, 2024

But from my point of view it looks almost as a driver bug.

I think same.

Which graphic card did you use?

Intel HD Graphics 4600 (built-in Intel i7 4770k). I didn't find official drivers for Linux, and I use built-in drivers from Linux Mint 15. Maybe this is a reason why it doesn't work correctly.

And could you try it on another computer?

I'll try it today or tomorrow.

from dgame.

Dgame avatar Dgame commented on May 23, 2024

Anything new?

from dgame.

MarisaLovesUsAll avatar MarisaLovesUsAll commented on May 23, 2024

Sorry, nothing. I still have not tested this, and not sure if I'll have time to do that.

from dgame.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.