Comments (15)
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.
If you doesn't want a Shape, you could also try to load your Pixel in a Texture/Surface.
from dgame.
Can this be closed?
from dgame.
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.
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.
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.
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.
Which Dgame version did you use? If it's the bug I think about it was fixed here: 59fff01#diff-a351c750b91f11d1a9b2fa332a3c3f0cL448
from dgame.
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.
You mean this artifacts? The blue triangle?
from dgame.
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.
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.
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.
Anything new?
from dgame.
Sorry, nothing. I still have not tested this, and not sure if I'll have time to do that.
from dgame.
Related Issues (20)
- Iterating over SpriteSheet starts at index 1 and ends at index 0 HOT 13
- small issue on page HOT 2
- [Feature Request] A Window.draw overload with an offset HOT 4
- Dgame Does not render on multiple windows HOT 3
- Make Rect a template to allow for floating point HOT 1
- Necessary code doesn't execute when compiling in release mode HOT 3
- Shape color is being changed by unrelated objects HOT 5
- TTF_Init is not being called, formatting Text always errors "Font Invalid" HOT 5
- StopWatch Divide by 0 when trying to fill frame_ms HOT 1
- DerelictGL3 not able to find symbol ( glGetnTexImage ) HOT 3
- Window.wait Timeout is milliseconds, not seconds. HOT 1
- Collision detection HOT 4
- Wrong links in README.md? HOT 1
- Dgame crashing HOT 6
- Is this project still alive ? Couple bugs I ran into. HOT 8
- What about adding more built in colors? Like 400 plus . Color Enhancement idea . HOT 8
- Rect methods questions ? Add new method clamp ? HOT 1
- `object.Error@(0): Access Violation` on `DMD32` HOT 7
- D program quits unexpectedly when using Text HOT 11
- Text colors are wrong HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dgame.