image,opengl,c++11,png,tga , C++ Opengl - How to load tgas and pngs in modern OpenGL? [on hold]

C++ Opengl - How to load tgas and pngs in modern OpenGL? [on hold]


Tag: image,opengl,c++11,png,tga

I am looking for a way to load tgas and pngs in C++ Opengl - I dislike the idea of using a library though.

Is there any sample code / links / advice you could give me in this topic?


Writing a loader for TGA is relatively straightforward, so for an exercise: go for it.

PNG on the other hand is a different kind of beast. It has a gazillion features, supports multiple compression schemes and encodings, all of which you have to support to load PNG files generated by any program of which you can't control which features are used and which not.

That being said, libpng is the reference implementation and de-facto standard when it comes to reading and writing PNG files.

The actual texture loading has not changed since OpenGL-1.1, with the notable exception that since OpenGL-2 the power-of-2 constraint on the dimensions has been lifted.


Images not loaded from master page in directory,image
I will make a website whit ASP.NET using C# on the background. I have make my master page with the following image: <img src="afbeeldingen/berichten.png" alt="new messages" /> Because I have a lot of pages in my site, I have make directories in my solution. My problem is now when I...

Verify data integrity for varbinary column

I am inserting a .jpg into a varbinary(max) column in SQL Server 2012 using the following command: INSERT INTO Employees VALUES(5, (SELECT * FROM OPENROWSET(BULK N'C:\4.jpg',SINGLE_BLOB) AS image)) It inserts a record in the table. Then I used the following command to restore the file from db to file system....

Using raphael.js to draw an image with parameters sent through

This is what I have tried so far. socket-server.js var app = require('express')(); var http = require('http').Server(app); var io = require('')(http); var config = require('./config2.js'); app.get('/', function(req, res){ res.sendfile('socket-client.html'); }); io.on("connection", function (socket) { var mapRes = {width : 720, height: 1040}; socket.emit("mapRes", mapRes); }); http.listen(3000, function(){ console.log('listening on *:3000');...

OpenGL: Defining variables in shaders

My OpenGL program, using GLSL for shaders, has a simple vertex and fragment shader (given by a tutorial). The vertex shader is: #version 330 layout (location = 0) in vec3 Position; void main() { gl_Position = vec4(0.5 * Position.x, 0.5 * Position.y, Position.z, 1.0); } And the fragment shader is:...

adding link_to with image_tag and image path both

I am trying to replace the tag with link_to in my rails application view. for replacing I have svg icon, text and link all in one tag. Here is below <a class="navbar-brand" href="index.html"><%= image_tag 'logo.svg', "data-svg-fallback" => image_path('logo.svg'), :align=> "left" ,:style => "padding-right: 5px;" %> My Project </a> but I...

making an image exactly circular without borders

I want a circular image for my Profile activity. I have already tried these answers but it does n't work in my case. Create a circular image view in Android How to make an ImageView with rounded corners How to make an image fit into a circular frame in android...

Passing an int to a function, then using that int to create an array

I'm trying to create a textureLoader class for my openGL project and I can't initialize an array of textures inside of my class constructor because the the array won't accept anything unless it's a const int. To paint you a simple picture... myFunction(NUM) { GLuint textures[NUM]; } My past Failures...

How to convert an Image to Mat Android

I need to process Image for my Application. I get the Images for ImageReader. reader.setOnImageAvailableListener(new ImageReader.OnImageAvailableListener() { @Override public void onImageAvailable(ImageReader reader) { Image mImage = reader.acquireNextImage(); //mImage to Mat here mImage.close(); } },null); But now, I need to convert those images in Mat. I know that I can pass...

Opengl - Is glDrawBuffers modification stored in a FBO? No?

I try to create a FrameBuffer with 2 textures attaching to it (Multi Render Targets). Then in every time step, both textures are cleared and painted, as following code. (Some part will be replaced as pseudo code to make it shorter.) Version 1 //beginning of the 1st time step initialize(framebufferID12)...

How can I render an infinite 2D grid in GLSL?

Ideally, what I'd like to do is draw a single quad and have GLSL handle the creation of the actual gridlines. In my attempt so far the vertex shader: #version 400 layout (location = 0) in vec4 in_position; layout (location = 2) in vec3 in_UV; uniform mat4 model; uniform mat4...

Unable to render a texture on a quad

I am trying to program a simple game in C++ using OpenGL for graphics. In my game, I have objects that are rendered onscreen as a white square. I would like to be able to bind an image as a texture to these objects, so that I can render an...

Excel VBA 2013 Print Image

I would like to print an image that shows in a frame on a userform. frame1.Picture = LoadPicture(spath & xPicture & ".jpg") spath is the full path to where the picture is stored. This shows the picture just fine. Now I would like to be able to print it. Is...

what is the nodejs package for s3 image upload

I'm looking to upload my assets to s3. Is there any package in Nodejs like carrierwave in rails I want to resize images with versions. I have come across papercut. What is the best node module for s3 image upload....

Create mask from bwtraceboundary in Matlab

I'm trying to create a mask (or similar result) in order to erase pieces of a binary image that are not attached to the object surrounded by the boundary. I saw this thread ( to do this from bwboundaries, but I'm having trouble making suitable changes to it. My goal...

How to resize image according from screen resolution on html css

I want to change an image so that its size is according to the screen resolution, for example 1920x1080 to 1600x900, using HTML and CSS. How can I do it?...

No OpenGL context is current in the current thread

I'm following a tutorial on youtube but I have a problem with OpenGL that I'm not able to solve. I have no idea how I can fix it. Exception in thread "EndlessRunner" java.lang.IllegalStateException: No OpenGL context is current in the current thread. at org.lwjgl.opengl.GLContextWindows.createFromCurrent( at org.lwjgl.opengl.GLContext.createFromCurrent( at net.alfredo.Main.init( at

Fetch a saved image and display

I am developing an App in which I have stored images through imagePicker. now i want to display same images in my collectionView. I got response as a path path=assets/image/155/155_557b1259b8a51.jpg when i add then it shows error. How can i get the images through this path.Please Help me out....

How to search images by name inside a folder?

I have a MySQL table with a column "rounds" and each "rounds" has his own photos. Exemple round1 has photos from start=380 end=385. This means it has 6 photos and the name of the photos contains 380,381,382,383,384 or 385 inside. I use this PHP code to display the photos from...

Is there a way to make images take up less space in an apk or will I have to use an APK expansion file? [closed]

I made an app in android studio that has a lot of images, making the app exceed the 50MB limit. I do not fully understand how to make an expansion file so I want to try to avoid it. I copied all the images in each mipmap, can I get...

Make element fill rest of div without resizing Image

I want the Logo Image in this nav-bar to fill its height while still retaining its aspect ratio. The remaining width should be filled by the ul element. As long as the ul elements width is not 100% the image is displayed correctly. How can I do that? The...

Change Background image in WPF using C# [duplicate]

This question already has an answer here: Change WPF window background image in C# code 3 answers I'd like to change the background image of my WPF application by a button. I know how to do it using WindowsForms, but in WPF I failed. I found a solution already,...

Trouble generating Barcode using ZXing library with large data

I need to generate barcode in 128A format with data: 900000588548001100001305000000000207201512345.6|12345.7 I'm using ZXing library and Here is my method: private void barcodeGenerator(String data) { try { writer = new MultiFormatWriter(); BitMatrix bm = writer.encode(data, BarcodeFormat.CODE_128, 700, 200); Bitmap ImageBitmap = Bitmap.createBitmap(700, 200, Config.ARGB_8888); for (int i = 0;...

How to crop image from center using wp_image_editor

I am working on WordPress plugin. In plugin the user upload images from meta field and in back end i use wp_image_editor for cropping and re sizing the images. The images re sized very well but on cropping the images not cropped very well. I give x-dimension 100 and y-dimension...

why images in the Images.xcassets are not displayed?

There are some image resources in my Images.xcassets. Recently they cannot be displayed in the app when testing in the iPhone/iPad devices. I guess they are not copied to the Bundle when build and package. Then i check the Copy Bundle Resources in Build Phases. The Images.xcassets is in here....

Why are shaders and programs stored as integers in OpenGL?

I'm following the "OpenGL Superbible" book and I can't help but notice that when we create a shader and create the program that we attach the shaders to, we store them as GLuint which are unsigned integers. Why are they stored as numbers? What does the value of the number...

R32I sampler2D returns always 0

I have a (default vertex and) fragment shader that should resize textures and scale their color by a specific factor for brightness correction. The result is rendered into an GL_UNSIGNED_INT_8_8_8_8 framebuffer. #version 330 uniform sampler2D tex; uniform vec2 screenSize; uniform float scale; layout(location = 0) out vec4 color; void main()...

The order of the linked libraries C++ linker

I was debugging a project that depends on a set of libraries including libfreenect, OpenGL and OpenCL. The problem is that a black screen was the output. As a debugging option, I have removed the OpenCL code and the linked library completely trying to make sure that OpenGL works fine...

How to prevent exceeding matrix dimensions while dividing an image into blocks?

I have an image which I want to divide into overlapping blocks. I have set the box to be of size 8 rows and 8 columns, and the overlapping factor to be 4 rows/columns. This is what I have written to solve this: img = imread('a03-017-05.png'); overlap = 4 count...

Preload image for seamless background image change in JavaScript

I have a Python websocket application which sends an image path to a JavaScript HTML file. When the image path is received, I change the background image of the webpage to the supplied image. The issue I'm having at the moment, is when the background changes from the old image...

Create a border around image when active/clicked

I want to let my website visitors select from 3 different images and what I want now is a border around the image when they selected, so basically when it's active. I hope it's understandable what I am looking for. Can someone help me perhaps with that? I've tried to...

Saving images with more than 8 bits per pixel in matlab

I need to save a set of pre-processing images in matlab, resulting in grayscale images. The problem is the fact that these pre-processed images have pixel values higher than 255. If I save them with imwrite() as, for instance, .PNG files, does matlab normalize the values to be in [0,255]...

Import java package from Matlab deploytool to Android Studio App

I managed to create a java package from a Matlab function (for image processing) using deploytool. I tested it in Eclipse and it runs perfectly. The problem is that I want to use this Matlab function for an Android Studio project and I can´t find any way to make it...

PHP How to not cache generated HTML but cache static data like images/js/css

Many PHP developers add the no-cache header on top of their PHP pages, so do I, for obvious reasons. Since PHP generated content is usually dynamic, having the browser cache them results in outdated data being presented to the user. To avoid this caching is usually disabled. <?php //no cache...

Dynamically resize side-by-side images with different dimensions to the same height

I have two images side-by-side within a block-level container with arbitrarily different dimensions (as in, they could be any two images) that I want to dynamically adjust the width of so that the overall height of the two images is the same. I don't think this can be done in...

How to make a Javafx Image Crop App

I am building an application for my colleagues to crop image. I use FXML with Scene Builder to build the GUI. The user click a button to choose a image from his computer. Then, the image is shown in the GUI. User can zoom and move in the pane. At...

Creating GUI with OpenGL

I am trying to write a Java programm using LWJGL 3 and so far I've made it to creating a window, rendering to it and getting basic input. But I've ran into a problem with creating GUI and namely text fields that my programm requires. I found information that there...

Effect of rendering calls on performance

Consider a situation , Case 1 : I am giving opengl calls to draw the world by drawing all polygons. So all polygons will be drawn according to all objects exist. (Considered all translation rotation). Case 2 : I will allow only polygons that are in field of view(FOV) of...

What is the difference between glUseProgram() and glUseShaderProgram()?

In OpenGL what is the difference between glUseProgram() and glUseShaderProgram()? It seems in MESA and Nvidia provided glext.h, and in GLEW, both are defined, and both seem to do basically the same thing. I find documentation for glUseProgram() but not for glUseShaderProgram(). Are they truly interchangeable?...

Uploading PNG to Website Server

I have seen loads of other topics and I've tried them all. Can someone please help with why this script won't upload PNG files? Blank PNG image being displayed. $image = $_FILES['file']['tmp_name']; $image_name = $_FILES['file']['name']; $ext = pathinfo($image_name, PATHINFO_EXTENSION); $location = "Profiles/{$user}/Picture/{$image_name}"; $new_image = imagecreatetruecolor(100, 100); $source_image = imagecreatefrompng($image); imagealphablending($source_image,...

OpenGL glTexImage2D memory issue

I'm loading a cubemap to create a skybox, everything is fine and the skybox renders properly with a correct texture application. However, I decided to check my program safety with valgrind, Valgrind gives this error: The line 53 in sky.c is: glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGB, texture.width, texture.height, 0,...

Loading images into html5 canvas

I am using nodejs sails for my app. The app is going to use 50-100 images at some points. I was wondering if someone can point pro and cons of using /assests/images/ folder vs outside repository i.e. AWS S3 for image storing and pulling to draw on the canvas.

GLFW3 create window returns null

I was trying to put all GLFW3 init code from main to separate file. When I'm running the code, I get EXC_BAD_ACCESS on glew init function, because GLFW could not create window. Before code separation everything was ok. Is it possible to have GLFW setup code in other function? I'm...

Python Resize Multiple images ask user to continue

I'm trying to make a script that resize multiple or a single image based on a data pulled from XML. My question is if i have multiple images how can I print out a qusetion like "There are more than 1 image do you wish to resize image 2 also?......

Upload image to server from gallary or camera android

i have a Activity for Upload image from gallary or camera to server.image upload from camera is fine but upload from gallary is not done.i have a error showing BitmapFactory﹕ Unable to decode stream: FileNotFoundException i want to do when i pick up the image from gallary it is shown...

Can't get images from storage laravel 5

Hey so i'm trying to put my images into a slideshow i have on my index. the images are saved on storage/app , and then the rest of the path i retrive from my database. I managed to output the correct path on the <img src> tag, and the title...

Spotlight with shadows becomes square-like

I've been following a two part tutorial on shadow mapping from OGLDev (part 1, part 2) for a couple of days now, and I've nearly finished implementing it. My problem is that when I enable shadow maps the illuminated region which shadows appear in appears as a "strip" and I'm...

Is it possible to build a heatmap from point data at 60 times per second?

I'm working on a simulation for clouds (actual clouds) where the clouds are simulated by 3D points, then projected into a 2D heatmap, about 640x480 units big. The number of points is about 50k, which is as small as I can go without the simulation breaking, but I can't seem...

Captcha with merging a number with real image

I have searched for captcha generation tools, but I could not find any tool which can generate the below captcha pictures. You can seen these when you want to register on google. It uses a number merged on a real picture and produce a new real image picture. Do you...

Crop does not work for gallery images

I am using the following code to crop images from camera and gallery : private void doCrop() { final ArrayList<CropOption> cropOptions = new ArrayList<CropOption>(); Intent intent = new Intent(""); intent.setType("image/*"); List<ResolveInfo> list = getPackageManager().queryIntentActivities(intent, 0); int size = list.size(); if (size == 0) { Toast.makeText(this, getApplicationContext().getString(R.string.crop_unavailable), Toast.LENGTH_SHORT).show(); // return }...

I can't download images uploaded ​​with “move_uploaded_file()” code on filezilla

When I use move_uploaded_file() code everything works fine and my files are being moved to my server. But later if I want to download those files from my server using filezilla, it says: "Could not start the transfer process" But i can download other files crate with imagejpeg() code. So...