Cocos3d: Texture not displaying - cocos3d

I have created a Cocos3d iOS project and facing issue on texture display. My project has been kept under this link-> https://www.yousendit.com/download/UVJpWmdzTkwzMW40WjhUQw
If we run this project, we can see a sample house model output, where roof shows in plain white color in the house. But, actually i have added a roof texture in blender, and converted in pod. I don't know why the roof texture display not displaying when running the code in simulator. Could please download my sample project https://www.yousendit.com/download/UVJpWmdzTkwzMW40WjhUQw and suggest me. This project source also contains the .blend, .dae, .pod files which its using.
CC3PODResourceNode* podRezNode = [CC3PODResourceNode nodeWithName: #"RobotPODRez"];
podRezNode.resource = [IntroducingPODResource resourceFromFile: #"DieCube.pod"];
// If you want to stop the robot arm from being animated, uncomment the following line.
// [podRezNode disableAllAnimation];
podRezNode.shouldCullBackFaces = NO;
podRezNode.location = cc3v(0.0, 0.0, 0.0);
podRezNode.isTouchEnabled = YES;
[self addChild: podRezNode];

Your DAE files do not reference any textures:
TestHouse.dae:
<library_images/>
So, you must have not exported them from Blender.

Related

Unknown variable floor_tex on Gamemaker 8.1. How to fix it?

I have a very trouble with Gamemaker 8.1.
So recently, I've followed this video tutorial which shows creating a game 3D on its game engine.
https://www.youtube.com/watch?v=0Jo0JEEukhc
I tried to test my game, but an error message shows
this.
What caused that error? Here is the code so I hope you can fix it as well.
direction -= (display_mouse_get_x() -(display_get_width()/2))/5
zto -= (display_mouse_get_y() -(display_get_height()/2))/2
display_mouse_set(display_get_width()/2,display_get_height()/2)
xto = lengthdir_x(100,direction)+x
yto = lengthdir_y(100,direction)+y
d3d_set_projection(x,y,z,xto,yto,zto,0,0,1)
draw_set_color(c_white)
d3d_draw_floor(0,0,0,room_width,room_height,0,background_get_texture(floor_tex),room_width/128,room_height/128)
d3d_draw_floor(0,0,100,room_width,room_height,100,background_get_texture(root_tex),room_width/128,room_height/128)
Also, the version of Gamemaker is 8.1.141 (r11549)
Thanks
Cheers
-Sajad Sadiq Abd Amhamad
In the video, the author creates two Background resources around 0:25, called floor_tex and roof_tex (mistyped as root_tex in your code). You'd want to either name your resources accordingly or adjust your code to match the names in your project.

Why is QLineWidth not taken into account?

In Qt3D certain properties of rendered objects are not just simply set on the renderer, but they are globally (per view) or locally (on the material of a rendered object) added to the renderPasses - or so is my comprehension at least. (I'm using PySide2 - but the code is almost the same in C++)
For example when adding a geometry-renderer and using its primitive type point (Qt3DRender.QGeometryRenderer.Point) instead of rendering triangle-faces it displays the points of the geometry.
Here is an example figure with the default type.
The same only showing the points (renderer.setPrimitiveType(Qt3DRender.QGeometryRenderer.Points))
Hard to guess, but here the point-size has been already been changed - using the following code:
material = Qt3DExtras.QPhongMaterial(e)
for t in material.effect().techniques():
for rp in t.renderPasses():
pointSize = Qt3DRender.QPointSize(rp)
pointSize.setSizeMode(Qt3DRender.QPointSize.SizeMode.Fixed)
pointSize.setValue(5.0)
rp.addRenderState(pointSize)
According to the documentation the same mechanism can be used to change the line-width when rendering the object with Lines (LineStrip) as primitive type. Adding
lineWidth = Qt3DRender.QLineWidth(rp)
lineWidth.setValue(5.)
lineWidth.setSmooth(True)
rp.addRenderState(lineWidth)
does not change the line-width.
Why? Where do I need to add QLineWidth? Is it the material I chose which ignores the QLineWidth-state?
I'm fighting with similar problems at the moment. I tried to reproduce the behaviour with Qt3D line width test. When setting format version to 4.6 with CoreProfile, the maximum of linewidth seems to be 1 (or equivalently width=3 displayed by the line test).
It might be possible that this is the maximum supported range.
See:
https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glLineWidth.xhtml
opengl glLineWidth() doesn't change size of lines
Note: I deliberately chose version 4.6 as that is the supported openGL version on my environment.
I ran into the same issue. It appears the problem is caused by Qt3DExtras::Qt3DWindow, which constructs a QSurfaceFormat with an OpenGL core profile. The glLineWidth function is not supported in the core profile.
Unfortunately there is no way to pass a QSurfaceFormat to Qt3DWindow. Setting a new format after the window is created also does not work.
The only way around this is to write your own window class with a QSurfaceFormat in compatibility mode. For example:
setSurfaceType(QSurface::OpenGLSurface);
QSurfaceFormat format = QSurfaceFormat::defaultFormat();
format.setVersion(4, 3);
format.setProfile(QSurfaceFormat::CompatibilityProfile);
format.setDepthBufferSize(24);
format.setSamples(4);
format.setStencilBufferSize(8);
setFormat(format);
QSurfaceFormat::setDefaultFormat(format);
Fortunately Qt3DExtras::Qt3DWindow does not actually contain a lot of functionality and you can easily write a similar class with the QSurfaceFormat changes mentioned above.
You can find the original source here for reference:
https://code.woboq.org/qt5/qt3d/src/extras/defaults/qt3dwindow.cpp.html

How to embedd qr codes over existing image?

Sample image of qr code embedded over given image
So i am working with qr codes in my project and I need to superimpose my qr code over an image. Example image is attached. I generated this from an online qr code generator. Which libraries can i use to generate such such images either in a web application or a mobile application?
You can use any GD library provided by any programming language. What you're looking for is Watermarking. Some examples are:
C#
You can follow this article using GDI for .NET.
PHP
Example directly from manual.
<?php
// Load the stamp and the photo to apply the watermark to
$stamp = imagecreatefrompng('stamp.png');
$im = imagecreatefromjpeg('photo.jpeg');
// Set the margins for the stamp and get the height/width of the stamp image
$marge_right = 10;
$marge_bottom = 10;
$sx = imagesx($stamp);
$sy = imagesy($stamp);
// Copy the stamp image onto our photo using the margin offsets and the photo
// width to calculate positioning of the stamp.
imagecopy($im, $stamp, imagesx($im) - $sx - $marge_right, imagesy($im) - $sy - $marge_bottom, 0, 0, imagesx($stamp), imagesy($stamp));
// Output and free memory
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
?>

Qt OpenCV write video from capture frame, not saving

I can succesfully save video which I captured from c++ opencv there is no problem.
Bu similar code not capturing the video. Just opening out.avi . and only 6 kb.
I put the code in showframe func. there is no resizing fyi.
Anybody has experience with the opencv videowriter on the Qt?
void Widget::show_frame(Mat &image)
{
Mat resized_image = image.clone();
video.write(image);
int width_of_label = ui->label_camera->width();
int height_of_label = ui->label_camera->height();
Size size(width_of_label, height_of_label);
// cv::resize(image, resized_image, size);
cvtColor(image,image,CV_BGR2RGB);
cvtColor(resized_image, resized_image, CV_BGR2RGB);
ps : Platform MacOSX
I encountered the same problem with you, and I have tried many solutions, I think you can make the fifth parameter of videowriter() be false. That is, VideoWriter out = VideoWriter(video_name, CV_FOURCC('D', 'I', 'V', 'X'),frame_fps,Size(frame_width,frame_height),false). This works for me!
make sure that your application has access to the opencv_ffmpeg*.dll. For example place it in the working directory or the PATH variable.
Try different codecs, too. Afaik, MJPG did work on all tested machines/systems so far.

Created 3D object , but it doesn't rotate in cocos3d

I created one 3D object using Blender 2.66 and PowerVR Graphics SDK. I added the pod file and altered the hello-world project simply by replacing pod file name and node name.But the 3D object is not rotating. Is there any other changes tat i have to do in code? Is there any chance of error in pod file creation ? Thanks .
when you create a project in cocos3d the default pod file syntax is
[self addContentFromPODFile:#"hello-world.pod"];
you replace it with
where u use any node name
withName:#"HelloText"
[self addContentFromPODFile:#"hello-world.pod" withName:#"abc"];
And where you fild cc3meshnode replace getnodenamed with you set above
CC3MeshNode* hellotext = (CC3MeshNode*)[self getNodeNamed:#"abc"];

Resources