I believe now Cocos2D 2.1 and above Support iPhone5 with image extension -widehd.png
I used same but not working in my game. Just searched in cocos2d and found these in CCFileUtils.h
- iPhone: ""
- iPhone HD: "-hd"
- iPhone5 : "-wide"
- iPhone5 HD: "-widehd"
- iPad: "-ipad"
- iPad HD: "-ipadhd"
- Mac: ""
- Mac HD: "-machd"
This indicates now by default cocos2d support iPhone5. Why not working for me?
CCFileUtils has the option to search resources in folders without using Suffix, and it's more clean than the suffix. To do that change the search mode from suffix to directory by using the following code:
CCFileUtils *sharedFileUtils = [CCFileUtils sharedFileUtils];
[sharedFileUtils setSearchMode:kCCFileUtilsSearchDirectoryMode];
Then, create at least one of the following folders:
resources-iphone5hd (for iPhone 5 retina resources )
resources-iphone5 (for iPhone 5 non-retina resources )
resources-iphonehd (for iPhone retina resources )
resources-iphone (for iPhone non-retina resources )
resources-ipadhd (for iPad retina resources )
resources-ipad (for iPad non-retina resources )
resources-mac (for OS X resources)
resources-machd (for OS X retina resources. N/A yet)
In Cocos2d 3.0 its working with -iphone5hd extension
imageName-iphone5hd.png // For iPhone5 wide screen image
Related
I want to simulate a raytracing on non-RTX graphics card but I can't. I got this error "Raytracing not supported on device" that I indicate in a code at bottom. I set m_useWarpDevice to true but why I still got the error? According to my understand WARP makes an application run any feature (including raytracing) even the hardware is not supported, but why it doesn't work?
Question: How to perform raytracing on a non-RTX graphics card? The reason I insist is I tried to ask the question in Microsoft Forum but no answer.
What is Windows Advanced Rasterization Platform (WARP) Guide?
From https://learn.microsoft.com/en-us/windows/win32/direct3darticles/directx-warp
WARP does not require graphics hardware to execute. It can execute even in situations where hardware is not available or cannot be initialized.
From https://alternativesp.com/software/alternative/windows-advanced-rasterization-platform-warp/
In Windows 10, WARP has been updated to support Direct3D 12 at level 12_1; under Direct3D 12, WARP also replaces the reference rasterizer.
Compiler: Visual Studio 2019
Graphic card: NVIDIA GeForce 920M (non-RTX)
DXSample.cpp
From https://github.com/ScrappyCocco/DirectX-DXR-Tutorials/blob/master/01-Dx12DXRTriangle/Project/DXSample.cpp
At line 19
DXSample::DXSample(const UINT width, const UINT height, const std::wstring name) :
m_width(width),
m_height(height),
m_useWarpDevice(true), // <-- It was false but I set it to true.
m_title(name)
{
m_aspectRatio = static_cast<float>(width) / static_cast<float>(height);
}
D3D12HelloTriangle.cpp
From https://github.com/ScrappyCocco/DirectX-DXR-Tutorials/blob/master/01-Dx12DXRTriangle/Project/D3D12HelloTriangle.cpp
At line 91
if (m_useWarpDevice) { // m_useWarpDevice = true
ComPtr<IDXGIAdapter> warpAdapter;
ThrowIfFailed(factory->EnumWarpAdapter(IID_PPV_ARGS(&warpAdapter))); // <-- Success
ThrowIfFailed(D3D12CreateDevice(warpAdapter.Get(), D3D_FEATURE_LEVEL_12_1, IID_PPV_ARGS(&m_device))); // <-- Success
}
else {
ComPtr<IDXGIAdapter1> hardwareAdapter;
GetHardwareAdapter(factory.Get(), &hardwareAdapter);
ThrowIfFailed(D3D12CreateDevice(hardwareAdapter.Get(), D3D_FEATURE_LEVEL_12_1, IID_PPV_ARGS(&m_device)));
}
At line 494
void D3D12HelloTriangle::CheckRaytracingSupport() const {
D3D12_FEATURE_DATA_D3D12_OPTIONS5 options5 = {};
ThrowIfFailed(m_device->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS5, &options5, sizeof(options5)));
if (options5.RaytracingTier < D3D12_RAYTRACING_TIER_1_0) // <-- options5.RaytracingTier = 0 on my computer which means that raytracing is not suppored.
throw std::runtime_error("Raytracing not supported on device"); // <-- I got this error.
}
Off-topic (just help in the future in case I forget):
https://alternativesp.com/software/alternative/windows-advanced-rasterization-platform-warp/
To force an application to use WARP without disabling the display driver, install the Direct X SDK. http://www.microsoft.com/en-us/download/details.aspx?id=6812 , go to C: / windows / system32, run dxcpl.exe, under “Scope” click “Edit list”, add the path to the application.
I tried to use dxcpl.exe to force WARP but options5.RaytracingTier is always 0.
Instead of using warp device you can use the dx12 RTX fallback layer.
https://github.com/microsoft/DirectX-Graphics-Samples/tree/e5ea2ac7430ce39e6f6d619fd85ae32581931589/Libraries/D3D12RaytracingFallback
Please note that is has a few limitations (resource binding is slightly different, also it's unlikely that they will continue to support it).
Also of course since it emulates the on chip RTX with compute shaders, performances are not as good as native.
We have production machines running RedHat RHEL 5.11 / X.org version 7.1.1. The supplier of these machines provides a VirtualBox VM to allow software development on conventional computers, i.e. away from the production floor.
I would like to configure this VM for dual head / dual monitor / dual screen usage.
Step 1: The VM in VirtualBox Manager is configured for maximum video memory and 2 monitors.
Step 2: VirtualBox GuestAdditions are installed, version corresponding to the Virtual Box application.
Step 3: /etc/X11/xorg.conf is modified to support 2 devices, 2 screens and 2 monitors, all configured for the vboxvideo driver. The content is shown below:
# Xorg configuration created by system-config-display
Section "ServerLayout"
Identifier "Multihead layout"
Screen 0 "Screen0" 0 0
Screen 1 "Screen1" RightOf "Screen0"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection
Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
Option "XkbModel" "pc105"
Option "XkbLayout" "us"
EndSection
Section "Monitor"
Identifier "Monitor0"
VendorName "Monitor Vendor"
ModelName "LCD Panel 1600x1200"
EndSection
Section "Monitor"
Identifier "Monitor1"
VendorName "Monitor Vendor"
ModelName "LCD Panel 1600x1200"
EndSection
Section "Device"
Identifier "Videocard0"
Driver "vboxvideo"
BusID "PCI:0:2:0"
Screen 0
EndSection
Section "Device"
Identifier "Videocard1"
Driver "vboxvideo"
BusID "PCI:0:2:1"
Screen 1
EndSection
Section "Screen"
Identifier "Screen0"
Device "Videocard0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 24
Modes "1600x1200" "1280x1024" "1280x960" "1280x800" "1152x864" "1024x768" "800x600" "640x480"
EndSubSection
EndSection
Section "Screen"
Identifier "Screen1"
Device "Videocard1"
Monitor "Monitor1"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1600x1200" "1280x1024" "1280x960" "1280x800" "1152x864" "1024x768" "800x600" "640x480"
EndSubSection
EndSection
Step 4: reboot the system
I expect now that the system is set-up and ready to show two screens on my computer. Alas, it only shows Screen0.
Observations:
/var/log/Xorg.0.log shows no errors, but a couple of warnings:
(WW) VBoxVideo(0): Failed to set up write-combining range (0xe0000000,0x8000000)
In the same log file, only the instance VBoxVideo(0) is mentioned; there is no reference to VBoxVideo(1)
lspci also shows only one instance of the VBox video driver:
00:02.0 VGA compatible controller: InnoTek Systemberatung GmbH VirtualBox Graphics Adapter
In VB Manager -> View only Virtual Screen 0 is said to be enabled; the other screen is available, but an "enable" option is presented, that appears to do nothing when selected.
Everything else I have seen seems to be consistent: the second screen is nowhere found on my RHEL VM.
Questions:
What is the importance of the warning on write-combining? Is this related to this problem?
Is vboxvideo driver / pseudo card a dual head card or should I instantiate a second card? What are the correct magic numbers for the BusID of the second "Device"?
Any other recommendation to get this configuration up-n-running?
I'm trying to match company names and ignore measurements/quantities. But I'm having a bit of trouble.
Example data:
8G Kingston Single DDR3-1600 CL11 Desktop RAM (KVR16N11/8)
8 Outlet Belkin Surge Protector With 2 Meter Cord
0.5M Yellow CAT6 Network Cable
100" Intact 16x -R DVD
15.6" Topload Notebook (Black)
120mm Aluminum Filter Silver
8P TP-Link 10/100 Desktop Switch
8Ware 0.5M CAT5E Network Cable
Acer Aspire Alpha 12" QHD IPS Display Intel Core i7 Touch Laptop
ACER Aspire E5 15.6" HD Intel Core i5 Laptop
Asus SDRW-08D2S-U Slim External USB 2.0 DVD Read/Writer - Black
I was hoping to match the company names but ignore the gigabytes (G) single digits, 100", 15.6" tokens etc.
So ideally it'd match:
Kingston Single DDR3-1600 CL11 Desktop RAM (KVR16N11/8)
Outlet Belkin Surge Protector With 2 Meter Cord
Yellow CAT6 Network Cable
Intact 16x -R DVD
Topload Notebook (Black)
Aluminum Filter Silver
TP-Link 10/100 Desktop Switch
8Ware 0.5M CAT5E Network Cable
Acer Aspire Alpha 12" QHD IPS Display Intel Core i7 Touch Laptop
ACER Aspire E5 15.6" HD Intel Core i5 Laptop
Asus SDRW-08D2S-U Slim External USB 2.0 DVD Read/Writer - Black
The expression I tweaked with is below, but I'm matching mm (the 120mm line) because I want the 8Ware matching.
Based upon the data you have provided, I have come up with a regex which you can use. Here is the sample code that you can run and see it prints your desired results.
public static void main(String[] args) {
List<String> dataList = new ArrayList<String>();
dataList.add("8G Kingston Single DDR3-1600 CL11 Desktop RAM (KVR16N11/8)");
dataList.add("8 Outlet Belkin Surge Protector With 2 Meter Cord");
dataList.add("0.5M Yellow CAT6 Network Cable");
dataList.add("100\" Intact 16x -R DVD");
dataList.add("15.6\" Topload Notebook (Black)");
dataList.add("120mm Aluminum Filter Silver");
dataList.add("8P TP-Link 10/100 Desktop Switch");
dataList.add("8Ware 0.5M CAT5E Network Cable");
dataList.add("Acer Aspire Alpha 12\" QHD IPS Display Intel Core i7 Touch Laptop");
dataList.add("ACER Aspire E5 15.6\" HD Intel Core i5 Laptop");
dataList.add("Asus SDRW-08D2S-U Slim External USB 2.0 DVD Read/Writer - Black");
System.out.println("Before:");
for (String s : dataList) {
System.out.println(s);
}
System.out.println();
System.out.println("After:");
for (String s : dataList) {
System.out.println(s.replaceAll("(^[0-9.]+[a-zA-Z\"]{0,2}\\s+)(.*)", "$2"));
}
}
Following is the output of this program upon running which is exactly what you wanted.
Before:
8G Kingston Single DDR3-1600 CL11 Desktop RAM (KVR16N11/8)
8 Outlet Belkin Surge Protector With 2 Meter Cord
0.5M Yellow CAT6 Network Cable
100" Intact 16x -R DVD
15.6" Topload Notebook (Black)
120mm Aluminum Filter Silver
8P TP-Link 10/100 Desktop Switch
8Ware 0.5M CAT5E Network Cable
Acer Aspire Alpha 12" QHD IPS Display Intel Core i7 Touch Laptop
ACER Aspire E5 15.6" HD Intel Core i5 Laptop
Asus SDRW-08D2S-U Slim External USB 2.0 DVD Read/Writer - Black
After:
Kingston Single DDR3-1600 CL11 Desktop RAM (KVR16N11/8)
Outlet Belkin Surge Protector With 2 Meter Cord
Yellow CAT6 Network Cable
Intact 16x -R DVD
Topload Notebook (Black)
Aluminum Filter Silver
TP-Link 10/100 Desktop Switch
8Ware 0.5M CAT5E Network Cable
Acer Aspire Alpha 12" QHD IPS Display Intel Core i7 Touch Laptop
ACER Aspire E5 15.6" HD Intel Core i5 Laptop
Asus SDRW-08D2S-U Slim External USB 2.0 DVD Read/Writer - Black
Like I said above, I have already given you a base regex and you may have to tweak it based upon your actual data if case you have more, else you are good already.
EDIT1:
Ok, as requested in comments, editing the answer to include the explanation of the regex.
(^[0-9.]+[a-zA-Z\"]{0,2}\s+)(.*)
The regex has two parts. First part (^[0-9.]+[a-zA-Z\"]{0,2}\s+) tries to match the measurements/quantities data. And second part just tries to match the remaining data which is supposedly the rest of the line. Elaborating only first part as second part (.*) is pretty trivial.
(^[0-9.]+[a-zA-Z\"]{0,2}\s+)
^ --> is for matching the start of data as measurement data is in the beginning of the line.
[0-9.]+ --> Matches the numbers one or more in the measurements/quantities data which can include a dot character.
[a-zA-Z\"]{0,2} --> This matches the units of data like G,M,mm," which according to given data can have length 0 to 2. E.g. "8 Outlet..." line does not have any units hence I had to use {0,2} else could have used {1,2}. And to avoid matching "8Ware ..." as measurement data, which you didn't want to match, I had to restrict the upper limit to 2.
\s+ is to just eat up one or more spaces present after measurement data.
So whole regex is matched and then replaced by $2, meaning only data captured by second part of regex (.*)
Hope that clarifies. Let me know in case you need explanation on any part further.
I tested my game on mac osx desktop and it works correctly.
Whenever I try to play it on a 64bit devices, it crashes at random places (at one of the menu scenes.. it doesn't happen on the actual gameplay scene for example..) which are seemed to be related to multiple deallocations.. It crashes when I use Sprites and menuitems but I don't think that it is specific to a single thing... The cocos2d-x v3.13.1 code is untouched.
Why I think that it is related to 64bit?
I tested the game on iOS 10.2 and 10.1 on iPhone 6s Plus, iPad Pro1 and iPhone 5.
The game played PERFECTLY on iPhone 5 (which does not support arm64 but armv7).
Why can it be?
Here is the initial log lines (related to GL) for iPhone5 and iPhone 6s plus respectively:
2016-12-30 14:13:47.205163 mygame[443:20061] [DYMTLInitPlatform] platform initialization successful
{
cocos2d.x.version: cocos2d-x-3.13.1
cocos2d.x.compiled_with_gl_state_cache: true
cocos2d.x.build_type: DEBUG
gl.supports_vertex_array_object: true
cocos2d.x.compiled_with_profiler: false
gl.renderer: PowerVR SGX 543
gl.vendor: Imagination Technologies
gl.version: OpenGL ES 2.0 IMGSGX543-128
gl.max_texture_size: 4096
gl.max_samples_allowed: 4
gl.supports_S3TC: false
gl.supports_ATITC: false
gl.supports_ETC1: false
gl.supports_OES_packed_depth_stencil: true
gl.max_texture_units: 8
gl.supports_PVRTC: true
gl.supports_NPOT: true
gl.supports_OES_map_buffer: true
gl.supports_OES_depth24: true
gl.supports_discard_framebuffer: true
gl.supports_BGRA8888: false
}
//=======================
2016-12-30 14:12:28.310751 mygame[733:79376] [DYMTLInitPlatform] platform initialization successful
2016-12-30 14:12:28.702187 mygame[733:79273] Metal GPU Frame Capture Enabled
2016-12-30 14:12:28.703649 mygame[733:79273] Metal API Validation Enabled
{
gl.supports_OES_map_buffer: true
gl.supports_vertex_array_object: true
cocos2d.x.version: cocos2d-x-3.13.1
gl.vendor: Apple Inc.
gl.supports_PVRTC: true
gl.renderer: Apple A9 GPU
cocos2d.x.compiled_with_profiler: false
gl.supports_S3TC: false
gl.version: OpenGL ES 2.0 Metal - 38.3
cocos2d.x.build_type: DEBUG
gl.max_texture_size: 4096
gl.supports_ETC1: false
gl.supports_BGRA8888: false
gl.max_texture_units: 8
gl.max_samples_allowed: 4
gl.supports_OES_packed_depth_stencil: true
gl.supports_ATITC: false
gl.supports_NPOT: true
gl.supports_discard_framebuffer: true
cocos2d.x.compiled_with_gl_state_cache: true
gl.supports_OES_depth24: true
}
UPDATE: I tested it on x64 (Mac OSX Desktop) and it works perfectly. So it is related to iOS 64 bit or... iOS Metal framework, etc...??
The problem I am facing is that I have a glx based application that will render basic primitives on a single thread just fine. I can move the XWindow between both Screens and my rendering loop keeps going. However, if any portion of my application has threads, even if it does not make any openGL calls or touch the XWindow on any other thread but the main thread the graphics I render are lost when I move the XWindow from one screen to the other.
The very first function call that I make is XInitThreads, so I know that X11 should be thread safe. As I said this works when drawing primitives on one thread, but it does not work when I add 1 or more threads. The threads are in a library that I do not have access to the source. I am just being asked to create the windowing portion of the code using X11.
What things should I be looking for to fix this?
Also note I have been guarnteed that all glcalls hapen on the thread I call them from inside the library.
Update
[matt6809#hogganz400 SampleApp]$ cat /etc/X11/xorg.conf && echo "--------" && xrandr --verbose && echo "-------" && glxinfo && echo "-------" && xdpyinfo
# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings: version 295.20 (buildmeister#swio-display-x86-rhel47-05.nvidia.com) Mon Feb 6 22:13:16 PST 2012
# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig: version 295.20 (buildmeister#swio-display-x86-rhel47-05.nvidia.com) Mon Feb 6 22:13:40 PST 2012
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
Screen 1 "Screen1" RightOf "Screen0"
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
Option "Xinerama" "1"
EndSection
Section "Files"
FontPath "/usr/share/fonts/default/Type1"
EndSection
Section "InputDevice"
# generated from default
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/input/mice"
Option "Emulate3Buttons" "no"
Option "ZAxisMapping" "4 5"
EndSection
Section "InputDevice"
# generated from data in "/etc/sysconfig/keyboard"
Identifier "Keyboard0"
Driver "kbd"
Option "XkbLayout" "us"
Option "XkbModel" "pc105"
EndSection
Section "Monitor"
Identifier "Monitor0"
VendorName "Unknown"
ModelName "DELL P190S"
HorizSync 30.0 - 81.0
VertRefresh 56.0 - 76.0
Option "DPMS"
EndSection
Section "Monitor"
Identifier "Monitor1"
VendorName "Unknown"
ModelName "DELL P190S"
HorizSync 30.0 - 81.0
VertRefresh 56.0 - 76.0
Option "DPMS"
EndSection
Section "Monitor"
Identifier "Monitor1"
VendorName "Unknown"
ModelName "DELL 1908FP"
HorizSync 31.0 - 83.0
VertRefresh 56.0 - 76.0
EndSection
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "Quadro 4000"
BusID "PCI:15:0:0"
Screen 0
EndSection
Section "Device"
Identifier "Device1"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "Quadro 4000"
BusID "PCI:15:0:0"
Screen 1
EndSection
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
Option "TwinView" "0"
Option "TwinViewXineramaInfoOrder" "DFP-0"
Option "metamodes" "DFP-0: nvidia-auto-select +0+0"
SubSection "Display"
Depth 24
EndSubSection
EndSection
Section "Screen"
Identifier "Screen1"
Device "Device1"
Monitor "Monitor1"
DefaultDepth 24
Option "TwinView" "0"
Option "metamodes" "DFP-2: nvidia-auto-select +0+0"
SubSection "Display"
Depth 24
EndSubSection
EndSection
--------
Xlib: extension "RANDR" missing on display ":0.0".
RandR extension missing
[matt6809#hogganz400 SampleApp]$
It's just a hunch, but it might be, that the OpenGL contexts are not cleanly migrated between threads. Your question doesn't make it clear, if you have full control over OpenGL and windowing operations.
The usual approach when it comes to OpenGL and multithreading is to keep all OpenGL operations confined to only one particular thread.
If you can not make sure of this, you should call
glXMakeContextCurrent(display, None, None, NULL); // GLX 1.3
or
glXMakeCurrent(display, None, NULL); // GLX 1.2 and earlier
after finishing OpenGL operations before yielding to another thread or finishing the tasklet to make sure the context is properly unbound from the current thread.
Rebind the context accordingly when needed.
I think it has to be the GL context. When you move from one screen to another you should switch to a GL context that has that (new) display. Use the expose event to select the other context. That is, create two context and use glxMakeCurrent(xdisplay,xwindow,xglcontext). Where xdisplay is the new display and xglcontext will be the other context)