• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.


  • Content count

  • Joined

  • Last visited

Community Reputation

145 Neutral

About saman_artorious

  • Rank
  1. I do not know how to rotate bitmap BGR image of size 800 * 600 * 3 by 90 degrees. If it was an image with a header, the solution would be: QImage srcImg(":/icon.png"); QPoint center = srcImg.rect().center(); QMatrix matrix; matrix.translate(center.x(), center.y()); matrix.rotate(90); QImage dstImg = srcImge.transformed(matrix); QPixmap dstPix = QPixmap::fromImage(dstImg); I read the whole image in a 800 * 600 * 3 image. Next, before I render it to the screen, I need to rotate it by 90 degrees.
  2.   I want to get RGB values from a 24 bit BGR data. This data is from a raw image without a header. I don't know how to convert the index of the buffer to its corresponding RGB values. here is what I have done:     window_width  = 800;     window_height = 600;     size = window_width * window_height;     pixels = new float[size*3];     for(int i = 0, j = 0; i < size*3, j < size; i += 3, j++)     {         pixels[i+2] = bytes[i];     }     updateGL(); void GlWidget::paintGL() {     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);     glDrawPixels(window_width,window_height,GL_RGB,GL_FLOAT,pixels); } what am i missing?
  3. this shows how to bind an image to texture and not a bitmap.
  4. hi, I am receiving a bitmap of size 800 by 600 with RGB 24 bits. When I receive this bitmap from the other machine, I need to bind it to gl widget. what crossed my mind is to do the following, however I am not quite sure if it is correct:     initializeGLFunctions();     GLuint vboId;     glBindBuffer(GL_ARRAY_BUFFER, vboId);     glBufferSubData(GL_ARRAY_BUFFER, 0, 800 * 600 * 3 * sizeof(int), &buffer[0]);     glBindBuffer(GL_ARRAY_BUFFER, 0); is this the right way to bind bitmap to gl? I would also thank if you mention how to declare the vboId in the second line.
  5. I want to create a texture when I receive a byte array. This byte array is converted first to QImage and after I bind it to the texture. When I run the program, it shows it for a second and then it jumps out. Do you know why?   This is where I receive the byte array: void GlWidget::pixmapCatchFromForm(QByteArray bytes) {     QImage image((const uchar* )bytes.constData(), glWidth, glHeight, QImage::Format_ARGB32);     texture = bindTexture(image);     qDebug() << texture; // returns 1 } and here I render: void GlWidget::paintGL() { //! [5] glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); QMatrix4x4 mMatrix; QMatrix4x4 vMatrix; QMatrix4x4 cameraTransformation; cameraTransformation.rotate(alpha, 0, 1, 0); cameraTransformation.rotate(beta, 1, 0, 0); QVector3D cameraPosition = cameraTransformation * QVector3D(0, 0, distance); QVector3D cameraUpDirection = cameraTransformation * QVector3D(0, 1, 0); vMatrix.lookAt(cameraPosition, QVector3D(0, 0, 0), cameraUpDirection); //! [6] shaderProgram.bind(); shaderProgram.setUniformValue("mvpMatrix", pMatrix * vMatrix * mMatrix); shaderProgram.setUniformValue("texture", 0); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, texture); glActiveTexture(0); shaderProgram.setAttributeArray("vertex", vertices.constData()); shaderProgram.enableAttributeArray("vertex"); shaderProgram.setAttributeArray("textureCoordinate", textureCoordinates.constData()); shaderProgram.enableAttributeArray("textureCoordinate"); glDrawArrays(GL_TRIANGLES, 0, vertices.size()); shaderProgram.disableAttributeArray("vertex"); shaderProgram.disableAttributeArray("textureCoordinate"); shaderProgram.release(); }
  6. OpenGL

    I solved the problem. I calculated the central coordinate of the target circle and added it to the original drawing which is rendered at (0,0).  
  7. How can I draw a circle surround any given point on the screen? Normally, OpenGL draws the circle centered at (0,0). My position indicator consists of pixels rendered as rectangles. The number of pixels is a multiplication of angle and range given to me. For example, if ppi shall be drawn for 360 degree and range 1000, then I draw 360 * 1000 pixels on the screen. Accordingly, any point is detected with its relevant angle and range. Let's say a point exists at 50 degree and range 500. How can I encircle that point now?
  8. VNC is a good way, but, I don't think that it supports compression/decompression. That's why I need to write the app myself. Thanks for your idea though, I found it very useful.
  9. I don't think so, what I was afraid of, and what the fellows told me was if the resolution and monitor sizes differ, relative or percentage values could not be accurate.   for example, x:60 y:10 on a machine one with resolution: 1024:768 19 inch may not absolutely refer to the same point on machine 2 with resolution: 1360:768 same size. By the way, we came to an agreement to use the same widget size and resolution for two machines. However, I still like to know if the relative case can also direct me towards accurate results.
  10. OpenGL requires a texture, because the texture has more informations like how to handle accesses outside the normal co-ordinates range, how to do sub-texel sampling, and so on. However, you can load texel data into the full texture (glTexImage2D) or into a rectangular part of it (glTexSubImage2D). You can load raw data or already compressed data (although the later feature requires a specific minimum API version / extension).   Thanks for the hint. You know, I have done the same things, However, what I do not desire is high CPU consumption due to updating the screen 25 times per second. I receive 25 frames per second, load raw data into texture and then update the screen. This method takes much consumption, around 80% of CPU. A fellow, On the other hand, suggested me to use VLC Plugin for displaying the frames, you do have any information about using VLC plugin? by the way, I think I cannot progress with OPenGL anymore now.
  11. I am trying to run a program : http://ogldev.atspace.co.uk/www/tutorial16/tutorial16.html However, I get undefined reference to some function mentioned below, which is weird, because all those function and their headers are included in the tutorial source. /tmp/ccsp9wYo.o: In function `RenderSceneCB()': tutorial16.cpp:(.text+0x14): undefined reference to `Camera::OnRender()' tutorial16.cpp:(.text+0x128): undefined reference to `Pipeline::GetTrans()' tutorial16.cpp:(.text+0x215): undefined reference to `Texture::Bind(unsigned int)' /tmp/ccsp9wYo.o: In function `SpecialKeyboardCB(int, int, int)': tutorial16.cpp:(.text+0x27e): undefined reference to `Camera::OnKeyboard(int)' /tmp/ccsp9wYo.o: In function `PassiveMouseCB(int, int)': tutorial16.cpp:(.text+0x2bd): undefined reference to `Camera::OnMouse(int, int)' /tmp/ccsp9wYo.o: In function `main': tutorial16.cpp:(.text+0xa9b): undefined reference to `Camera::Camera(int, int)' tutorial16.cpp:(.text+0xba3): undefined reference to `Texture::Texture(unsigned int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' tutorial16.cpp:(.text+0xbce): undefined reference to `Texture::Load()' collect2: ld returned 1 exit status This is very weird, Can anyone running Linux do me a favor to try to run this program, I want to see where the problem comes from. (Don't forget to install libMagick with apt-get install libmagick++-dev)
  12. Really? I didn't know I can do that. What I have already asked you is to get the raw data, create texture and map it at the background. Can I directly load raw data without using textures?
  13. A iine like GLuint GLCAM_TEX; is missing at the beginning of the code snippet.     The texture is "saved" when invoking glTexImage2D, so to say. In fact, OpenGL is instructed to take the pixel data and to make a texture from it. The data is expected to be in pData array, copied there from the data stream received from the socket.     Now I'm coming to a kind of sermon... ;)   I'm under the impression that you more or less literally take what you get. With all due respect, that way is prone to fail miserably. Please, oblige yourself and try to understand how the provided code snippet works. There a dozens of tutorial how to texture with OpenGL on the internet. There are the manual pages for the OpenGL API, too. And here (and elsewhere) is a forum with people willing to help.   E.g. the glTexImage2D deals with the extent, data type, and component structure of the raw as well as of the texture data. You can't make this right if you don't know how glTexImage2D works. Look at the GL_UNSIGNED_BYTE specifier in the invocation above, and then look at the type of pData, which is an array of unsigned int. Well, there is no clear definition of what "unsigned int" actually means, but be sure that it does not match GL_UNSIGNED_BYTE. This is mentioned here not to blame the poster (he's done a good job to help you), but to show that an understanding of things is necessary also when adopting foreign code snippets.   Another point is that you're speaking of "a widget to render the texture to". Well, OpenGL doesn't define anything like a widget, and you gave no information of what API you use to define those widget. So we can't know what the solution could be. Maybe you mentioned it in another of your posts (I recently saw a second post from you), but you should write each thread so that it is self-contained (or, at least, references another post that contains enough information).   Thanks You, I will do review the function usages. You know, this code we have above, is what we do on our side. On the other side, the machine send the raw data. Could you please guide me what function I need to know to do that part as well.