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]

Question:

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?


Answer:

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.


Related:


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


javascript,php,css,image,caching
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...

Effect of rendering calls on performance


c++,opengl
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...

GLFW3 create window returns null


c,opengl,struct,code-separation
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...

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


c++,arrays,opengl
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...

Python Resize Multiple images ask user to continue


python,xml,image,resize
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?......

How to resize image according from screen resolution on html css


html,css,image,screen-resolution
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?...

Uploading PNG to Website Server


php,mysql,image,png
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,...

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


c++,c,opengl,shader
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?...

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


c++,opengl,visualization,simulation,heatmap
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...

Verify data integrity for varbinary column


sql,sql-server,image,sql-server-2012
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....

what is the nodejs package for s3 image upload


node.js,image,amazon-s3
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 a border around image when active/clicked


css,image,border,active
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...

Fetch a saved image and display


ios,image,path
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 http://xyz.com.assets/image/155/155_557b1259b8a51.jpg then it shows error. How can i get the images through this path.Please Help me out....

Unable to render a texture on a quad


c++,opengl,textures,texturing
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...

No OpenGL context is current in the current thread


java,opengl,lwjgl
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(GLContextWindows.java:61) at org.lwjgl.opengl.GLContext.createFromCurrent(GLContext.java:36) at net.alfredo.Main.init(Main.java:59) at net.alfredo.Main.run(Main.java:91)...

Upload image to server from gallary or camera android


android,image,image-uploading
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...

Spotlight with shadows becomes square-like


c++,opengl,graphics,shader,shadow
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...

How to make a Javafx Image Crop App


java,image,canvas,graphics,javafx
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...

Images not loaded from master page in directory


asp.net,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...

Can't get images from storage laravel 5


php,image,laravel
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...

How to search images by name inside a folder?


php,mysql,image
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...

OpenGL glTexImage2D memory issue


c,opengl
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: http://pastebin.com/seqmXjyx The line 53 in sky.c is: glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGB, texture.width, texture.height, 0,...

Preload image for seamless background image change in JavaScript


javascript,image,preload
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...

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


image,matlab,image-processing,image-segmentation
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...

Creating GUI with OpenGL


java,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...

Make element fill rest of div without resizing Image


html,css,image,width
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. http://jsfiddle.net/5o0b4xLd/ How can I do that? The...

Saving images with more than 8 bits per pixel in matlab


image,matlab,image-processing,computer-vision
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]...

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


php,html,image,move
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...

Excel VBA 2013 Print Image


image,excel-vba,printing
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...

adding link_to with image_tag and image path both


html,ruby-on-rails,image,ruby-on-rails-4,svg
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...

Trouble generating Barcode using ZXing library with large data


java,android,image,barcode,zxing
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 { com.google.zxing.MultiFormatWriter 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;...

Crop does not work for gallery images


android,image,crop
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("com.android.camera.action.CROP"); 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 }...

Change Background image in WPF using C# [duplicate]


c#,wpf,image,background,resources
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,...

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


javascript,html,css,image
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...

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]


android,image,android-studio,apk-expansion-files
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...

Loading images into html5 canvas


javascript,node.js,image,html5-canvas,sails.js
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.

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


javascript,image,socket.io,raphael
This is what I have tried so far. socket-server.js var app = require('express')(); var http = require('http').Server(app); var io = require('socket.io')(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');...

How to crop image from center using wp_image_editor


wordpress,image,wordpress-plugin,resize-crop,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...

making an image exactly circular without borders


java,android,xml,image
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...

How to convert an Image to Mat Android


android,image,bitmap,mat
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...

Captcha with merging a number with real image


image,image-processing,merge,captcha
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...

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


opengl,state-machines,render-to-texture
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)...

Import java package from Matlab deploytool to Android Studio App


java,android,image,matlab,jar
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...

why images in the Images.xcassets are not displayed?


ios,image
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....

R32I sampler2D returns always 0


c++,opengl
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()...

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


opengl,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...

Why are shaders and programs stored as integers in OpenGL?


c++,opengl,opengl-es,integer,shader
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...

OpenGL: Defining variables in shaders


opengl,glsl
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:...

The order of the linked libraries C++ linker


c++,opengl,opencl
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...

Create mask from bwtraceboundary in Matlab


image,matlab,image-processing,mask,boundary
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 (http://www.mathworks.com/matlabcentral/answers/120579-converting-boundary-to-mask) to do this from bwboundaries, but I'm having trouble making suitable changes to it. My goal...