Comments (34)
Did it worked in v0.5?
from dgame.
No, this is the same problem that was mentioned in #46, I am just opening an issue for it now because I can now confirm that the issue is in 0.6 as well.
from dgame.
I see, I thought that would only occur with Style.AllowHighDPI
?
from dgame.
Sorry if I was unclear before, but the issue is with all of the styles, but I have only tested Window.Style.Default in 0.6.
from dgame.
But if you aren't using anti alias it works? Did you tried gl_settings.profile = GLContextSettings.Profile.Default
?
from dgame.
Commenting out the AntiAlias.X4 assignment and adding gl_settings.profile = GLContextSettings.Profile.Default; complies and works. But having both of them, so the code looks like
import Dgame.Window;
import Dgame.System.StopWatch;
void main() {
GLContextSettings gl_settings;
gl_settings.antiAlias = GLContextSettings.AntiAlias.X4;
gl_settings.profile = GLContextSettings.Profile.Default;
Window window = Window(
1280,
720,
"Dungeon Game",
Window.Style.Default,
gl_settings
);
window.clear();
wnd.display();
StopWatch.wait(2000);
}
gives the same error.
from dgame.
The only choice to isolate the error would be that you comment out the lines 170, 174 and 182 in Window/Internal/Init.d
one after another to see which of them produces the error. Would you do that?
from dgame.
I did that and got this error
$ dub --force [13:35:03]
Building derelict-util 2.0.0 configuration "library", build type debug.
Running dmd...
Building derelict-sdl2 1.9.5 configuration "library", build type debug.
Running dmd...
Building derelict-gl3 1.0.13 configuration "library", build type debug.
Running dmd...
Building dgame 0.6.0-rc.1 configuration "lib", build type debug.
Running dmd...
../../../../.dub/packages/dgame-0.6.0-rc.1/source/Dgame/Window/Internal/Init.d(171): Error: undefined identifier result
../../../../.dub/packages/dgame-0.6.0-rc.1/source/Dgame/Window/Internal/Init.d(183): Error: undefined identifier result
FAIL ../../../../.dub/packages/dgame-0.6.0-rc.1/.dub/build/lib-debug-posix.osx-x86_64-dmd_2067-2E5BF8748B103FBA840745DEA4F7B95A/ Dgame staticLibrary
Error executing command run:
dmd failed with exit code 1.
from dgame.
Yes, commet out the corresponding assert_fmt
also. Or introduce a fake int result;
to avoid the error.
from dgame.
Alright, I added in the fake result and commented out assert_fmt, and it complied and ran with the following output:
$ dub --force [13:49:50]
Building derelict-util 2.0.0 configuration "library", build type debug.
Running dmd...
Building derelict-sdl2 1.9.5 configuration "library", build type debug.
Running dmd...
Building derelict-gl3 1.0.13 configuration "library", build type debug.
Running dmd...
Building dgame 0.6.0-rc.1 configuration "lib", build type debug.
Running dmd...
Building dungeon ~master configuration "application", build type debug.
Compiling using dmd...
Linking...
Running ./dungeon
SDL version: 2.0.3
OpenGL Context created in OpenGL version 2.1
Set 4 as anti alias level
Your anti-alias (4) is too high and will be reduced to 0.
Derelict loaded GL version: 21 (21), available GL version: 2.1 INTEL-10.6.20
from dgame.
Interesting. Last check, please replace the whole if (gl.antiAlias > 0) { ... }
block with this:
if (gl.antiAlias > 0) {
debug print_fmt("Set %d as anti alias level\n", gl.antiAlias);
int max_samples;
glGetIntegerv(GL_MAX_SAMPLES, &max_samples);
ubyte antiAlias = gl.antiAlias;
if (antiAlias > max_samples) {
print_fmt("Your anti-alias (%d) is too high and will be reduced to %d.\n",gl.antiAlias, max_samples);
antiAlias = cast(ubyte) max_samples;
}
if (antiAlias > 0) {
int result = SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
assert_fmt(result == 0, "Error by initializing OpenGL: %s\n", SDL_GetError());
result = SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, antiAlias);
assert_fmt(result == 0, "Error by initializing OpenGL: %s\n", SDL_GetError());
}
}
from dgame.
Crashed
$ dub --force [13:50:16]
Building derelict-util 2.0.0 configuration "library", build type debug.
Running dmd...
Building derelict-sdl2 1.9.5 configuration "library", build type debug.
Running dmd...
Building derelict-gl3 1.0.13 configuration "library", build type debug.
Running dmd...
Building dgame 0.6.0-rc.1 configuration "lib", build type debug.
Running dmd...
Building dungeon ~master configuration "application", build type debug.
Compiling using dmd...
Linking...
Running ./dungeon
SDL version: 2.0.3
OpenGL Context created in OpenGL version 2.1
Set 4 as anti alias level
Error executing command run:
Program exited with code -11
from dgame.
You're not getting the Your anti-alias (4) is too high and will be reduced to 0.
message?
from dgame.
Nope.
from dgame.
Could you add a print_fmt("Maximal %d samples supported.\n", max_samples);
right after glGetIntegerv(GL_MAX_SAMPLES, &max_samples);
?
from dgame.
Ok, I am sure that the crash is coming from glGetIntegerv(GL_MAX_SAMPLES, &max_samples);
because I inserted print_fmt("Maximal %d samples supported.\n", max_samples);
before and after it and it only printed in stdout once
$ dub --force [14:04:45]
Building derelict-util 2.0.0 configuration "library", build type debug.
Running dmd...
Building derelict-sdl2 1.9.5 configuration "library", build type debug.
Running dmd...
Building derelict-gl3 1.0.13 configuration "library", build type debug.
Running dmd...
Building dgame 0.6.0-rc.1 configuration "lib", build type debug.
Running dmd...
Building dungeon ~master configuration "application", build type debug.
Compiling using dmd...
Linking...
Running ./dungeon
SDL version: 2.0.3
OpenGL Context created in OpenGL version 2.1
Set 4 as anti alias level
Maximal 0 samples supported.
Error executing command run:
Program exited with code -11
Here is the current code
if (gl.antiAlias > 0) {
debug print_fmt("Set %d as anti alias level\n", gl.antiAlias);
int max_samples;
print_fmt("Maximal %d samples supported.\n", max_samples);
glGetIntegerv(GL_MAX_SAMPLES, &max_samples);
print_fmt("Maximal %d samples supported.\n", max_samples);
ubyte antiAlias = gl.antiAlias;
if (antiAlias > max_samples) {
print_fmt("Your anti-alias (%d) is too high and will be reduced to %d.\n",gl.antiAlias, max_samples);
antiAlias = cast(ubyte) max_samples;
}
if (antiAlias > 0) {
int result = SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
assert_fmt(result == 0, "Error by initializing OpenGL: %s\n", SDL_GetError());
result = SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, antiAlias);
assert_fmt(result == 0, "Error by initializing OpenGL: %s\n", SDL_GetError());
}
}
from dgame.
Yeah it seems that you cannot use glGet* without having a valid context. Strange that it works well for other OS. What happens if you erase everything which corresponds to glGetIntegerv(GL_MAX_SAMPLES, &max_samples);
?
from dgame.
I changed the code to
if (gl.antiAlias > 0) {
debug print_fmt("Set %d as anti alias level\n", gl.antiAlias);
//int max_samples;
//print_fmt("Maximal %d samples supported.\n", max_samples);
//glGetIntegerv(GL_MAX_SAMPLES, &max_samples);
//print_fmt("Maximal %d samples supported.\n", max_samples);
ubyte antiAlias = gl.antiAlias;
//if (antiAlias > max_samples) {
// print_fmt("Your anti-alias (%d) is too high and will be reduced to %d.\n",gl.antiAlias, max_samples);
// antiAlias = cast(ubyte) max_samples;
//}
if (antiAlias > 0) {
int result = SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
assert_fmt(result == 0, "Error by initializing OpenGL: %s\n", SDL_GetError());
result = SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, antiAlias);
assert_fmt(result == 0, "Error by initializing OpenGL: %s\n", SDL_GetError());
}
}
and the game complies and runs, but everything still looks aliased and block-y.
from dgame.
You could try to set glEnable(GL_LINE_SMOOTH);
and glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
in your Applikation after you created the Window. And you could try to call int max_samples; glGetIntegerv(GL_MAX_SAMPLES, &max_samples);
to see if and how much samples you have. I guess you have 0 and because of that you see no anti alias.
from dgame.
Well I thought that too, but doing
import std.stdio;
import derelict.opengl3.gl;
import Dgame.Window;
import Dgame.System.StopWatch;
void main() {
GLContextSettings gl_settings;
gl_settings.antiAlias = GLContextSettings.AntiAlias.X4;
gl_settings.profile = GLContextSettings.Profile.Default;
Window window = Window(
1280,
720,
"Dungeon Game",
Window.Style.Default,
gl_settings
);
window.clear();
glEnable(GL_LINE_SMOOTH);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
int max_samples;
glGetIntegerv(GL_MAX_SAMPLES, &max_samples);
writeln("max_samples: ", max_samples);
wnd.display();
StopWatch.wait(2000);
}
prints max_samples: 8
from dgame.
And
glEnable(GL_LINE_SMOOTH);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
does not help?
from dgame.
from dgame.
Is this a Texture or a Font?
from dgame.
Font
from dgame.
But after turning the anti aliasing up to 8, there is still some noticeable aliases on the textures as well
from dgame.
Did you tried the Font.Mode?
from dgame.
The blended mode makes it a little bit better,
but there is some very clear aliasing that should not be seen when using 8x anti aliasing.
from dgame.
What do you mean with "that should not be seen when using 8x anti aliasing."?
from dgame.
When using 8x on other games that I play, I don't see this kind of artifacting on any of the text or sprites.I see no noticeable difference between the sprites when anti aliasing is on vs when it's off.
from dgame.
Here are two comparison shots:
from dgame.
Yeah, Anti-Alias is no panacea. ;) It helps to make lines and edges more clear, especially for Shapes, but for Textures it is not that simple, you need more, e.g. a FrameBuffer or Shader (which Dgame 0.6.* includes).
from dgame.
Any pointers on where I can start with FrameBuffers? I can't find anything in the documentation.
from dgame.
FrameBuffers are not supported from Dgame right now. You need to use plain OpenGL.
from dgame.
Ok, thanks.
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.